
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
A light framework for front-end development inspired by Rails. The sole purpose of Rail is to compile assets, and it includes the following components:
Install the gem:
gem install rail
Create a new project:
rail new my_project
Run Bundler:
cd ./my_project
bundle
Run the server:
rake server
Open http://localhost:3000
in your browser, see “My Project,” and enjoy.
Under the hood, the rail new my_project
command creates a new folder in the
current directory called my_project
and initializes a basic Rail project
inside that folder. In this case, MyProject
is used as the class name of the
project. Feel free to replace my_project
with the name of your project.
Create a Gemfile
:
source 'https://rubygems.org'
gem 'rail'
Run Bundler:
bundle
Create three files: config/application.rb
, config.ru
, and Rakefile
. In
config/application.rb
:
require 'bundler'
Bundler.require(:default)
module MyProject
class Application < Rail::Application
end
end
In config.ru
:
require_relative 'config/application'
run MyProject::Application.new
In Rakefile
:
require_relative 'config/application'
MyProject::Application.load_tasks
Feel free to replace MyProject
with the name of your project.
Rail closely follows Rails. If you know Rails, you already know Rail.
Organize your code according to the following convention:
app/assets/javascripts
for scripts,app/assets/stylesheets
for styles,app/views
for templates,app/helpers
for helper modules, andpublic
for other static content.The templates in app/views/layouts
have a special purpose. First,
application.html.haml
is used for rendering the root of your application (both
/
and /index.html
). Second, any template in layouts
is used as a layout
for the templates in the subfolder of views
that has the same name as the
layout. For example, articles/what-is-the-meaning-of-life.html.haml
will be
rendered in the context of layouts/articles.html.haml
provided that the latter
has a placeholder for the former via the yield
keyword.
As with Rails, Rail is configured inside config/application.rb
:
module MyProject
class Application < Rail::Application
# Gems to look for additional assets
config.gems << 'googleplus-reader'
# Assets to precompile when running `rake assets`
config.precompile << 'application.css'
config.precompile << 'application.js'
config.precompile << 'index.html'
# Compress assets when serving and precompiling
config.compress = true
end
end
If config.compress
is not specified, it is implicitly set to ENV['RAIL_ENV'] == 'production'
.
Run Rake to see the available tasks:
rake -T
rake assets # Precompile assets
rake server # Start server
rake server
starts up a Web server; if none is specified in Gemfile
,
WEBrick will be fired up.
rake assets
compiles your assets and stores them in public
. You should
explicitly tell Rail what to compile as it was shown in the previous section.
Note that the server will try to serve from public
first, so make sure you
delete the precompiled files when you change your code in app
.
Additional usage examples can be found here, here, and here.
FAQs
Unknown package
We found that rail 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.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.