active_leonardo 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +44 -0
  3. data/LICENSE +19 -19
  4. data/README.md +173 -0
  5. data/active_template.rb +141 -137
  6. data/lib/generators/active_leonardo.rb +7 -1
  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 -400
  10. data/lib/generators/leolay/templates/app/admin/users.rb +87 -87
  11. data/lib/generators/leolay/templates/config/locales/it.yml +7 -0
  12. data/lib/generators/leolay/templates/spec/helpers/application_helpers.rb +13 -13
  13. data/lib/generators/leolay/templates/spec/support/devise.rb +4 -4
  14. data/lib/generators/leolay/templates/styles/active/stylesheets/app/custom_active_admin.css.scss +27 -27
  15. data/lib/generators/leosca/USAGE +23 -23
  16. data/lib/generators/rails/leosca/USAGE +39 -39
  17. data/lib/generators/rails/leosca/leosca_generator.rb +55 -55
  18. data/lib/generators/rails/leosca/templates/leosca.css +56 -56
  19. data/lib/generators/rails/leosca_controller/USAGE +23 -23
  20. data/lib/generators/rails/leosca_controller/leosca_controller_generator.rb +192 -188
  21. data/lib/generators/rails/leosca_controller/templates/controller.rb +3 -3
  22. data/lib/generators/rspec/leointegration/leointegration_generator.rb +35 -35
  23. data/lib/generators/rspec/leointegration/templates/admin/feature.rb +67 -67
  24. data/lib/generators/rspec/leointegration/templates/feature.rb +9 -9
  25. data/lib/generators/rspec/leosca/leosca_generator.rb +57 -57
  26. data/lib/generators/rspec/leosca/templates/admin/controller_spec.rb +181 -181
  27. data/lib/generators/rspec/leosca/templates/admin/edit_spec.rb +31 -31
  28. data/lib/generators/rspec/leosca/templates/admin/index_spec.rb +32 -32
  29. data/lib/generators/rspec/leosca/templates/admin/new_spec.rb +30 -30
  30. data/lib/generators/rspec/leosca/templates/admin/routing_spec.rb +39 -39
  31. data/lib/generators/rspec/leosca/templates/admin/show_spec.rb +28 -28
  32. data/lib/generators/rspec/leosca/templates/controller_spec.rb +168 -168
  33. data/lib/generators/rspec/leosca/templates/edit_spec.rb +31 -31
  34. data/lib/generators/rspec/leosca/templates/index_spec.rb +32 -32
  35. data/lib/generators/rspec/leosca/templates/new_spec.rb +30 -30
  36. data/lib/generators/rspec/leosca/templates/routing_spec.rb +39 -39
  37. data/lib/generators/rspec/leosca/templates/show_spec.rb +28 -28
  38. metadata +55 -124
  39. data/CHANGELOG +0 -28
  40. data/README.rdoc +0 -159
data/CHANGELOG DELETED
@@ -1,28 +0,0 @@
1
- 0.1.0 (February 18th, 2013) Marco Mastrodonato
2
- * Added alias batch_action to ability so who can update can also use batch action. Still You will need to authorize every action.
3
-
4
- 0.0.7 (January 16th, 2013) Marco Mastrodonato
5
- * Added devise locale yaml
6
- * Added roles? method to authentication model (user)
7
- * Fixed custom active admin sass
8
-
9
- 0.0.6 (September 26th, 2012) Marco Mastrodonato
10
- * Configuration parameters moved into a yaml file (config.yml)
11
- * Template updated
12
-
13
- 0.0.5 (September 26th, 2012) Marco Mastrodonato
14
- * Added support to activeadmin 0.0.5
15
- * Added cancan's unauthorized message to localization
16
-
17
- 0.0.4 (August 13th, 2012) Marco Mastrodonato
18
- * Now you can use any name instead of *User*
19
-
20
- 0.0.3 (August 10th, 2012) Marco Mastrodonato
21
- * Improved cancan integration
22
- * Localization yaml file cleaned from some previous leonardo stuff
23
-
24
- 0.0.2 (May 23th, 2012) Marco Mastrodonato
25
- * Minor changement
26
-
27
- 0.0.1 (May 23th, 2012) Marco Mastrodonato
28
- * First release
@@ -1,159 +0,0 @@
1
- = Leolay Generators
2
-
3
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/marcomd/Active_Leonardo)
4
-
5
- A layout and customized scaffold generator for Rails 3 to combine with active admin gem
6
- It generates the layout, the style, the internationalization and it helps you to startup active_admin gems
7
-
8
-
9
- == Install
10
-
11
- gem install active_leonardo
12
-
13
- or
14
-
15
- rails new ActiveLeo -m http://dl.dropbox.com/u/52600966/active_template.rb
16
-
17
-
18
- == Usage
19
-
20
- Once you install the gem, the generators will be available to all Rails applications on your system.
21
-
22
- To run the generator, go to your rails project directory and call it using rails generate or destroy command:
23
- rails generate leolay or rails destroy leolay
24
- rails generate leosca or rails destroy leosca
25
-
26
- PS: leosca destroy do not remove variables parts like time values inserted into feed
27
-
28
- PPS: You can run it more times and right like scaffold, it's smart and won't generate tons of identical code (thanks thor)
29
-
30
- === Step by step
31
-
32
- 1. Firstly, create layout and initialize your project:
33
- rails new ActiveLeo -m http://dl.dropbox.com/u/52600966/active_template.rb
34
- (You can also find a template into gem root folder)
35
-
36
- Answer y to all gems you need.
37
- After the questions will start generations.
38
- There will be a conflict on locales/en.yml which you must force if it is the first generation.
39
-
40
- Will be:
41
- * Created a default layout like active admin
42
- * Created i18n files
43
- * Created user management on active admin
44
- * Customized application.rb to exclude javascript and stylesheet for every resource you will create
45
-
46
-
47
-
48
- 2. You will get an application ready to work:
49
- run rails s and try it on http://localhost:3000
50
-
51
- if you get this message:
52
- _undefined local variable or method `new_user_registration_path'_
53
- **be sure user model have :registerable devise's module** otherwise add it or you have to remove registerable code from app\views\application\_session.html.erb
54
- you also may have to restart server: Ctrl+C and rails s once again
55
-
56
- now go into admin section:
57
- run rails s and try it on http://localhost:3000/admin
58
-
59
- You can login as three different profiles loaded with a previous db:seed:
60
-
61
- email: admin@activeleo.com, password: abcd1234
62
- [this profile can do everything]
63
- or
64
- email: manager@activeleo.com, password: abcd1234
65
- [can read, create and update]
66
- or
67
- email: user@activeleo.com, password: abcd1234
68
- [can read, create, update and destroy]
69
-
70
-
71
-
72
- 3. Create your resource:
73
- rails g leosca product name:string description:text active:boolean items:integer price:decimal
74
-
75
- This will act as a normal scaffold and has more new features:
76
- * will be invoked new leosca_controller which is a customized scaffold_controller
77
- * attributes will be insert into i18n files for a quick translation
78
- * seeds will be created for you to populate new table
79
- * invoke active admin generator to add the new resource with a custom configuration to work with cancan
80
-
81
-
82
-
83
- 4. Apply to db as always you do:
84
- rake db:migrate
85
- rake db:seed
86
-
87
-
88
-
89
- That's all!
90
- The new application is ready to be customized to suit your needs:
91
- * start to develop user front end
92
- * take advantage of active admin and its dsl to quickly setup administration section
93
-
94
- If you get this message:
95
- __Can't mass-assign protected attributes: foo_id, bar_id__
96
- just add it to attr_accessible inside your model
97
-
98
-
99
-
100
- **If you login with admin profile you can also manage users**, you only have to add :roles to attr_accessible inside user's model
101
-
102
-
103
-
104
- You could also customize leonardo templates: both views and controller.
105
- To copy under your project folder run:
106
- rails g leosca:install
107
-
108
- Then go to lib\generators\erb to edit erb views like you would do with original scaffold.
109
- Go to lib\generators\rails if you want to customize more.
110
-
111
-
112
- For more information about usage:
113
-
114
- rails g leolay --help
115
-
116
- rails g leosca --help
117
-
118
-
119
- === Example:
120
-
121
- leolay:
122
-
123
- rails generate leolay
124
- rails generate leolay --skip-authentication --skip-authorization
125
-
126
- leosca:
127
-
128
- rails generate leosca product name:string
129
- rails generate leosca product name:string --skip-seeds
130
- rails generate leosca product name:string --seeds=60 => if you need more records
131
-
132
- if you made a mistake and want to start from scratch just replace generate with destroy to remove all files and inserted code
133
-
134
- PS: Of course, these options are in addition to those provided by the original scaffold
135
-
136
-
137
- === Available layout
138
-
139
- * active [default]
140
-
141
-
142
- == Tutorial
143
-
144
- On my [Blog]: http://marcomastrodonato.blogspot.it/ (Click to visit my blog) you can find some other info.
145
-
146
-
147
-
148
- == Found a bug?
149
-
150
- If you are having a problem please submit an issue at m.mastrodonato@gmail.com
151
-
152
-
153
- == Rails 2 and Rails 3.0.x
154
-
155
- This Generators does not work with versions earlier 3.1
156
-
157
-
158
-
159
-