active_leonardo 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +44 -0
- data/LICENSE +19 -19
- data/README.md +173 -0
- data/active_template.rb +141 -137
- data/lib/generators/active_leonardo.rb +7 -1
- data/lib/generators/erb/leosca/leosca_generator.rb +122 -122
- data/lib/generators/leolay/USAGE +21 -21
- data/lib/generators/leolay/leolay_generator.rb +420 -400
- data/lib/generators/leolay/templates/app/admin/users.rb +87 -87
- data/lib/generators/leolay/templates/config/locales/it.yml +7 -0
- data/lib/generators/leolay/templates/spec/helpers/application_helpers.rb +13 -13
- data/lib/generators/leolay/templates/spec/support/devise.rb +4 -4
- data/lib/generators/leolay/templates/styles/active/stylesheets/app/custom_active_admin.css.scss +27 -27
- data/lib/generators/leosca/USAGE +23 -23
- data/lib/generators/rails/leosca/USAGE +39 -39
- data/lib/generators/rails/leosca/leosca_generator.rb +55 -55
- data/lib/generators/rails/leosca/templates/leosca.css +56 -56
- data/lib/generators/rails/leosca_controller/USAGE +23 -23
- data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +192 -188
- data/lib/generators/rails/leosca_controller/templates/controller.rb +3 -3
- data/lib/generators/rspec/leointegration/leointegration_generator.rb +35 -35
- data/lib/generators/rspec/leointegration/templates/admin/feature.rb +67 -67
- data/lib/generators/rspec/leointegration/templates/feature.rb +9 -9
- data/lib/generators/rspec/leosca/leosca_generator.rb +57 -57
- data/lib/generators/rspec/leosca/templates/admin/controller_spec.rb +181 -181
- data/lib/generators/rspec/leosca/templates/admin/edit_spec.rb +31 -31
- data/lib/generators/rspec/leosca/templates/admin/index_spec.rb +32 -32
- data/lib/generators/rspec/leosca/templates/admin/new_spec.rb +30 -30
- data/lib/generators/rspec/leosca/templates/admin/routing_spec.rb +39 -39
- data/lib/generators/rspec/leosca/templates/admin/show_spec.rb +28 -28
- data/lib/generators/rspec/leosca/templates/controller_spec.rb +168 -168
- data/lib/generators/rspec/leosca/templates/edit_spec.rb +31 -31
- data/lib/generators/rspec/leosca/templates/index_spec.rb +32 -32
- data/lib/generators/rspec/leosca/templates/new_spec.rb +30 -30
- data/lib/generators/rspec/leosca/templates/routing_spec.rb +39 -39
- data/lib/generators/rspec/leosca/templates/show_spec.rb +28 -28
- metadata +55 -124
- data/CHANGELOG +0 -28
- data/README.rdoc +0 -159
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cc9c60c86ec59ff1bba930f142081ea5bc0a18e3
|
4
|
+
data.tar.gz: a8704fb1c0833a346c38a57e68c1d98c71b9dcf7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ab9a173052283360b7452eeb786095e17a5894ee59185c8dbb603d83e9abee8103715004e97285e540580e6b1a186597ba1338bef3b2dbde80200209cfd1a090
|
7
|
+
data.tar.gz: 19e2b1063805b8c1e1fcbb7ce9c0cc3937163e81c426151696f700e7ebbd615d2699cac0d7acd5e3f9f103b31fbd5401ee16e3e3b15f753b2cd021dfff15b568
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
0.2.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.1.0...v0.2.0) March 6th, 2014
|
2
|
+
------------------------------
|
3
|
+
* Tested with Rails 4.0, Ruby 2.0 and ActiveAdmin 1.0.0pre
|
4
|
+
* Now "references" data types into seeds.rb have more consistent data
|
5
|
+
* Improved i18n integration
|
6
|
+
* Restored original TestUnit
|
7
|
+
* Improved cancan integration
|
8
|
+
|
9
|
+
0.1.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.7...v0.1.0) February 18th, 2013
|
10
|
+
------------------------------
|
11
|
+
* Added alias batch_action to ability so who can update can also use batch action. Still You will need to authorize every action.
|
12
|
+
|
13
|
+
0.0.7 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.6...v0.0.7) January 16th, 2013
|
14
|
+
------------------------------
|
15
|
+
* Added devise locale yaml
|
16
|
+
* Added roles? method to authentication model (user)
|
17
|
+
* Fixed custom active admin sass
|
18
|
+
|
19
|
+
0.0.6 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.5...v0.0.6) January 14th, 2012
|
20
|
+
------------------------------
|
21
|
+
* Configuration parameters moved into a yaml file (config.yml)
|
22
|
+
* Template updated
|
23
|
+
|
24
|
+
0.0.5 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.4...v0.0.5) September 26th, 2012
|
25
|
+
------------------------------
|
26
|
+
* Added support to activeadmin 0.0.5
|
27
|
+
* Added cancan's unauthorized message to localization
|
28
|
+
|
29
|
+
0.0.4 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.3...v0.0.4) August 13th, 2012
|
30
|
+
------------------------------
|
31
|
+
* Now you can use any name instead of *User*
|
32
|
+
|
33
|
+
0.0.3 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.2...v0.0.3) August 10th, 2012
|
34
|
+
------------------------------
|
35
|
+
* Improved cancan integration
|
36
|
+
* Localization yaml file cleaned from some previous leonardo stuff
|
37
|
+
|
38
|
+
0.0.2 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.1...v0.0.2) May 23th, 2012
|
39
|
+
------------------------------
|
40
|
+
* Minor changement
|
41
|
+
|
42
|
+
0.0.1 May 23th, 2012
|
43
|
+
------------------------------
|
44
|
+
* First release
|
data/LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2011 Marco Mastrodonato
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
1
|
+
Copyright (c) 2011 Marco Mastrodonato
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
# Leolay Generators
|
2
|
+
|
3
|
+
[![Version ](http://img.shields.io/gem/v/active_leonardo.svg) ](https://rubygems.org/gems/active_leonardo)
|
4
|
+
[![Quality ](http://img.shields.io/codeclimate/github/marcomd/Active_Leonardo.svg)](https://codeclimate.com/github/marcomd/Active_Leonardo)
|
5
|
+
|
6
|
+
A layout and customized scaffold generator for Rails to combine with active admin gem
|
7
|
+
It generates the layout, the style, the internationalization and it helps you to startup active_admin gems
|
8
|
+
|
9
|
+
## Compatibility
|
10
|
+
|
11
|
+
This version has been tested on Rails 4.0.x and Ruby 2.0 on Windows OS
|
12
|
+
|
13
|
+
|
14
|
+
## Install
|
15
|
+
|
16
|
+
gem install active_leonardo
|
17
|
+
|
18
|
+
or
|
19
|
+
|
20
|
+
rails new ActiveLeo -m http://dl.dropbox.com/u/52600966/active_template.rb
|
21
|
+
|
22
|
+
Click [here](http://dl.dropbox.com/u/52600966/active_template.rb) to download the template.
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Once you install the gem, the generators will be available to all Rails applications on your system.
|
27
|
+
|
28
|
+
To run the generator, go to your rails project directory and type:
|
29
|
+
|
30
|
+
rails generate leolay || rails destroy leolay
|
31
|
+
rails generate leosca || rails destroy leosca
|
32
|
+
|
33
|
+
You can run it more times and right like scaffold, it's smart and won't generate tons of identical code (thanks thor)
|
34
|
+
|
35
|
+
**Warning**: Leosca destroy do not remove variables parts inserted into feed like time values.
|
36
|
+
|
37
|
+
### Step by step
|
38
|
+
|
39
|
+
1. Firstly, create layout and initialize your project:
|
40
|
+
|
41
|
+
rails new ActiveLeo -m http://dl.dropbox.com/u/52600966/active_template.rb
|
42
|
+
|
43
|
+
(You can also find the template into gem root folder)
|
44
|
+
|
45
|
+
Answer y to all gems you need.
|
46
|
+
After the questions it will start generations.
|
47
|
+
If it is the first generation there will be a conflict on locales/en.yml, type y to overwrite.
|
48
|
+
|
49
|
+
Will be:
|
50
|
+
* Created a default layout like active admin
|
51
|
+
* Created i18n files
|
52
|
+
* Created user management on active admin
|
53
|
+
* Customized application.rb to exclude javascript and stylesheet for every resource you will create
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
2. You will get an application ready to work, run:
|
58
|
+
|
59
|
+
rails s
|
60
|
+
|
61
|
+
and try it on http://localhost:3000
|
62
|
+
|
63
|
+
If you get this message:
|
64
|
+
|
65
|
+
*undefined local variable or method `new_user_registration_path'*
|
66
|
+
|
67
|
+
be sure user model have **:registerable** devise's module otherwise add it into user model or you have to remove registerable code from
|
68
|
+
|
69
|
+
app\views\application\_session.html.erb
|
70
|
+
|
71
|
+
You can login as three different profiles loaded with a previous db:seed:
|
72
|
+
|
73
|
+
1. admin@activeleo.com, password: abcd1234 [this profile can do everything]
|
74
|
+
|
75
|
+
2. manager@activeleo.com, password: abcd1234 [can read, create and update]
|
76
|
+
|
77
|
+
3. user@activeleo.com, password: abcd1234 [can read, create, update and destroy]
|
78
|
+
|
79
|
+
|
80
|
+
3. Create your resource:
|
81
|
+
|
82
|
+
rails g leosca product name:string description:text active:boolean items:integer price:decimal
|
83
|
+
|
84
|
+
This will act as a normal scaffold and has more new features:
|
85
|
+
|
86
|
+
1. will be invoked new leosca_controller which is a customized scaffold_controller
|
87
|
+
2. attributes will be insert into i18n files for a quick translation
|
88
|
+
3. seeds will be created for you to populate new table
|
89
|
+
4. invoke active admin generator to add the new resource with a custom configuration to work with cancan
|
90
|
+
|
91
|
+
|
92
|
+
4. Apply to db as always you do:
|
93
|
+
|
94
|
+
rake db:migrate
|
95
|
+
rake db:seed
|
96
|
+
|
97
|
+
That's all!
|
98
|
+
The new application is ready to be customized to suit your needs:
|
99
|
+
|
100
|
+
* start to develop user front end
|
101
|
+
* take advantage of active admin and its dsl to quickly setup administration section
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
You could also customize leonardo templates both views and controller.
|
106
|
+
To copy under your project folder run:
|
107
|
+
|
108
|
+
rails g leosca:install
|
109
|
+
|
110
|
+
Then go to
|
111
|
+
|
112
|
+
lib\generators\erb
|
113
|
+
|
114
|
+
to edit erb views like you would do with original scaffold.
|
115
|
+
Go to
|
116
|
+
|
117
|
+
lib\generators\rails
|
118
|
+
|
119
|
+
if you want to customize more.
|
120
|
+
|
121
|
+
|
122
|
+
For more information about usage:
|
123
|
+
|
124
|
+
rails g leolay --help
|
125
|
+
rails g leosca --help
|
126
|
+
|
127
|
+
|
128
|
+
### Example:
|
129
|
+
|
130
|
+
leolay:
|
131
|
+
|
132
|
+
rails generate leolay
|
133
|
+
rails generate leolay --skip-authentication --skip-authorization
|
134
|
+
|
135
|
+
leosca:
|
136
|
+
|
137
|
+
rails generate leosca product name:string
|
138
|
+
rails generate leosca product name:string --skip-seeds
|
139
|
+
rails generate leosca product name:string --seeds=60 => if you need more records
|
140
|
+
|
141
|
+
if you made a mistake and want to start from scratch just replace generate with destroy to remove all files and inserted code
|
142
|
+
|
143
|
+
Of course, these options are in addition to those provided by the original scaffold
|
144
|
+
|
145
|
+
|
146
|
+
### Available layout
|
147
|
+
|
148
|
+
Currently the only one available is provided by ActiveAdmin
|
149
|
+
* active [default]
|
150
|
+
|
151
|
+
|
152
|
+
## Tutorial
|
153
|
+
|
154
|
+
On my [Blog](http://marcomastrodonato.blogspot.it/) you can find some other info.
|
155
|
+
|
156
|
+
|
157
|
+
## Found a bug?
|
158
|
+
|
159
|
+
If you are having a problem please submit an issue at
|
160
|
+
* m.mastrodonato@gmail.com
|
161
|
+
* marcovlonghitano@gmail.com
|
162
|
+
|
163
|
+
## Rails 3.2.x
|
164
|
+
|
165
|
+
Use previous 0.1.0 version (tested with activeadmin 0.5.x)
|
166
|
+
|
167
|
+
## Rails 2 and Rails 3.0.x
|
168
|
+
|
169
|
+
This Generators does not work with versions earlier 3.1
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
data/active_template.rb
CHANGED
@@ -1,137 +1,141 @@
|
|
1
|
-
#########################################################
|
2
|
-
# 2012 Marco Mastrodonato(c)
|
3
|
-
# This is a Rails 3.1+ template to use with activeleonardo gem
|
4
|
-
# https://rubygems.org/gems/Activeleonardo
|
5
|
-
#
|
6
|
-
# USAGE: rails new yourappname -m active_template.rb
|
7
|
-
#
|
8
|
-
# -------------------------------------------------------
|
9
|
-
#
|
10
|
-
#########################################################
|
11
|
-
|
12
|
-
puts '*' * 40
|
13
|
-
puts "* Processing template..."
|
14
|
-
puts '*' * 40
|
15
|
-
|
16
|
-
use_git = yes?("Do you use git ?")
|
17
|
-
if use_git
|
18
|
-
git :init
|
19
|
-
file ".gitignore", <<-EOS.gsub(/^ /, '')
|
20
|
-
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
21
|
-
#
|
22
|
-
# If you find yourself ignoring temporary files generated by your text editor
|
23
|
-
# or operating system, you probably want to add a global ignore instead:
|
24
|
-
# git config --global core.excludesfile ~/.gitignore_global
|
25
|
-
|
26
|
-
# Ignore bundler config
|
27
|
-
/.bundle
|
28
|
-
# Ignore the default SQLite database.
|
29
|
-
/db/*.sqlite3
|
30
|
-
# Ignore all logfiles and tempfiles.
|
31
|
-
/log/*.log
|
32
|
-
/tmp
|
33
|
-
/nbproject
|
34
|
-
/.idea
|
35
|
-
lib/tasks/files/*
|
36
|
-
/*.cmd
|
37
|
-
/*.dat
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
gem "
|
43
|
-
gem "
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
gem "
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
gem '
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
generate
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
1
|
+
#########################################################
|
2
|
+
# 2012 Marco Mastrodonato(c)
|
3
|
+
# This is a Rails 3.1+ template to use with activeleonardo gem
|
4
|
+
# https://rubygems.org/gems/Activeleonardo
|
5
|
+
#
|
6
|
+
# USAGE: rails new yourappname -m active_template.rb
|
7
|
+
#
|
8
|
+
# -------------------------------------------------------
|
9
|
+
#
|
10
|
+
#########################################################
|
11
|
+
|
12
|
+
puts '*' * 40
|
13
|
+
puts "* Processing template..."
|
14
|
+
puts '*' * 40
|
15
|
+
|
16
|
+
use_git = yes?("Do you use git ?")
|
17
|
+
if use_git
|
18
|
+
git :init
|
19
|
+
file ".gitignore", <<-EOS.gsub(/^ /, '')
|
20
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
21
|
+
#
|
22
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
23
|
+
# or operating system, you probably want to add a global ignore instead:
|
24
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
25
|
+
|
26
|
+
# Ignore bundler config
|
27
|
+
/.bundle
|
28
|
+
# Ignore the default SQLite database.
|
29
|
+
/db/*.sqlite3
|
30
|
+
# Ignore all logfiles and tempfiles.
|
31
|
+
/log/*.log
|
32
|
+
/tmp
|
33
|
+
/nbproject
|
34
|
+
/.idea
|
35
|
+
lib/tasks/files/*
|
36
|
+
/*.cmd
|
37
|
+
/*.dat
|
38
|
+
/config/initializers/secret_token.rb
|
39
|
+
EOS
|
40
|
+
end
|
41
|
+
|
42
|
+
gem "activeadmin", git: 'http://192.30.252.131/gregbell/active_admin.git'
|
43
|
+
gem "active_leonardo", git: 'http://172.24.18.42/ErgoVita/Active_Leonardo.git', branch: 'stage'
|
44
|
+
gem "bourbon"
|
45
|
+
|
46
|
+
easy_develop = yes?("Do you want to make development easier?")
|
47
|
+
if easy_develop
|
48
|
+
gem "rack-mini-profiler"
|
49
|
+
gem "jquery-turbolinks"
|
50
|
+
gem "awesome_print"
|
51
|
+
end
|
52
|
+
|
53
|
+
#use_editor = yes?("Do you want a wysihtml editor?")
|
54
|
+
#if use_editor
|
55
|
+
# gem 'activeadmin-dragonfly', git: 'https://github.com/stefanoverna/activeadmin-dragonfly'
|
56
|
+
# gem 'activeadmin-wysihtml5', git: 'https://github.com/stefanoverna/activeadmin-wysihtml5'
|
57
|
+
#end
|
58
|
+
|
59
|
+
rspec = yes?("Add rspec as testing framework ?")
|
60
|
+
if rspec
|
61
|
+
gem 'rspec-rails', :group => [:test, :development]
|
62
|
+
gem 'capybara', :group => :test
|
63
|
+
gem 'launchy', :group => :test
|
64
|
+
gem 'database_cleaner', :group => :test
|
65
|
+
if /1.8.*/ === RUBY_VERSION
|
66
|
+
gem 'factory_girl', '2.6.4', :group => :test
|
67
|
+
gem 'factory_girl_rails', '1.7.0', :group => :test
|
68
|
+
else
|
69
|
+
gem 'factory_girl_rails', :group => :test
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
authentication = yes?("Authentication ?")
|
74
|
+
model_name = authorization = nil
|
75
|
+
if authentication
|
76
|
+
default_model_name = "User"
|
77
|
+
model_name = ask(" Insert model name: [#{default_model_name}]")
|
78
|
+
if model_name.empty? || model_name == 'y'
|
79
|
+
model_name = default_model_name
|
80
|
+
else
|
81
|
+
model_name = model_name.classify
|
82
|
+
stdout = <<-REMEM.gsub(/^ /, '')
|
83
|
+
*************************************************************************
|
84
|
+
Remember to add your auth class when you use active leonardo's generator.
|
85
|
+
For example:
|
86
|
+
rails g leosca Product name price:decimal --auth_class=#{model_name}
|
87
|
+
*************************************************************************
|
88
|
+
REMEM
|
89
|
+
p stdout
|
90
|
+
end
|
91
|
+
|
92
|
+
authorization = yes?("Authorization ?")
|
93
|
+
if authorization
|
94
|
+
gem "cancan"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
gem 'state_machine' if yes?("Do you have to handle states ?")
|
99
|
+
|
100
|
+
dashboard_root = yes?("Would you use dashboard as root ? (recommended)")
|
101
|
+
home = yes?("Ok. Would you create home controller as root ?") unless dashboard_root
|
102
|
+
|
103
|
+
if yes?("Bundle install ?")
|
104
|
+
dir = ask(" Insert folder name to install locally: [blank=default gems path]")
|
105
|
+
run "bundle install #{"--path=#{dir}" unless dir.empty? || dir=='y'}"
|
106
|
+
end
|
107
|
+
|
108
|
+
generate "rspec:install" if rspec
|
109
|
+
|
110
|
+
generate "active_admin:install #{authentication ? model_name : "--skip-users"}"
|
111
|
+
|
112
|
+
if authorization
|
113
|
+
generate "cancan:ability"
|
114
|
+
generate "migration", "AddRolesMaskTo#{model_name}", "roles_mask:integer"
|
115
|
+
end
|
116
|
+
|
117
|
+
generate "leolay",
|
118
|
+
"active", #specify theme
|
119
|
+
"--auth_class=#{model_name}",
|
120
|
+
(rspec ? nil : "--skip-rspec"),
|
121
|
+
(authorization ? nil : "--skip-authorization"),
|
122
|
+
(authentication ? nil : "--skip-authentication")
|
123
|
+
|
124
|
+
|
125
|
+
if dashboard_root
|
126
|
+
route "root :to => 'admin/dashboard#index'"
|
127
|
+
elsif home
|
128
|
+
generate "controller", "home", "index"
|
129
|
+
route "root :to => 'home#index'"
|
130
|
+
end
|
131
|
+
|
132
|
+
rake "db:create:all"
|
133
|
+
rake "db:migrate"
|
134
|
+
rake "db:seed"
|
135
|
+
|
136
|
+
#rake "gems:unpack" if yes?("Unpack to vendor/gems ?")
|
137
|
+
if use_git
|
138
|
+
git :commit => %Q{ -a -m 'Initial commit' }
|
139
|
+
end
|
140
|
+
|
141
|
+
puts "ENJOY!"
|