active_leonardo 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -43
  3. data/LICENSE +19 -19
  4. data/README.md +173 -173
  5. data/active_template.rb +157 -141
  6. data/lib/generators/active_leonardo.rb +383 -383
  7. data/lib/generators/erb/leosca/leosca_generator.rb +122 -122
  8. data/lib/generators/leolay/USAGE +21 -21
  9. data/lib/generators/leolay/leolay_generator.rb +420 -420
  10. data/lib/generators/leolay/templates/app/admin/users.rb +87 -87
  11. data/lib/generators/leolay/templates/spec/helpers/application_helpers.rb +13 -13
  12. data/lib/generators/leolay/templates/spec/support/devise.rb +4 -4
  13. data/lib/generators/leolay/templates/styles/active/stylesheets/app/custom_active_admin.css.scss +27 -27
  14. data/lib/generators/leosca/USAGE +23 -23
  15. data/lib/generators/rails/leosca/USAGE +39 -39
  16. data/lib/generators/rails/leosca/leosca_generator.rb +55 -55
  17. data/lib/generators/rails/leosca/templates/leosca.css +56 -56
  18. data/lib/generators/rails/leosca_controller/USAGE +23 -23
  19. data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +192 -192
  20. data/lib/generators/rails/leosca_controller/templates/controller.rb +3 -3
  21. data/lib/generators/rspec/leointegration/leointegration_generator.rb +35 -35
  22. data/lib/generators/rspec/leointegration/templates/admin/feature.rb +67 -67
  23. data/lib/generators/rspec/leointegration/templates/feature.rb +9 -9
  24. data/lib/generators/rspec/leosca/leosca_generator.rb +57 -57
  25. data/lib/generators/rspec/leosca/templates/admin/controller_spec.rb +181 -181
  26. data/lib/generators/rspec/leosca/templates/admin/edit_spec.rb +31 -31
  27. data/lib/generators/rspec/leosca/templates/admin/index_spec.rb +32 -32
  28. data/lib/generators/rspec/leosca/templates/admin/new_spec.rb +30 -30
  29. data/lib/generators/rspec/leosca/templates/admin/routing_spec.rb +39 -39
  30. data/lib/generators/rspec/leosca/templates/admin/show_spec.rb +28 -28
  31. data/lib/generators/rspec/leosca/templates/controller_spec.rb +168 -168
  32. data/lib/generators/rspec/leosca/templates/edit_spec.rb +31 -31
  33. data/lib/generators/rspec/leosca/templates/index_spec.rb +32 -32
  34. data/lib/generators/rspec/leosca/templates/new_spec.rb +30 -30
  35. data/lib/generators/rspec/leosca/templates/routing_spec.rb +39 -39
  36. data/lib/generators/rspec/leosca/templates/show_spec.rb +28 -28
  37. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc9c60c86ec59ff1bba930f142081ea5bc0a18e3
4
- data.tar.gz: a8704fb1c0833a346c38a57e68c1d98c71b9dcf7
3
+ metadata.gz: 9861c478ee36e9f28ce46cf11bde71aaedeeaf63
4
+ data.tar.gz: 8eb59d3270843f41efe6c2e0f0bb5c2994a5750c
5
5
  SHA512:
6
- metadata.gz: ab9a173052283360b7452eeb786095e17a5894ee59185c8dbb603d83e9abee8103715004e97285e540580e6b1a186597ba1338bef3b2dbde80200209cfd1a090
7
- data.tar.gz: 19e2b1063805b8c1e1fcbb7ce9c0cc3937163e81c426151696f700e7ebbd615d2699cac0d7acd5e3f9f103b31fbd5401ee16e3e3b15f753b2cd021dfff15b568
6
+ metadata.gz: c1e22f6f013f32ab6418464aa8cb38aed8eec7be42621c5af2b9571a9f45e78bac29d6924d7d508f23d82a5655af88c07e7000edb80f205863953afcda8022a5
7
+ data.tar.gz: 0083395607802cb80e405663fd454af8e20900953abaee7d18f6c2c409958419d7d02020b2cf659d5e46af183ac8c6c8eede8835d6d3137da248c2ef04c961e4
data/CHANGELOG.md CHANGED
@@ -1,44 +1,49 @@
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
- ------------------------------
1
+ 0.2.1 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.2.0...v0.2.1) March 11th, 2014
2
+ ------------------------------
3
+ * Turbolinks now working with ActiveAdmin
4
+ * Git initial commit fixed (now double quoted comment)
5
+
6
+ 0.2.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.1.0...v0.2.0) March 6th, 2014
7
+ ------------------------------
8
+ * Tested with Rails 4.0, Ruby 2.0 and ActiveAdmin 1.0.0pre
9
+ * Now "references" data types into seeds.rb have more consistent data
10
+ * Improved i18n integration
11
+ * Restored original TestUnit
12
+ * Improved cancan integration
13
+
14
+ 0.1.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.7...v0.1.0) February 18th, 2013
15
+ ------------------------------
16
+ * Added alias batch_action to ability so who can update can also use batch action. Still You will need to authorize every action.
17
+
18
+ 0.0.7 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.6...v0.0.7) January 16th, 2013
19
+ ------------------------------
20
+ * Added devise locale yaml
21
+ * Added roles? method to authentication model (user)
22
+ * Fixed custom active admin sass
23
+
24
+ 0.0.6 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.5...v0.0.6) January 14th, 2012
25
+ ------------------------------
26
+ * Configuration parameters moved into a yaml file (config.yml)
27
+ * Template updated
28
+
29
+ 0.0.5 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.4...v0.0.5) September 26th, 2012
30
+ ------------------------------
31
+ * Added support to activeadmin 0.0.5
32
+ * Added cancan's unauthorized message to localization
33
+
34
+ 0.0.4 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.3...v0.0.4) August 13th, 2012
35
+ ------------------------------
36
+ * Now you can use any name instead of *User*
37
+
38
+ 0.0.3 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.2...v0.0.3) August 10th, 2012
39
+ ------------------------------
40
+ * Improved cancan integration
41
+ * Localization yaml file cleaned from some previous leonardo stuff
42
+
43
+ 0.0.2 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.0.1...v0.0.2) May 23th, 2012
44
+ ------------------------------
45
+ * Minor changement
46
+
47
+ 0.0.1 May 23th, 2012
48
+ ------------------------------
44
49
  * 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 CHANGED
@@ -1,173 +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
-
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
+