padrino-gen 0.12.8.1 → 0.12.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +13 -5
  2. data/Rakefile +1 -4
  3. data/lib/padrino-gen/generators/actions.rb +17 -5
  4. data/lib/padrino-gen/generators/app/app.rb.tt +3 -2
  5. data/lib/padrino-gen/generators/components/mocks/mocha.rb +1 -1
  6. data/lib/padrino-gen/generators/components/orms/activerecord.rb +14 -14
  7. data/lib/padrino-gen/generators/components/orms/datamapper.rb +16 -0
  8. data/lib/padrino-gen/generators/components/orms/mongoid.rb +20 -39
  9. data/lib/padrino-gen/generators/components/orms/mongomapper.rb +1 -0
  10. data/lib/padrino-gen/generators/components/orms/sequel.rb +3 -3
  11. data/lib/padrino-gen/generators/components/stylesheets/compass.rb +5 -16
  12. data/lib/padrino-gen/generators/components/tests/bacon.rb +2 -0
  13. data/lib/padrino-gen/generators/components/tests/minitest.rb +2 -0
  14. data/lib/padrino-gen/generators/components/tests/riot.rb +2 -0
  15. data/lib/padrino-gen/generators/components/tests/rspec.rb +5 -1
  16. data/lib/padrino-gen/generators/components/tests/shoulda.rb +3 -0
  17. data/lib/padrino-gen/generators/components/tests/steak.rb +2 -0
  18. data/lib/padrino-gen/generators/components/tests/testunit.rb +112 -0
  19. data/lib/padrino-gen/generators/controller.rb +1 -0
  20. data/lib/padrino-gen/generators/helper.rb +1 -0
  21. data/lib/padrino-gen/generators/mailer.rb +1 -0
  22. data/lib/padrino-gen/generators/migration.rb +1 -0
  23. data/lib/padrino-gen/generators/plugin.rb +1 -1
  24. data/lib/padrino-gen/generators/project/config/boot.rb +16 -2
  25. data/lib/padrino-gen/generators/project.rb +2 -1
  26. data/lib/padrino-gen/generators/runner.rb +1 -0
  27. data/lib/padrino-gen/generators/task.rb +1 -0
  28. data/lib/padrino-gen/generators/templates/Gemfile.tt +13 -0
  29. data/lib/padrino-gen/generators/templates/Rakefile.tt +2 -0
  30. data/lib/padrino-gen/generators/templates/controller.rb.tt +1 -1
  31. data/lib/padrino-gen/generators/templates/project_bin.tt +0 -1
  32. data/lib/padrino-gen/padrino-tasks/activerecord.rb +38 -33
  33. data/lib/padrino-gen/padrino-tasks/datamapper.rb +4 -2
  34. data/lib/padrino-gen/padrino-tasks/mongoid.rb +42 -0
  35. data/lib/padrino-gen/padrino-tasks/sequel.rb +13 -4
  36. data/test/helper.rb +3 -60
  37. data/test/test_app_generator.rb +15 -15
  38. data/test/test_controller_generator.rb +19 -6
  39. data/test/test_helper_generator.rb +13 -0
  40. data/test/test_mailer_generator.rb +5 -0
  41. data/test/test_migration_generator.rb +5 -0
  42. data/test/test_model_generator.rb +30 -24
  43. data/test/test_project_generator.rb +31 -17
  44. data/test/test_task_generator.rb +5 -0
  45. metadata +18 -17
@@ -79,14 +79,14 @@ describe "ModelGenerator" do
79
79
  it 'should generate a default type value for fields' do
80
80
  current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
81
81
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
82
- capture_io { generate(:model, 'person', "name", "age:integer", "email", "-r=#{@apptmp}/sample_project") }
83
- migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
84
- assert_match_in_file(/class CreatePeople < ActiveRecord::Migration/m, migration_file_path)
85
- assert_match_in_file(/ create_table :people/m, migration_file_path)
82
+ capture_io { generate(:model, 'friend', "name", "age:integer", "email", "-r=#{@apptmp}/sample_project") }
83
+ migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_friends.rb"
84
+ assert_match_in_file(/class CreateFriends < ActiveRecord::Migration/m, migration_file_path)
85
+ assert_match_in_file(/ create_table :friends/m, migration_file_path)
86
86
  assert_match_in_file(/ t.string :name/m, migration_file_path)
87
87
  assert_match_in_file(/ t.integer :age/m, migration_file_path)
88
88
  assert_match_in_file(/ t.string :email/m, migration_file_path)
89
- assert_match_in_file(/ drop_table :people/m, migration_file_path)
89
+ assert_match_in_file(/ drop_table :friends/m, migration_file_path)
90
90
  end
91
91
 
92
92
  it 'should abort if model name already exists' do
@@ -149,14 +149,14 @@ describe "ModelGenerator" do
149
149
  it 'should generate migration file with given fields' do
150
150
  current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
151
151
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
152
- capture_io { generate(:model, 'person', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
153
- migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
154
- assert_match_in_file(/class CreatePeople < ActiveRecord::Migration/m, migration_file_path)
155
- assert_match_in_file(/ create_table :people/m, migration_file_path)
152
+ capture_io { generate(:model, 'friend', "name:string", "age:integer", "email:string", "-r=#{@apptmp}/sample_project") }
153
+ migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_friends.rb"
154
+ assert_match_in_file(/class CreateFriends < ActiveRecord::Migration/m, migration_file_path)
155
+ assert_match_in_file(/ create_table :friends/m, migration_file_path)
156
156
  assert_match_in_file(/ t.string :name/m, migration_file_path)
157
157
  assert_match_in_file(/ t.integer :age/m, migration_file_path)
158
158
  assert_match_in_file(/ t.string :email/m, migration_file_path)
159
- assert_match_in_file(/ drop_table :people/m, migration_file_path)
159
+ assert_match_in_file(/ drop_table :friends/m, migration_file_path)
160
160
  end
161
161
  end
162
162
 
@@ -214,6 +214,12 @@ describe "ModelGenerator" do
214
214
 
215
215
  # DATAMAPPER
216
216
  describe "model generator using datamapper" do
217
+ it 'should add activerecord middleware' do
218
+ capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=datamapper') }
219
+ assert_match_in_file(/ use IdentityMap/m, "#{@apptmp}/sample_project/app/app.rb")
220
+ assert_file_exists("#{@apptmp}/sample_project/lib/identity_map_middleware.rb")
221
+ end
222
+
217
223
  it 'should generate model file with camelized name' do
218
224
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=datamapper') }
219
225
  capture_io { generate(:model, 'ChunkyBacon', "-r=#{@apptmp}/sample_project") }
@@ -233,12 +239,12 @@ describe "ModelGenerator" do
233
239
  it 'should properly generate version numbers' do
234
240
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=datamapper') }
235
241
  capture_io { generate(:model, 'user', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
236
- capture_io { generate(:model, 'person', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
242
+ capture_io { generate(:model, 'friend', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
237
243
  capture_io { generate(:model, 'account', "name:string", "age:integer", "created_at:datetime", "-r=#{@apptmp}/sample_project") }
238
244
  assert_match_in_file(/class User\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/user.rb")
239
245
  assert_match_in_file(/migration 1, :create_users do/m, "#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
240
- assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/person.rb")
241
- assert_match_in_file(/migration 2, :create_people do/m, "#{@apptmp}/sample_project/db/migrate/002_create_people.rb")
246
+ assert_match_in_file(/class Friend\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/friend.rb")
247
+ assert_match_in_file(/migration 2, :create_friends do/m, "#{@apptmp}/sample_project/db/migrate/002_create_friends.rb")
242
248
  assert_match_in_file(/class Account\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/account.rb")
243
249
  assert_match_in_file(/migration 3, :create_accounts do/m, "#{@apptmp}/sample_project/db/migrate/003_create_accounts.rb")
244
250
  end
@@ -246,15 +252,15 @@ describe "ModelGenerator" do
246
252
  it 'should generate migration with given fields' do
247
253
  current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
248
254
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=datamapper') }
249
- capture_io { generate(:model, 'person', "name:string", "created_at:date_time", "email:string", "-r=#{@apptmp}/sample_project") }
250
- assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/person.rb")
251
- migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
252
- assert_match_in_file(/migration 1, :create_people do/m, migration_file_path)
253
- assert_match_in_file(/create_table :people do/m, migration_file_path)
255
+ capture_io { generate(:model, 'friend', "name:string", "created_at:date_time", "email:string", "-r=#{@apptmp}/sample_project") }
256
+ assert_match_in_file(/class Friend\n\s+include DataMapper::Resource/m, "#{@apptmp}/sample_project/models/friend.rb")
257
+ migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_friends.rb"
258
+ assert_match_in_file(/migration 1, :create_friends do/m, migration_file_path)
259
+ assert_match_in_file(/create_table :friends do/m, migration_file_path)
254
260
  assert_match_in_file(/column :name, DataMapper::Property::String/m, migration_file_path)
255
261
  assert_match_in_file(/column :created_at, DataMapper::Property::DateTime/m, migration_file_path)
256
262
  assert_match_in_file(/column :email, DataMapper::Property::String/m, migration_file_path)
257
- assert_match_in_file(/drop_table :people/m, migration_file_path)
263
+ assert_match_in_file(/drop_table :friends/m, migration_file_path)
258
264
  end
259
265
  end
260
266
 
@@ -276,15 +282,15 @@ describe "ModelGenerator" do
276
282
  it 'should generate migration file with given properties' do
277
283
  current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
278
284
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-d=sequel') }
279
- capture_io { generate(:model, 'person', "name:string", "age:integer", "created:datetime", "-r=#{@apptmp}/sample_project") }
280
- migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_people.rb"
281
- assert_match_in_file(/class Person < Sequel::Model/m, "#{@apptmp}/sample_project/models/person.rb")
285
+ capture_io { generate(:model, 'friend', "name:string", "age:integer", "created:datetime", "-r=#{@apptmp}/sample_project") }
286
+ migration_file_path = "#{@apptmp}/sample_project/db/migrate/001_create_friends.rb"
287
+ assert_match_in_file(/class Friend < Sequel::Model/m, "#{@apptmp}/sample_project/models/friend.rb")
282
288
  assert_match_in_file(/Sequel\.migration do/m, migration_file_path)
283
- assert_match_in_file(/create_table :people/m, migration_file_path)
289
+ assert_match_in_file(/create_table :friends/m, migration_file_path)
284
290
  assert_match_in_file(/String :name/m, migration_file_path)
285
291
  assert_match_in_file(/Integer :age/m, migration_file_path)
286
292
  assert_match_in_file(/DateTime :created/m, migration_file_path)
287
- assert_match_in_file(/drop_table :people/m, migration_file_path)
293
+ assert_match_in_file(/drop_table :friends/m, migration_file_path)
288
294
  end
289
295
  end
290
296
 
@@ -14,7 +14,7 @@ describe "ProjectGenerator" do
14
14
  describe 'the project generator' do
15
15
  it 'should allow simple generator to run and create base_app with no options' do
16
16
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}") }
17
- assert_file_exists("#{@apptmp}/sample_project")
17
+ assert_dir_exists("#{@apptmp}/sample_project")
18
18
  assert_match_in_file(/module SampleProject/,"#{@apptmp}/sample_project/app/app.rb")
19
19
  assert_match_in_file(/class App < Padrino::Application/,"#{@apptmp}/sample_project/app/app.rb")
20
20
  assert_match_in_file("Padrino.mount('SampleProject::App', :app_file => Padrino.root('app/app.rb')).to('/')", "#{@apptmp}/sample_project/config/apps.rb")
@@ -31,12 +31,12 @@ describe "ProjectGenerator" do
31
31
 
32
32
  it 'should generate a valid name' do
33
33
  capture_io { generate(:project, 'project.com', "--root=#{@apptmp}") }
34
- assert_file_exists("#{@apptmp}/project.com")
34
+ assert_dir_exists("#{@apptmp}/project.com")
35
35
  assert_match_in_file(/module ProjectCom/, "#{@apptmp}/project.com/app/app.rb")
36
36
  assert_match_in_file(/class App < Padrino::Application/, "#{@apptmp}/project.com/app/app.rb")
37
37
  assert_match_in_file("Padrino.mount('ProjectCom::App', :app_file => Padrino.root('app/app.rb')).to('/')", "#{@apptmp}/project.com/config/apps.rb")
38
38
  capture_io { generate(:app, 'ws-dci-2011', "--root=#{@apptmp}/project.com") }
39
- assert_file_exists("#{@apptmp}/project.com/ws_dci_2011")
39
+ assert_dir_exists("#{@apptmp}/project.com/ws_dci_2011")
40
40
  assert_match_in_file(/module ProjectCom/, "#{@apptmp}/project.com/ws_dci_2011/app.rb")
41
41
  assert_match_in_file(/class WsDci2011 < Padrino::Application/, "#{@apptmp}/project.com/ws_dci_2011/app.rb")
42
42
  assert_match_in_file("Padrino.mount('ProjectCom::WsDci2011', :app_file => Padrino.root('ws_dci_2011/app.rb')).to('/ws_dci_2011')", "#{@apptmp}/project.com/config/apps.rb")
@@ -44,12 +44,12 @@ describe "ProjectGenerator" do
44
44
 
45
45
  it 'should generate nested path with dashes in name' do
46
46
  capture_io { generate(:project, 'sample-project', "--root=#{@apptmp}") }
47
- assert_file_exists("#{@apptmp}/sample-project")
47
+ assert_dir_exists("#{@apptmp}/sample-project")
48
48
  assert_match_in_file(/module SampleProject/, "#{@apptmp}/sample-project/app/app.rb")
49
49
  assert_match_in_file(/class App < Padrino::Application/, "#{@apptmp}/sample-project/app/app.rb")
50
50
  assert_match_in_file("Padrino.mount('SampleProject::App', :app_file => Padrino.root('app/app.rb')).to('/')", "#{@apptmp}/sample-project/config/apps.rb")
51
51
  capture_io { generate(:app, 'ws-dci-2011', "--root=#{@apptmp}/sample-project") }
52
- assert_file_exists("#{@apptmp}/sample-project/ws_dci_2011")
52
+ assert_dir_exists("#{@apptmp}/sample-project/ws_dci_2011")
53
53
  assert_match_in_file(/module SampleProject/, "#{@apptmp}/sample-project/ws_dci_2011/app.rb")
54
54
  assert_match_in_file(/class WsDci2011 < Padrino::Application/, "#{@apptmp}/sample-project/ws_dci_2011/app.rb")
55
55
  assert_match_in_file("Padrino.mount('SampleProject::WsDci2011', :app_file => Padrino.root('ws_dci_2011/app.rb')).to('/ws_dci_2011')", "#{@apptmp}/sample-project/config/apps.rb")
@@ -62,13 +62,13 @@ describe "ProjectGenerator" do
62
62
 
63
63
  it 'should display the right path' do
64
64
  out, err = capture_io { generate(:project, 'project', "--root=/tmp") }
65
- assert_file_exists("/tmp/project")
65
+ assert_dir_exists("/tmp/project")
66
66
  assert_match(/cd \/tmp\/project/, out)
67
67
  end
68
68
 
69
69
  it 'should allow specifying alternate application name' do
70
70
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--app=base_app') }
71
- assert_file_exists("#{@apptmp}/sample_project")
71
+ assert_dir_exists("#{@apptmp}/sample_project")
72
72
  assert_match_in_file(/module SampleProject/,"#{@apptmp}/sample_project/app/app.rb")
73
73
  assert_match_in_file(/class BaseApp < Padrino::Application/,"#{@apptmp}/sample_project/app/app.rb")
74
74
  assert_match_in_file("Padrino.mount('SampleProject::BaseApp', :app_file => Padrino.root('app/app.rb')).to('/')", "#{@apptmp}/sample_project/config/apps.rb")
@@ -101,8 +101,8 @@ describe "ProjectGenerator" do
101
101
 
102
102
  it 'should generate tiny skeleton' do
103
103
  capture_io { generate(:project,'sample_project', '--tiny', "--root=#{@apptmp}") }
104
- assert_file_exists("#{@apptmp}/sample_project")
105
- assert_file_exists("#{@apptmp}/sample_project/app")
104
+ assert_dir_exists("#{@apptmp}/sample_project")
105
+ assert_dir_exists("#{@apptmp}/sample_project/app")
106
106
  assert_file_exists("#{@apptmp}/sample_project/app/controllers.rb")
107
107
  assert_file_exists("#{@apptmp}/sample_project/app/helpers.rb")
108
108
  assert_file_exists("#{@apptmp}/sample_project/app/mailers.rb")
@@ -407,7 +407,7 @@ describe "ProjectGenerator" do
407
407
  it 'should properly generate for mongoid' do
408
408
  out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=mongoid', '--script=none') }
409
409
  assert_match(/applying.*?mongoid.*?orm/, out)
410
- assert_match_in_file(/gem 'mongoid', '~>3.0.0'/, "#{@apptmp}/project.com/Gemfile")
410
+ assert_match_in_file(/gem 'mongoid'/, "#{@apptmp}/project.com/Gemfile")
411
411
  assert_match_in_file(/Mongoid::Config.sessions =/, "#{@apptmp}/project.com/config/database.rb")
412
412
  end
413
413
 
@@ -648,7 +648,7 @@ describe "ProjectGenerator" do
648
648
  it 'should properly generate for sass' do
649
649
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=sass') }
650
650
  assert_match_in_file(/gem 'sass'/, "#{@apptmp}/sample_project/Gemfile")
651
- assert_match_in_file(/module SassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/sass_initializer.rb")
651
+ assert_match_in_file(/module SassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/config/initializers/sass.rb")
652
652
  assert_match_in_file(/register SassInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
653
653
  assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
654
654
  end
@@ -656,16 +656,16 @@ describe "ProjectGenerator" do
656
656
  it 'should properly generate for less' do
657
657
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=less') }
658
658
  assert_match_in_file(/gem 'rack-less'/, "#{@apptmp}/sample_project/Gemfile")
659
- assert_match_in_file(/module LessInitializer.*Rack::Less/m, "#{@apptmp}/sample_project/lib/less_initializer.rb")
659
+ assert_match_in_file(/module LessInitializer.*Rack::Less/m, "#{@apptmp}/sample_project/config/initializers/less.rb")
660
660
  assert_match_in_file(/register LessInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
661
661
  assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
662
662
  end
663
663
 
664
664
  it 'should properly generate for compass' do
665
665
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=compass') }
666
- assert_match_in_file(/gem 'compass'/, "#{@apptmp}/sample_project/Gemfile")
667
- assert_match_in_file(/Compass.configure_sass_plugin\!/, "#{@apptmp}/sample_project/lib/compass_plugin.rb")
668
- assert_match_in_file(/module CompassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/compass_plugin.rb")
666
+ assert_match_in_file(/gem 'compass-blueprint'/, "#{@apptmp}/sample_project/Gemfile")
667
+ assert_match_in_file(/Compass.configure_sass_plugin\!/, "#{@apptmp}/sample_project/config/initializers/compass.rb")
668
+ assert_match_in_file(/module CompassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/config/initializers/compass.rb")
669
669
  assert_match_in_file(/register CompassInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
670
670
 
671
671
  assert_file_exists("#{@apptmp}/sample_project/app/stylesheets/application.scss")
@@ -675,8 +675,8 @@ describe "ProjectGenerator" do
675
675
  it 'should properly generate for scss' do
676
676
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=scss') }
677
677
  assert_match_in_file(/gem 'haml'/, "#{@apptmp}/sample_project/Gemfile")
678
- assert_match_in_file(/module ScssInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/scss_initializer.rb")
679
- assert_match_in_file(/Sass::Plugin.options\[:syntax\] = :scss/m, "#{@apptmp}/sample_project/lib/scss_initializer.rb")
678
+ assert_match_in_file(/module ScssInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/config/initializers/scss.rb")
679
+ assert_match_in_file(/Sass::Plugin.options\[:syntax\] = :scss/m, "#{@apptmp}/sample_project/config/initializers/scss.rb")
680
680
  assert_match_in_file(/register ScssInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
681
681
  assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
682
682
  end
@@ -754,5 +754,19 @@ describe "ProjectGenerator" do
754
754
  assert_match_in_file(/class SampleProject::App::HelperTest < Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/app/helpers/helpers_test.rb")
755
755
  end
756
756
 
757
+ it "should properly generate for testunit" do
758
+ out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=testunit', '--script=none', '--tiny') }
759
+ assert_match(/applying.*?testunit.*?test/, out)
760
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
761
+ assert_match_in_file(/:require => 'rack\/test'/, "#{@apptmp}/sample_project/Gemfile")
762
+ assert_match_in_file(/:group => 'test'/, "#{@apptmp}/sample_project/Gemfile")
763
+ assert_match_in_file(/gem 'test-unit'/, "#{@apptmp}/sample_project/Gemfile")
764
+ assert_match_in_file(/RACK_ENV = 'test' unless defined\?\(RACK_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
765
+ assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
766
+ assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
767
+ assert_match_in_file(/Dir\[File\.expand_path\(File\.dirname\(__FILE__\) \+ "\/\.\.\/app\/helpers\.rb"\)\]\.each\(&method\(:require\)\)/, "#{@apptmp}/sample_project/test/test_config.rb")
768
+ assert_match_in_file(/class ControllerTest < Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/app/controllers/controllers_test.rb")
769
+ assert_match_in_file(/class SampleProject::App::HelperTest < Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/app/helpers/helpers_test.rb")
770
+ end
757
771
  end
758
772
  end
@@ -17,6 +17,11 @@ describe "TaskGenerator" do
17
17
  assert_no_file_exists('/tmp/tasks/foo.rake')
18
18
  end
19
19
 
20
+ it 'should fail with NameError if given invalid namespace names' do
21
+ capture_io { generate(:project, "sample", "--root=#{@apptmp}") }
22
+ assert_raises(::NameError) { capture_io { generate(:task, "wrong/name", "--root=#{@apptmp}/sample") } }
23
+ end
24
+
20
25
  it 'should generate filename properly' do
21
26
  capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}") }
22
27
  capture_io { generate(:task, 'DemoTask', "--namespace=Sample", "--description='This is a sample'", "-r=#{@apptmp}/sample_project") }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.8.1
4
+ version: 0.12.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-09-06 00:00:00.000000000 Z
14
+ date: 2018-02-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-core
@@ -19,26 +19,26 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.12.8.1
22
+ version: 0.12.9
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.12.8.1
29
+ version: 0.12.9
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: bundler
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ~>
35
35
  - !ruby/object:Gem::Version
36
36
  version: '1.0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "~>"
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.0'
44
44
  - !ruby/object:Gem::Dependency
@@ -47,28 +47,28 @@ dependencies:
47
47
  requirements:
48
48
  - - '='
49
49
  - !ruby/object:Gem::Version
50
- version: 0.12.8.1
50
+ version: 0.12.9
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - '='
56
56
  - !ruby/object:Gem::Version
57
- version: 0.12.8.1
57
+ version: 0.12.9
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: padrino-mailer
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - '='
63
63
  - !ruby/object:Gem::Version
64
- version: 0.12.8.1
64
+ version: 0.12.9
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - '='
70
70
  - !ruby/object:Gem::Version
71
- version: 0.12.8.1
71
+ version: 0.12.9
72
72
  description: Generators for easily creating and building padrino applications from
73
73
  the console
74
74
  email: padrinorb@gmail.com
@@ -78,9 +78,9 @@ extensions: []
78
78
  extra_rdoc_files:
79
79
  - README.rdoc
80
80
  files:
81
- - ".document"
82
- - ".gitignore"
83
- - ".yardopts"
81
+ - .document
82
+ - .gitignore
83
+ - .yardopts
84
84
  - LICENSE.txt
85
85
  - README.rdoc
86
86
  - Rakefile
@@ -129,6 +129,7 @@ files:
129
129
  - lib/padrino-gen/generators/components/tests/rspec.rb
130
130
  - lib/padrino-gen/generators/components/tests/shoulda.rb
131
131
  - lib/padrino-gen/generators/components/tests/steak.rb
132
+ - lib/padrino-gen/generators/components/tests/testunit.rb
132
133
  - lib/padrino-gen/generators/controller.rb
133
134
  - lib/padrino-gen/generators/helper.rb
134
135
  - lib/padrino-gen/generators/mailer.rb
@@ -202,22 +203,22 @@ licenses:
202
203
  metadata: {}
203
204
  post_install_message:
204
205
  rdoc_options:
205
- - "--charset=UTF-8"
206
+ - --charset=UTF-8
206
207
  require_paths:
207
208
  - lib
208
209
  required_ruby_version: !ruby/object:Gem::Requirement
209
210
  requirements:
210
- - - ">="
211
+ - - ! '>='
211
212
  - !ruby/object:Gem::Version
212
213
  version: '0'
213
214
  required_rubygems_version: !ruby/object:Gem::Requirement
214
215
  requirements:
215
- - - ">="
216
+ - - ! '>='
216
217
  - !ruby/object:Gem::Version
217
218
  version: 1.3.6
218
219
  requirements: []
219
220
  rubyforge_project: padrino-gen
220
- rubygems_version: 2.5.1
221
+ rubygems_version: 2.6.14
221
222
  signing_key:
222
223
  specification_version: 4
223
224
  summary: Generators for easily creating and building padrino applications