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.
A layout and customized scaffold generator for Rails to combine with active admin gem It generates the layout, the style, the internationalization and it helps you to startup active_admin gems
This version has been tested on Rails 4.2
to 5.0.beta2
and Ruby 2.2.3
on Windows OS and Linux
Click on Travis badge for more details.
For previous version go to the bottom of this read me.
gem install active_leonardo
or
rails new ActiveLeo -m https://db.tt/gPe6A0l9
or click here to download the template.
You can also get it from the gem root folder
Once you install the gem, the generators will be available to all Rails applications on your system.
To run the generator, go to your rails project directory and type to generate the layout:
rails generate leolay
Then type to generate the resource:
rails generate leosca
You can revert:
rails destroy leosca
You can generate and destroy more times until you will get your prototype.
Read the follow Step by step paragraph and the next Massive resources generation
Create the app and the layout:
rails new ActiveLeo -m YOUR_TEMPLATE_PATH (see above: install paragraph)
Answer y to all gems you need. After the questions it will start generations. If it is the first generation there will be a conflict on locales/en.yml, type y to overwrite.
Will be:
You will get an application ready to work, run:
rake db:migrate
rake db:seed
then
rails s
and try it on http://localhost:3000
If you get this message:
undefined local variable or method `new_user_registration_path'
be sure user model have :registerable devise's module otherwise add it into user model or you have to remove registerable code from
app\views\application\_session.html.erb
You can login as three different profiles as set in db\seeds.rb:
admin@activeleo.com, password: abcd1234 [this profile can do everything]
manager@activeleo.com, password: abcd1234 [can read, create, update and destroy]
user@activeleo.com, password: abcd1234 [can read, create and update]
There is a fourth profile for guest users who can only see the data. In addition to these you can create all the profiles you need according to cancan rules.
Create your resource as this example:
rails g leosca product name:string description:text active:boolean items:integer price:decimal
This will act as a normal scaffold and has more new features:
Draper is not directly supported but if you have installed it will be triggers in the resource generation chain.
Apply to db:
rake db:migrate
rake db:seed
That's all!
leolay:
rails generate leolay
rails generate leolay --skip-authentication --skip-authorization
leosca:
rails generate leosca product name:string
rails generate leosca product name:string --skip-seeds
rails generate leosca product name:string --seeds=60 => if you need more records
Write the resources you want to generate into the file scaffold.txt and put it in the root. A line for every resource, starting from the beginning with the name as you would do with the scaffold.
If the line is not a resource but another generator, you can simply starting with the full rails command.
Example:
# This is the main resource... (but i could change my mind)
activity user:references name:string{100} body:text completed:boolean percentage_progression:integer{1}
# completed: when all sub tasks are completed
# Any other comments about fields
# This table acts as...
task user:references activity:references name:string{100} body:text completed:boolean percentage_progression:integer{1} deadline_date:date
# I decided to add this because...
rails g migration AddFooToActivity foo:boolean
# I need this because...
rails g migration AddBarToTask bar:boolean
then let active leonardo work for you:
rails generate leosca:massive
and check the report:
create ...
insert ...
append ...
etc ...
---------------------------------------------
Generations started at 18:07:45
18:07:46 - generations ended in 1 second(s)
4 generations executed
9 lines discarded (comments etc.)
---------------------------------------------
of course you can even revert:
rails destroy leosca:massive
This is very useful for a rapid prototyping and if you keep it updated you can use it as information center about the database.
If you try that example remember to add the traslation of the two field foo and bar (added by migrations), otherwise you will get a translation error.
You could also customize leonardo templates both views and controller. To copy under your project folder run:
rails g leosca:install
Then go to
lib\generators\erb
to edit erb views like you would do with original scaffold. Go to
lib\generators\rails
if you want to customize more.
For more information about usage:
rails g leolay --help
rails g leosca --help
Currently the only one available is provided by ActiveAdmin
Download this project and go inside the folder
Install the bundle wherever you want:
bundle install --path=mybundle
Check current tasks typing:
rake -T
rake active:tests:all[inspection,rails_versions] # Tests all rails versions
rake active:tests:newapp[inspection,rails] # Creates a test rails ap...
rake active:tests:prepare[rails,path] # Prepare the environment...
If you want to test everything we planned
rake active:tests:all[inspection]
if you pass the argument inspection you can check the application under the test folder:
test/TestApp_xxx_42
...
where xxx is the current ruby version and the last number the rails version. Remember everytime you run a test that folders will be deleted and recreated.
Every rails version has its own bundle under ActiveLeonardo\mybundle_xx folder.
If you want to specify the rails version type:
rake active:tests:all[inspection,4.2]
or multiple versions
rake active:tests:all[inspection,4.1-4.2]
you may also specify your rails as ENV variables, for example on windows:
set CI_RAILS=4.2
bundle install --path=mybundle_42
rake active:tests:newapp[inspection,4.2]
Do NOT exec rake tests from bundle to avoid its bubble.
Supported until 0.6.x version
Supported until 0.6.x version
It should work but has not been tested
This Generators does not work with versions earlier 3.1
Visit my Blog
Please open an issue.
git checkout -b my-feature
)git commit -am 'I made extensive use of all my creativity'
)git push origin my-feature
)The GNU Lesser General Public License, version 3.0 (LGPL-3.0) See LICENSE file
FAQs
Unknown package
We found that active_leonardo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.