Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
h1. !http://railsapps.github.io/images/rails-36x36.jpg(RailsLayout Gem)! RailsLayout Gem
Use this gem to set up layout files for your choice of front-end framework:
It also will set up "Devise":https://github.com/plataformatec/devise views with styling for Bootstrap or Foundation.
RailsLayout is a utility gem to use during development.
h4. Other Tools
The RailsLayout gem is used by "Rails Composer":http://railsapps.github.io/rails-composer/ tool, an application template used to create starter applications. You can use Rails Composer to generate entire applications.
If you like the RailsLayout gem, you might be interested in the "RailsApps Testing gem":https://github.com/RailsApps/rails_apps_testing which sets up a testing framework for Rails.
h4. !http://railsapps.github.io/images/join/join-railsapps.png(Join RailsApps)!:http://railsapps.github.io/
h4. Support the RailsApps Project
If the RailsLayout gem is useful to you, please "support the RailsApps project":http://railsapps.github.io/ by purchasing our tutorials. The RailsApps project provides example applications, tutorials, and starter tools, including the RailsLayout gem.
h2. Command Summary
h4. Generate Application Layout, Navigation, and Flash Message Files
h4. Add Links to the Navigation File
h4. Generate Devise Views
h2. Installing a Front-End Framework
Refer to instructions for:
In summary, to install a front-end framework, add the gems you need. Then use the RailsLayout gem. It will set up your assets files.
Add the gems you need to your Rails application Gemfile:
h4. Zurb Foundation 5.3
gem 'foundation-rails'
See a note below about a necessary change to the config/application.rb file.
h4. Zurb Foundation 4.0
gem 'compass-rails' gem 'zurb-foundation'
h4. Bootstrap 4.0
gem 'bootstrap', '~> 4.0.0.alpha3.1'
h4. Bootstrap 3.3
gem 'bootstrap-sass'
h4. Bootstrap 2.3
gem 'bootstrap-sass', '~> 2.3.2.2'
h4. Use Bundler
Use Bundler to install the gem:
$ bundle install
h2. Install the RailsLayout Gem
Add it to your Rails application Gemfile:
group :development do gem 'rails_layout' end
You don't need the gem deployed to production, so put it in the @development@ group.
If you want to use a newer unreleased version from GitHub:
group :development do gem 'rails_layout', github: 'RailsApps/rails_layout' end
Use Bundler to install the gem:
$ bundle install
h2. The "layout:install" Command
The command will rename application.css to application.css.scss.
It will add:
The Rails asset pipeline loads asset files in alphabetical order (unless the assets are specified explicitly in the manifest file). The file is named @1st_load_framework.css.scss@ so the framework will be loaded first before any custom CSS files added by the developer.
And modify the JavaScript asset file:
It will set up a default application layout.
It creates partials for:
Additionally, if Devise or OmniAuth is present, the command will add Sass mixins to accommodate forms. The Sass mixins add form styling to be used with either Bootstrap or Foundation (so we don't have to maintain separate views for each front-end framework).
h4. Supported Frameworks
You can generate layout files suitable for use with the following front-end frameworks:
h4. Generated Files
The RailsLayout gem generates application layout files:
If Devise or OmniAuth is installed, there will be an additional file:
Additionally, when the @simple@ option is selected:
h4. Note About the Navigation Partials
The _navigation.html.erb file contains framework-specific styling. Separating the files makes it easy to change the front-end framework without disturbing the links.
The _navigation_links.html.erb file is only a list of links. You can add additional links to this file as needed. It contains no framework-specific styling (except if you are using Bootstrap 4).
The _nav_links_for_auth.html.erb file is created if Devise or OmniAuth is installed.
h4. Support for ERB, Haml, or Slim
If you are using ERB for Rails views, the RailsLayout gem will generate ERB files.
If you are using Haml or Slim, the RailsLayout gem will generate Haml or Slim files instead.
h4. Additional Documentation
See these articles for information about how to set up the application layout:
Look at the "Learn Rails":https://github.com/RailsApps/learn-rails example application to see how the generated files from the RailsLayout gem are used. You'll find details about the example application in the book "Learn Ruby on Rails":http://learn-rails.com/learn-ruby-on-rails.html.
!http://railsapps.github.io/images/learn-rails-cover-130x161.jpg(Learn Ruby on Rails)!:http://learn-rails.com/learn-ruby-on-rails.html
h3. Zurb Foundation 5.3 Layout
To create layout files for use with Zurb Foundation 5.3:
$ rails generate layout:install foundation5
Use @--force@ if you want to overwrite existing files:
$ rails generate layout:install foundation5 --force
See the files that are generated:
The RailsLayout gem will create the file:
and modify the file:
h4. config/application.rb
The rails_layout gem will make a necessary change to the config/application.rb file. It will add:
module RailsFoundation class Application < Rails::Application . . . # For Foundation 5 config.assets.precompile += %w( vendor/modernizr ) end end
See "issue 19":https://github.com/RailsApps/rails_layout/issues/19 for an explanation.
h3. Zurb Foundation 4.0 Layout
To create layout files for use with Zurb Foundation 4.0:
$ rails generate layout:install foundation4
Use @--force@ if you want to overwrite existing files:
$ rails generate layout:install foundation4 --force
See the files that are generated:
The RailsLayout gem will create the file:
and modify the file:
h3. Bootstrap 3.3 or 4.0 Layout
To create layout files for use with Bootstrap 4.0:
$ rails generate layout:install bootstrap4
To create layout files for use with Bootstrap 3.3:
$ rails generate layout:install bootstrap3
Use @--force@ if you want to overwrite existing files:
$ rails generate layout:install bootstrap3 --force
See the files that are generated:
The RailsLayout gem will create the file:
and modify the file:
h3. Bootstrap 2.3 Layout
To create layout files for use with Bootstrap 2.3:
$ rails generate layout:install bootstrap2
Use @--force@ if you want to overwrite existing files:
$ rails generate layout:install bootstrap2 --force
See the files that are generated:
The RailsLayout gem will create the file:
and modify the file:
h3. Generate a Simple Layout
To create a set of simple layout files:
$ rails generate layout:install simple
Use @--force@ if you want to overwrite existing files:
$ rails generate layout:install simple --force
See the files that are generated:
The RailsLayout gem will create the file:
h3. Reverting to None
To revert your application to a default application layout:
$ rails generate layout:install none
The RailsLayout gem will remove any files it may have added:
Additionally, it will restore these files to the default versions:
The file app/assets/stylesheets/application.css.scss will contain a CSS rule but you can ignore it or remove it.
h2. The "layout:navigation" Command
If you are using Devise or OmniAuth for authentication, you can generate a navigation links partial containing appropriate links.
This command is used to populate the navigation bar in starter applications created by the "Rails Composer":http://railsapps.github.io/rails-composer/ tool.
$ rails generate layout:navigation --force
Here's an example of a file app/views/layouts/_nav_links_for_auth.html.erb appropriate for Devise:
<%# add navigation links to this file %>
The full set of links will be created if initialization files are found for Devise or OmniAuth.
h2. The "layout:devise" Command
"Devise":https://github.com/plataformatec/devise is a gem for authentication and user management (signup, login, and related features). Devise provides a utility command @rails generate devise:views@. The Devise command creates view files for signup, login, and related features. However, the views generated by Devise lack CSS styling.
Use the RailsLayout gem to generate Devise views with styling for Bootstrap or Foundation.
The command will create (or replace) these files:
h4. Limitations
At this time, with the "layout:devise" command, only Foundation 5 or Bootstrap 3 are supported. Files are not generated for Haml or Slim.
h2. Issues
Any issues? Please create an "issue":http://github.com/RailsApps/rails_layout/issues on GitHub. Reporting issues (and patching!) helps everyone.
h2. Credits
Daniel Kehoe maintains this gem as part of the "RailsApps project":http://railsapps.github.io/.
Please see the "CHANGELOG":https://github.com/RailsApps/rails_layout/blob/master/CHANGELOG.textile for a list of contributors.
Is the gem useful to you? Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. I'd love to know you were helped out by the gem.
h2. MIT License
"MIT License":http://www.opensource.org/licenses/mit-license
Copyright © 2013-2014 Daniel Kehoe
h2. Useful Links
|. Getting Started |. Articles |_. Tutorials | | "Ruby on Rails":http://railsapps.github.io/ruby-and-rails.html | "Analytics for Rails":http://railsapps.github.io/rails-google-analytics.html | "Rails Bootstrap":http://railsapps.github.io/twitter-bootstrap-rails.html | | "What is Ruby on Rails?":http://railsapps.github.io/what-is-ruby-rails.html | "Heroku and Rails":http://railsapps.github.io/rails-heroku-tutorial.html | "Rails Foundation":http://railsapps.github.io/rails-foundation.html | | "Learn Ruby on Rails":http://learn-rails.com/learn-ruby-on-rails.html | "JavaScript and Rails":http://railsapps.github.io/rails-javascript-include-external.html | "RSpec Tutorial":http://railsapps.github.io/rspec.html | | "Rails Tutorial":https://tutorials.railsapps.org/rails-tutorial | "Rails Environment Variables":http://railsapps.github.io/rails-environment-variables.html | "Rails Devise Tutorial":http://railsapps.github.io/tutorial-rails-devise.html | | "Ruby on Rails Tutorial for Beginners":http://learn-rails.com/ruby-on-rails-tutorial-for-beginners | "Git and GitHub with Rails":http://railsapps.github.io/rails-git.html | "Devise RSpec":http://railsapps.github.io/tutorial-rails-devise-rspec-cucumber.html | | "Install Ruby on Rails":http://railsapps.github.io/installing-rails.html | "Send Email with Rails":http://railsapps.github.io/rails-send-email.html | "Devise Bootstrap":http://railsapps.github.io/tutorial-rails-bootstrap-devise-cancan.html | | "Install Ruby on Rails - Mac OS X":http://railsapps.github.io/installrubyonrails-mac.html | "Haml and Rails":http://railsapps.github.io/rails-haml.html | "Rails Membership Site with Stripe":https://tutorials.railsapps.org/rails-stripe-membership-saas | | "Install Ruby on Rails - Ubuntu":http://railsapps.github.io/installrubyonrails-ubuntu.html | "Rails Application Layout":http://railsapps.github.io/rails-default-application-layout.html | "Rails Subscription Site with Recurly":https://tutorials.railsapps.org/rails-recurly-subscription-saas | | "Ruby on Rails - Nitrous.io":http://railsapps.github.io/rubyonrails-nitrous-io.html | "HTML5 Boilerplate for Rails":http://railsapps.github.io/rails-html5-boilerplate.html | "Startup Prelaunch Signup Application":https://tutorials.railsapps.org/rails-prelaunch-signup | | "Update Rails":http://railsapps.github.io/updating-rails.html | "Example Gemfiles for Rails":http://railsapps.github.io/rails-3-2-example-gemfile.html | | "Rails Composer":http://railsapps.github.io/rails-composer/ | "Rails Application Templates":http://railsapps.github.io/rails-application-templates.html | | "Rails Examples":http://railsapps.github.io/ | "Rails Product Planning":http://railsapps.github.io/rails-product-planning.html | | "Rails Starter Apps":http://railsapps.github.io/rails-examples-tutorials.html | "Rails Project Management":http://railsapps.github.io/rails-project-management.html |
!https://cruel-carlota.pagodabox.com/b096716fb733287d5c3d5eec65aaa26b(githalytics.com alpha)!
FAQs
Unknown package
We found that rails_layout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.