padrino-gen 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/README.rdoc +2 -2
  2. data/Rakefile +4 -53
  3. data/bin/padrino-gen +2 -4
  4. data/lib/padrino-gen/command.rb +12 -0
  5. data/lib/padrino-gen/generators/actions.rb +25 -5
  6. data/lib/padrino-gen/generators/app/app.rb.tt +17 -19
  7. data/lib/padrino-gen/generators/app.rb +7 -6
  8. data/lib/padrino-gen/generators/cli.rb +3 -2
  9. data/lib/padrino-gen/generators/components/actions.rb +4 -4
  10. data/lib/padrino-gen/generators/components/mocks/rr.rb +1 -1
  11. data/lib/padrino-gen/generators/components/orms/activerecord.rb +58 -16
  12. data/lib/padrino-gen/generators/components/orms/couchrest.rb +6 -5
  13. data/lib/padrino-gen/generators/components/orms/datamapper.rb +41 -17
  14. data/lib/padrino-gen/generators/components/orms/mongoid.rb +7 -6
  15. data/lib/padrino-gen/generators/components/orms/mongomapper.rb +6 -5
  16. data/lib/padrino-gen/generators/components/orms/sequel.rb +34 -15
  17. data/lib/padrino-gen/generators/components/scripts/dojo.rb +4 -0
  18. data/lib/padrino-gen/generators/components/stylesheets/compass/application.scss +43 -0
  19. data/lib/padrino-gen/generators/components/stylesheets/compass/partials/_base.scss +10 -0
  20. data/lib/padrino-gen/generators/components/stylesheets/compass.rb +39 -0
  21. data/lib/padrino-gen/generators/components/stylesheets/less.rb +2 -2
  22. data/lib/padrino-gen/generators/components/stylesheets/sass.rb +2 -2
  23. data/lib/padrino-gen/generators/components/tests/bacon.rb +2 -1
  24. data/lib/padrino-gen/generators/components/tests/cucumber.rb +26 -4
  25. data/lib/padrino-gen/generators/components/tests/riot.rb +45 -9
  26. data/lib/padrino-gen/generators/components/tests/rspec.rb +2 -1
  27. data/lib/padrino-gen/generators/components/tests/shoulda.rb +2 -1
  28. data/lib/padrino-gen/generators/components/tests/testspec.rb +2 -1
  29. data/lib/padrino-gen/generators/controller.rb +2 -2
  30. data/lib/padrino-gen/generators/mailer.rb +6 -8
  31. data/lib/padrino-gen/generators/model.rb +9 -1
  32. data/lib/padrino-gen/generators/project/config/apps.rb.tt +24 -26
  33. data/lib/padrino-gen/generators/project/config/boot.rb +2 -2
  34. data/lib/padrino-gen/generators/project.rb +23 -16
  35. data/lib/padrino-gen/generators/templates/Gemfile.tt +1 -1
  36. data/lib/padrino-gen/generators/templates/controller.rb.tt +2 -2
  37. data/lib/padrino-gen/generators/templates/mailer.rb.tt +36 -17
  38. data/lib/padrino-gen/generators/templates/scripts/dojo.js +16 -0
  39. data/lib/padrino-gen/generators/templates/scripts/mootools-core.js +120 -1
  40. data/lib/padrino-gen/generators/templates/scripts/right.js +1 -12
  41. data/lib/padrino-gen/padrino-tasks/activerecord.rb +40 -34
  42. data/lib/padrino-gen/padrino-tasks/datamapper.rb +39 -24
  43. data/lib/padrino-gen/padrino-tasks/mongomapper.rb +1 -1
  44. data/lib/padrino-gen.rb +2 -1
  45. data/padrino-gen.gemspec +17 -132
  46. data/test/helper.rb +3 -11
  47. data/test/test_app_generator.rb +19 -7
  48. data/test/test_controller_generator.rb +11 -1
  49. data/test/test_mailer_generator.rb +18 -15
  50. data/test/test_migration_generator.rb +4 -4
  51. data/test/test_model_generator.rb +30 -9
  52. data/test/test_project_generator.rb +163 -33
  53. metadata +70 -48
  54. data/lib/padrino-gen/generators/app/controllers/.empty_directory +0 -0
  55. data/lib/padrino-gen/generators/app/helpers/.empty_directory +0 -0
  56. data/lib/padrino-gen/generators/app/views/.empty_directory +0 -0
  57. data/lib/padrino-gen/generators/app/views/layouts/.emptydirectory +0 -0
  58. data/lib/padrino-gen/generators/project/.gitignore +0 -7
  59. data/lib/padrino-gen/generators/project/public/images/.empty_directory +0 -0
  60. data/lib/padrino-gen/generators/project/public/javascripts/.empty_directory +0 -0
  61. data/lib/padrino-gen/generators/project/public/stylesheets/.empty_directory +0 -0
  62. data/lib/padrino-gen/generators/project/tmp/.empty_directory +0 -0
  63. data/lib/padrino-gen/generators/templates/mailer_initializer.rb.tt +0 -19
@@ -7,14 +7,36 @@ class TestProjectGenerator < Test::Unit::TestCase
7
7
 
8
8
  context 'the project generator' do
9
9
  should "allow simple generator to run and create base_app with no options" do
10
- assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=none') } }
10
+ assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp') } }
11
11
  assert_file_exists('/tmp/sample_project')
12
- assert_file_exists('/tmp/sample_project/app')
12
+ assert_match_in_file(/class SampleProject < Padrino::Application/,'/tmp/sample_project/app/app.rb')
13
+ assert_match_in_file(/Padrino.mount_core\("SampleProject"\)/,'/tmp/sample_project/config/apps.rb')
14
+ assert_file_exists('/tmp/sample_project/config/boot.rb')
15
+ assert_file_exists('/tmp/sample_project/public/favicon.ico')
16
+ end
17
+
18
+ should "allow specifying alternate application name" do
19
+ assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--app=base_app') } }
20
+ assert_file_exists('/tmp/sample_project')
21
+ assert_match_in_file(/class BaseApp < Padrino::Application/,'/tmp/sample_project/app/app.rb')
22
+ assert_match_in_file(/Padrino.mount_core\("BaseApp"\)/,'/tmp/sample_project/config/apps.rb')
13
23
  assert_file_exists('/tmp/sample_project/config/boot.rb')
14
- assert_file_exists('/tmp/sample_project/spec/spec_helper.rb')
15
24
  assert_file_exists('/tmp/sample_project/public/favicon.ico')
16
25
  end
17
26
 
27
+ should "generate tiny skeleton" do
28
+ assert_nothing_raised { silence_logger { generate(:project,'sample_project', '--tiny','--root=/tmp') } }
29
+ assert_file_exists('/tmp/sample_project')
30
+ assert_file_exists('/tmp/sample_project/app')
31
+ assert_file_exists('/tmp/sample_project/app/controllers.rb')
32
+ assert_file_exists('/tmp/sample_project/app/helpers.rb')
33
+ assert_file_exists('/tmp/sample_project/app/mailers.rb')
34
+ assert_dir_exists('/tmp/sample_project/app/views/mailers')
35
+ assert_match_in_file(/:notifier/,'/tmp/sample_project/app/mailers.rb')
36
+ assert_no_file_exists('/tmp/sample_project/demo/helpers')
37
+ assert_no_file_exists('/tmp/sample_project/demo/controllers')
38
+ end
39
+
18
40
  should "not create models folder if no orm is chosen" do
19
41
  silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=none', '--orm=none') }
20
42
  assert_no_dir_exists('/tmp/sample_project/app/models')
@@ -35,7 +57,7 @@ class TestProjectGenerator < Test::Unit::TestCase
35
57
  silence_logger { generate(:project, 'sample_project', '--root=/tmp') }
36
58
  components_chosen = YAML.load_file('/tmp/sample_project/.components')
37
59
  assert_equal 'none', components_chosen[:orm]
38
- assert_equal 'rspec', components_chosen[:test]
60
+ assert_equal 'none', components_chosen[:test]
39
61
  assert_equal 'none', components_chosen[:mock]
40
62
  assert_equal 'none', components_chosen[:script]
41
63
  assert_equal 'haml', components_chosen[:renderer]
@@ -68,7 +90,7 @@ class TestProjectGenerator < Test::Unit::TestCase
68
90
  silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=none') }
69
91
  assert_match_in_file(/gem 'padrino'/, '/tmp/sample_project/Gemfile')
70
92
  assert_match_in_file(/gem 'rack-flash'/, '/tmp/sample_project/Gemfile')
71
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
93
+ assert_match_in_file(/gem 'thin'/, '/tmp/sample_project/Gemfile')
72
94
  end
73
95
  end
74
96
 
@@ -77,6 +99,7 @@ class TestProjectGenerator < Test::Unit::TestCase
77
99
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--mock=rr', '--test=riot', '--script=none') }
78
100
  assert_match /Applying.*?rr.*?mock/, buffer
79
101
  assert_match_in_file(/gem 'rr'/, '/tmp/sample_project/Gemfile')
102
+ assert_match_in_file(/require 'riot\/rr'/, '/tmp/sample_project/test/test_config.rb')
80
103
  end
81
104
 
82
105
  should "properly generater for rr and bacon" do
@@ -87,14 +110,14 @@ class TestProjectGenerator < Test::Unit::TestCase
87
110
  end
88
111
 
89
112
  should "properly generate for mocha and rspec" do
90
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--mock=mocha', '--script=none') }
113
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp','--test=rspec', '--mock=mocha', '--script=none') }
91
114
  assert_match /Applying.*?mocha.*?mock/, buffer
92
115
  assert_match_in_file(/gem 'mocha'/, '/tmp/sample_project/Gemfile')
93
116
  assert_match_in_file(/conf.mock_with :mocha/m, '/tmp/sample_project/spec/spec_helper.rb')
94
117
  end
95
118
 
96
119
  should "properly generate for rr and rspec" do
97
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--mock=rr', '--script=none') }
120
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=rspec', '--mock=rr', '--script=none') }
98
121
  assert_match /Applying.*?rr.*?mock/, buffer
99
122
  assert_match_in_file(/gem 'rr'/, '/tmp/sample_project/Gemfile')
100
123
  assert_match_in_file(/conf.mock_with :rr/m, '/tmp/sample_project/spec/spec_helper.rb')
@@ -103,33 +126,104 @@ class TestProjectGenerator < Test::Unit::TestCase
103
126
  end
104
127
 
105
128
  context "the generator for orm components" do
106
- should "properly generate for sequel" do
107
- @app.instance_eval("undef setup_orm if respond_to?('setup_orm')")
108
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--script=none') }
109
- assert_match /Applying.*?sequel.*?orm/, buffer
110
- assert_match_in_file(/gem 'sequel'/, '/tmp/sample_project/Gemfile')
111
- assert_match_in_file(/gem 'sqlite3-ruby'/, '/tmp/sample_project/Gemfile')
112
- assert_match_in_file(/Sequel.connect/, '/tmp/sample_project/config/database.rb')
113
- assert_match_in_file(%r{sqlite://}, '/tmp/sample_project/config/database.rb')
114
- assert_dir_exists('/tmp/sample_project/app/models')
115
- end
116
-
117
- should "properly generate for activerecord" do
118
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord', '--script=none') }
119
- assert_match /Applying.*?activerecord.*?orm/, buffer
120
- assert_match_in_file(/gem 'activerecord', :require => "active_record"/, '/tmp/sample_project/Gemfile')
121
- assert_match_in_file(/ActiveRecord::Base.establish_connection/, '/tmp/sample_project/config/database.rb')
122
- assert_dir_exists('/tmp/sample_project/app/models')
129
+
130
+ context "for sequel" do
131
+ should "properly generate default" do
132
+ @app.instance_eval("undef setup_orm if respond_to?('setup_orm')")
133
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--script=none') }
134
+ assert_match /Applying.*?sequel.*?orm/, buffer
135
+ assert_match_in_file(/gem 'sequel'/, '/tmp/sample_project/Gemfile')
136
+ assert_match_in_file(/gem 'sqlite3-ruby'/, '/tmp/sample_project/Gemfile')
137
+ assert_match_in_file(/Sequel.connect/, '/tmp/sample_project/config/database.rb')
138
+ assert_match_in_file(%r{sqlite://}, '/tmp/sample_project/config/database.rb')
139
+ assert_dir_exists('/tmp/sample_project/app/models')
140
+ end
141
+
142
+ should "properly generate mysql" do
143
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--adapter=mysql') }
144
+ assert_match_in_file(/gem 'mysql'/, '/tmp/sample_project/Gemfile')
145
+ assert_match_in_file(%r{"mysql://}, '/tmp/sample_project/config/database.rb')
146
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
147
+ end
148
+
149
+ should "properly generate sqlite3" do
150
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--adapter=sqlite') }
151
+ assert_match_in_file(/gem 'sqlite3-ruby'/, '/tmp/sample_project/Gemfile')
152
+ assert_match_in_file(%r{sqlite://}, '/tmp/sample_project/config/database.rb')
153
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
154
+ end
155
+
156
+ should "properly generate postgres" do
157
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--adapter=postgres') }
158
+ assert_match_in_file(/gem 'pg'/, '/tmp/sample_project/Gemfile')
159
+ assert_match_in_file(%r{"postgres://}, '/tmp/sample_project/config/database.rb')
160
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
161
+ end
162
+ end
163
+
164
+ context "for activerecord" do
165
+ should "properly generate default" do
166
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord', '--script=none') }
167
+ assert_match /Applying.*?activerecord.*?orm/, buffer
168
+ assert_match_in_file(/gem 'activerecord', :require => "active_record"/, '/tmp/sample_project/Gemfile')
169
+ assert_match_in_file(/gem 'sqlite3-ruby', :require => "sqlite3"/, '/tmp/sample_project/Gemfile')
170
+ assert_match_in_file(/ActiveRecord::Base.establish_connection/, '/tmp/sample_project/config/database.rb')
171
+ assert_dir_exists('/tmp/sample_project/app/models')
172
+ end
173
+
174
+ should "properly generate mysql" do
175
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord','--adapter=mysql') }
176
+ assert_match_in_file(/gem 'mysql'/, '/tmp/sample_project/Gemfile')
177
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
178
+ assert_match_in_file(%r{:adapter => 'mysql'}, '/tmp/sample_project/config/database.rb')
179
+ end
180
+
181
+ should "properly generate sqlite3" do
182
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord', '--adapter=sqlite3') }
183
+ assert_match_in_file(/gem 'sqlite3-ruby', :require => "sqlite3"/, '/tmp/sample_project/Gemfile')
184
+ assert_match_in_file(/sample_project_development.db/, '/tmp/sample_project/config/database.rb')
185
+ assert_match_in_file(%r{:adapter => 'sqlite3'}, '/tmp/sample_project/config/database.rb')
186
+ end
187
+
188
+ should "properly generate postgres" do
189
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord', '--adapter=postgres') }
190
+ assert_match_in_file(/gem 'pg', :require => "postgres"/, '/tmp/sample_project/Gemfile')
191
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
192
+ assert_match_in_file(%r{:adapter => 'postgresql'}, '/tmp/sample_project/config/database.rb')
193
+ end
194
+ end
195
+
196
+ context "for datamapper" do
197
+ should "properly generate default" do
198
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--script=none') }
199
+ assert_match /Applying.*?datamapper.*?orm/, buffer
200
+ assert_match_in_file(/gem 'data_mapper'/, '/tmp/sample_project/Gemfile')
201
+ assert_match_in_file(/gem 'dm-sqlite-adapter'/, '/tmp/sample_project/Gemfile')
202
+ assert_match_in_file(/DataMapper.setup/, '/tmp/sample_project/config/database.rb')
203
+ assert_dir_exists('/tmp/sample_project/app/models')
204
+ end
205
+
206
+ should "properly generate for mysql" do
207
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--adapter=mysql') }
208
+ assert_match_in_file(/gem 'dm-mysql-adapter'/, '/tmp/sample_project/Gemfile')
209
+ assert_match_in_file(%r{"mysql://}, '/tmp/sample_project/config/database.rb')
210
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
211
+ end
212
+
213
+ should "properly generate for sqlite" do
214
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--adapter=sqlite') }
215
+ assert_match_in_file(/gem 'dm-sqlite-adapter'/, '/tmp/sample_project/Gemfile')
216
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
217
+ end
218
+
219
+ should "properly generate for postgres" do
220
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--adapter=postgres') }
221
+ assert_match_in_file(/gem 'dm-postgres-adapter'/, '/tmp/sample_project/Gemfile')
222
+ assert_match_in_file(%r{"postgres://}, '/tmp/sample_project/config/database.rb')
223
+ assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
224
+ end
123
225
  end
124
226
 
125
- should "properly generate default for datamapper" do
126
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--script=none') }
127
- assert_match /Applying.*?datamapper.*?orm/, buffer
128
- assert_match_in_file(/gem 'data_objects'/, '/tmp/sample_project/Gemfile')
129
- assert_match_in_file(/gem 'datamapper'/, '/tmp/sample_project/Gemfile')
130
- assert_match_in_file(/DataMapper.setup/, '/tmp/sample_project/config/database.rb')
131
- assert_dir_exists('/tmp/sample_project/app/models')
132
- end
133
227
 
134
228
  should "properly generate for mongomapper" do
135
229
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=mongomapper', '--script=none') }
@@ -139,6 +233,15 @@ class TestProjectGenerator < Test::Unit::TestCase
139
233
  assert_dir_exists('/tmp/sample_project/app/models')
140
234
  end
141
235
 
236
+ should "properly generate for mongoid" do
237
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=mongoid', '--script=none') }
238
+ assert_match /Applying.*?mongoid.*?orm/, buffer
239
+ assert_match_in_file(/gem 'mongoid'/, '/tmp/sample_project/Gemfile')
240
+ assert_match_in_file(/Mongoid.database/, '/tmp/sample_project/config/database.rb')
241
+ assert_dir_exists('/tmp/sample_project/app/models')
242
+ end
243
+
244
+
142
245
  should "properly generate for couchrest" do
143
246
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=couchrest', '--script=none') }
144
247
  assert_match /Applying.*?couchrest.*?orm/, buffer
@@ -197,12 +300,20 @@ class TestProjectGenerator < Test::Unit::TestCase
197
300
  assert_file_exists('/tmp/sample_project/public/javascripts/ext-core.js')
198
301
  assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
199
302
  end
303
+
304
+ should "properly generate for dojo" do
305
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=dojo') }
306
+ assert_match /Applying.*?dojo.*?script/, buffer
307
+ assert_file_exists('/tmp/sample_project/public/javascripts/dojo.js')
308
+ assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
309
+ end
200
310
  end
201
311
 
202
312
  context "the generator for test component" do
203
313
  should "properly default generate for bacon" do
204
314
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=bacon', '--script=none') }
205
315
  assert_match /Applying.*?bacon.*?test/, buffer
316
+ assert_match_in_file(/gem 'rack-test'.*?:require => "rack\/test".*?:group => "test"/, '/tmp/sample_project/Gemfile')
206
317
  assert_match_in_file(/gem 'bacon'/, '/tmp/sample_project/Gemfile')
207
318
  assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
208
319
  assert_match_in_file(/Bacon::Context/, '/tmp/sample_project/test/test_config.rb')
@@ -212,15 +323,19 @@ class TestProjectGenerator < Test::Unit::TestCase
212
323
  should "properly generate for riot" do
213
324
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=riot', '--script=none') }
214
325
  assert_match /Applying.*?riot.*?test/, buffer
326
+ assert_match_in_file(/gem 'rack-test'.*?:require => "rack\/test".*?:group => "test"/, '/tmp/sample_project/Gemfile')
215
327
  assert_match_in_file(/gem 'riot'/, '/tmp/sample_project/Gemfile')
328
+ assert_match_in_file(/include Rack::Test::Methods/, '/tmp/sample_project/test/test_config.rb')
216
329
  assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
217
330
  assert_match_in_file(/Riot::Situation/, '/tmp/sample_project/test/test_config.rb')
331
+ assert_match_in_file(/Riot::Context/, '/tmp/sample_project/test/test_config.rb')
218
332
  assert_file_exists('/tmp/sample_project/test/test.rake')
219
333
  end
220
334
 
221
335
  should "properly generate for rspec" do
222
336
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=rspec', '--script=none') }
223
337
  assert_match /Applying.*?rspec.*?test/, buffer
338
+ assert_match_in_file(/gem 'rack-test'.*?:require => "rack\/test".*?:group => "test"/, '/tmp/sample_project/Gemfile')
224
339
  assert_match_in_file(/gem 'rspec'.*?:require => "spec"/, '/tmp/sample_project/Gemfile')
225
340
  assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/spec/spec_helper.rb')
226
341
  assert_match_in_file(/Spec::Runner/, '/tmp/sample_project/spec/spec_helper.rb')
@@ -230,6 +345,7 @@ class TestProjectGenerator < Test::Unit::TestCase
230
345
  should "properly generate for shoulda" do
231
346
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=shoulda', '--script=none') }
232
347
  assert_match /Applying.*?shoulda.*?test/, buffer
348
+ assert_match_in_file(/gem 'rack-test'.*?:require => "rack\/test".*?:group => "test"/, '/tmp/sample_project/Gemfile')
233
349
  assert_match_in_file(/gem 'shoulda'/, '/tmp/sample_project/Gemfile')
234
350
  assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
235
351
  assert_match_in_file(/Test::Unit::TestCase/, '/tmp/sample_project/test/test_config.rb')
@@ -239,6 +355,7 @@ class TestProjectGenerator < Test::Unit::TestCase
239
355
  should "properly generate for testspec" do
240
356
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=testspec', '--script=none') }
241
357
  assert_match /Applying.*?testspec.*?test/, buffer
358
+ assert_match_in_file(/gem 'rack-test'.*?:require => "rack\/test".*?:group => "test"/, '/tmp/sample_project/Gemfile')
242
359
  assert_match_in_file(/gem 'test-spec'.*?:require => "test\/spec"/, '/tmp/sample_project/Gemfile')
243
360
  assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
244
361
  assert_match_in_file(/Test::Unit::TestCase/, '/tmp/sample_project/test/test_config.rb')
@@ -248,6 +365,7 @@ class TestProjectGenerator < Test::Unit::TestCase
248
365
  should "properly generate for cucumber" do
249
366
  buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=cucumber', '--script=none') }
250
367
  assert_match /Applying.*?cucumber.*?test/, buffer
368
+ assert_match_in_file(/gem 'rack-test'.*?:require => "rack\/test".*?:group => "test"/, '/tmp/sample_project/Gemfile')
251
369
  assert_match_in_file(/gem 'rspec'.*?:require => "spec"/, '/tmp/sample_project/Gemfile')
252
370
  assert_match_in_file(/gem 'cucumber'/, '/tmp/sample_project/Gemfile')
253
371
  assert_match_in_file(/gem 'capybara'/, '/tmp/sample_project/Gemfile')
@@ -255,6 +373,7 @@ class TestProjectGenerator < Test::Unit::TestCase
255
373
  assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/features/support/env.rb')
256
374
  assert_match_in_file(/Spec::Runner/, '/tmp/sample_project/spec/spec_helper.rb')
257
375
  assert_match_in_file(/Capybara.app = /, '/tmp/sample_project/features/support/env.rb')
376
+ assert_match_in_file(/World\(Cucumber::Web::URLs\)/, '/tmp/sample_project/features/support/url.rb')
258
377
  assert_file_exists('/tmp/sample_project/spec/spec.rake')
259
378
  assert_file_exists('/tmp/sample_project/features/support/env.rb')
260
379
  assert_file_exists('/tmp/sample_project/features/add.feature')
@@ -279,5 +398,16 @@ class TestProjectGenerator < Test::Unit::TestCase
279
398
  assert_match_in_file(/register LessInitializer/m, '/tmp/sample_project/app/app.rb')
280
399
  assert_dir_exists('/tmp/sample_project/app/stylesheets')
281
400
  end
401
+
402
+ should "properly generate for compass" do
403
+ buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=haml','--script=none','--stylesheet=compass') }
404
+ assert_match_in_file(/gem 'compass'/, '/tmp/sample_project/Gemfile')
405
+ assert_match_in_file(/Compass.configure_sass_plugin\!/, '/tmp/sample_project/lib/compass_plugin.rb')
406
+ assert_match_in_file(/module CompassInitializer.*Sass::Plugin::Rack/m, '/tmp/sample_project/lib/compass_plugin.rb')
407
+ assert_match_in_file(/register CompassInitializer/m, '/tmp/sample_project/app/app.rb')
408
+
409
+ assert_file_exists('/tmp/sample_project/app/stylesheets/application.scss')
410
+ assert_file_exists('/tmp/sample_project/app/stylesheets/partials/_base.scss')
411
+ end
282
412
  end
283
- end
413
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 10
9
- version: 0.9.10
8
+ - 11
9
+ version: 0.9.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Padrino Team
@@ -17,69 +17,73 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-04-22 00:00:00 +02:00
20
+ date: 2010-06-17 00:00:00 -07:00
21
21
  default_executable: padrino-gen
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: padrino-core
25
- prerelease: false
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
27
  requirements:
28
28
  - - "="
29
29
  - !ruby/object:Gem::Version
30
30
  segments:
31
31
  - 0
32
32
  - 9
33
- - 10
34
- version: 0.9.10
33
+ - 11
34
+ version: 0.9.11
35
35
  type: :runtime
36
+ prerelease: false
36
37
  version_requirements: *id001
37
38
  - !ruby/object:Gem::Dependency
38
- name: haml
39
- prerelease: false
39
+ name: bundler
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
41
42
  requirements:
42
43
  - - ">="
43
44
  - !ruby/object:Gem::Version
44
45
  segments:
45
- - 2
46
- - 2
47
- - 1
48
- version: 2.2.1
49
- type: :development
46
+ - 0
47
+ - 9
48
+ - 7
49
+ version: 0.9.7
50
+ type: :runtime
51
+ prerelease: false
50
52
  version_requirements: *id002
51
53
  - !ruby/object:Gem::Dependency
52
- name: shoulda
53
- prerelease: false
54
+ name: rake
54
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
55
57
  requirements:
56
58
  - - ">="
57
59
  - !ruby/object:Gem::Version
58
60
  segments:
59
- - 2
60
- - 10
61
- - 3
62
- version: 2.10.3
61
+ - 0
62
+ - 8
63
+ - 7
64
+ version: 0.8.7
63
65
  type: :development
66
+ prerelease: false
64
67
  version_requirements: *id003
65
68
  - !ruby/object:Gem::Dependency
66
69
  name: mocha
67
- prerelease: false
68
70
  requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
69
72
  requirements:
70
73
  - - ">="
71
74
  - !ruby/object:Gem::Version
72
75
  segments:
73
76
  - 0
74
77
  - 9
75
- - 7
76
- version: 0.9.7
78
+ - 8
79
+ version: 0.9.8
77
80
  type: :development
81
+ prerelease: false
78
82
  version_requirements: *id004
79
83
  - !ruby/object:Gem::Dependency
80
84
  name: rack-test
81
- prerelease: false
82
85
  requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
83
87
  requirements:
84
88
  - - ">="
85
89
  - !ruby/object:Gem::Version
@@ -89,11 +93,12 @@ dependencies:
89
93
  - 0
90
94
  version: 0.5.0
91
95
  type: :development
96
+ prerelease: false
92
97
  version_requirements: *id005
93
98
  - !ruby/object:Gem::Dependency
94
99
  name: webrat
95
- prerelease: false
96
100
  requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
97
102
  requirements:
98
103
  - - ">="
99
104
  - !ruby/object:Gem::Version
@@ -103,21 +108,38 @@ dependencies:
103
108
  - 1
104
109
  version: 0.5.1
105
110
  type: :development
111
+ prerelease: false
106
112
  version_requirements: *id006
107
113
  - !ruby/object:Gem::Dependency
108
- name: fakeweb
109
- prerelease: false
114
+ name: haml
110
115
  requirement: &id007 !ruby/object:Gem::Requirement
116
+ none: false
111
117
  requirements:
112
118
  - - ">="
113
119
  - !ruby/object:Gem::Version
114
120
  segments:
115
- - 1
116
121
  - 2
117
- - 3
118
- version: 1.2.3
122
+ - 2
123
+ - 22
124
+ version: 2.2.22
119
125
  type: :development
126
+ prerelease: false
120
127
  version_requirements: *id007
128
+ - !ruby/object:Gem::Dependency
129
+ name: shoulda
130
+ requirement: &id008 !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ segments:
136
+ - 2
137
+ - 10
138
+ - 3
139
+ version: 2.10.3
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: *id008
121
143
  description: Generators for easily creating and building padrino applications from the console
122
144
  email: padrinorb@gmail.com
123
145
  executables:
@@ -132,15 +154,12 @@ files:
132
154
  - LICENSE
133
155
  - README.rdoc
134
156
  - Rakefile
157
+ - padrino-gen.gemspec
135
158
  - bin/padrino-gen
136
- - lib/padrino-gen.rb
159
+ - lib/padrino-gen/command.rb
137
160
  - lib/padrino-gen/generators/actions.rb
138
- - lib/padrino-gen/generators/app.rb
139
161
  - lib/padrino-gen/generators/app/app.rb.tt
140
- - lib/padrino-gen/generators/app/controllers/.empty_directory
141
- - lib/padrino-gen/generators/app/helpers/.empty_directory
142
- - lib/padrino-gen/generators/app/views/.empty_directory
143
- - lib/padrino-gen/generators/app/views/layouts/.emptydirectory
162
+ - lib/padrino-gen/generators/app.rb
144
163
  - lib/padrino-gen/generators/cli.rb
145
164
  - lib/padrino-gen/generators/components/actions.rb
146
165
  - lib/padrino-gen/generators/components/mocks/mocha.rb
@@ -153,11 +172,15 @@ files:
153
172
  - lib/padrino-gen/generators/components/orms/sequel.rb
154
173
  - lib/padrino-gen/generators/components/renderers/erb.rb
155
174
  - lib/padrino-gen/generators/components/renderers/haml.rb
175
+ - lib/padrino-gen/generators/components/scripts/dojo.rb
156
176
  - lib/padrino-gen/generators/components/scripts/extcore.rb
157
177
  - lib/padrino-gen/generators/components/scripts/jquery.rb
158
178
  - lib/padrino-gen/generators/components/scripts/mootools.rb
159
179
  - lib/padrino-gen/generators/components/scripts/prototype.rb
160
180
  - lib/padrino-gen/generators/components/scripts/rightjs.rb
181
+ - lib/padrino-gen/generators/components/stylesheets/compass/application.scss
182
+ - lib/padrino-gen/generators/components/stylesheets/compass/partials/_base.scss
183
+ - lib/padrino-gen/generators/components/stylesheets/compass.rb
161
184
  - lib/padrino-gen/generators/components/stylesheets/less.rb
162
185
  - lib/padrino-gen/generators/components/stylesheets/sass.rb
163
186
  - lib/padrino-gen/generators/components/tests/bacon.rb
@@ -170,21 +193,16 @@ files:
170
193
  - lib/padrino-gen/generators/mailer.rb
171
194
  - lib/padrino-gen/generators/migration.rb
172
195
  - lib/padrino-gen/generators/model.rb
173
- - lib/padrino-gen/generators/project.rb
174
- - lib/padrino-gen/generators/project/.gitignore
175
- - lib/padrino-gen/generators/project/config.ru
176
196
  - lib/padrino-gen/generators/project/config/apps.rb.tt
177
197
  - lib/padrino-gen/generators/project/config/boot.rb
198
+ - lib/padrino-gen/generators/project/config.ru
178
199
  - lib/padrino-gen/generators/project/public/favicon.ico
179
- - lib/padrino-gen/generators/project/public/images/.empty_directory
180
- - lib/padrino-gen/generators/project/public/javascripts/.empty_directory
181
- - lib/padrino-gen/generators/project/public/stylesheets/.empty_directory
182
- - lib/padrino-gen/generators/project/tmp/.empty_directory
183
- - lib/padrino-gen/generators/templates/Gemfile.tt
200
+ - lib/padrino-gen/generators/project.rb
184
201
  - lib/padrino-gen/generators/templates/controller.rb.tt
202
+ - lib/padrino-gen/generators/templates/Gemfile.tt
185
203
  - lib/padrino-gen/generators/templates/helper.rb.tt
186
204
  - lib/padrino-gen/generators/templates/mailer.rb.tt
187
- - lib/padrino-gen/generators/templates/mailer_initializer.rb.tt
205
+ - lib/padrino-gen/generators/templates/scripts/dojo.js
188
206
  - lib/padrino-gen/generators/templates/scripts/ext-core.js
189
207
  - lib/padrino-gen/generators/templates/scripts/jquery.js
190
208
  - lib/padrino-gen/generators/templates/scripts/lowpro.js
@@ -196,7 +214,7 @@ files:
196
214
  - lib/padrino-gen/padrino-tasks/mongomapper.rb
197
215
  - lib/padrino-gen/padrino-tasks/seed.rb
198
216
  - lib/padrino-gen/padrino-tasks/sequel.rb
199
- - padrino-gen.gemspec
217
+ - lib/padrino-gen.rb
200
218
  - test/helper.rb
201
219
  - test/test_app_generator.rb
202
220
  - test/test_cli.rb
@@ -216,6 +234,7 @@ rdoc_options:
216
234
  require_paths:
217
235
  - lib
218
236
  required_ruby_version: !ruby/object:Gem::Requirement
237
+ none: false
219
238
  requirements:
220
239
  - - ">="
221
240
  - !ruby/object:Gem::Version
@@ -223,16 +242,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
242
  - 0
224
243
  version: "0"
225
244
  required_rubygems_version: !ruby/object:Gem::Requirement
245
+ none: false
226
246
  requirements:
227
247
  - - ">="
228
248
  - !ruby/object:Gem::Version
229
249
  segments:
230
- - 0
231
- version: "0"
250
+ - 1
251
+ - 3
252
+ - 6
253
+ version: 1.3.6
232
254
  requirements: []
233
255
 
234
256
  rubyforge_project: padrino-gen
235
- rubygems_version: 1.3.6
257
+ rubygems_version: 1.3.7
236
258
  signing_key:
237
259
  specification_version: 3
238
260
  summary: Generators for easily creating and building padrino applications
@@ -1,7 +0,0 @@
1
- .DS_Store
2
- log/**/*
3
- tmp/**/*
4
- bin/*
5
- vendor/gems/*
6
- !vendor/gems/cache/
7
- .sass-cache/*
@@ -1,19 +0,0 @@
1
- =begin
2
-
3
- By default, Padrino mailer uses the built-in sendmail binary functionality on the server.
4
- However, smtp is also supported using the following configuration if needed:
5
-
6
- =end
7
-
8
- module MailerInitializer
9
- def self.registered(app)
10
- # Padrino::Mailer::Base.smtp_settings = {
11
- # :host => 'smtp.gmail.com',
12
- # :port => '587',
13
- # :tls => true,
14
- # :user => 'user',
15
- # :pass => 'pass',
16
- # :auth => :plain
17
- # }
18
- end
19
- end