padrino-gen 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/bin/padrino-gen +6 -10
- data/lib/{generators/skeleton.rb → padrino-gen/generators/app.rb} +8 -4
- data/lib/padrino-gen/generators/base.rb +25 -0
- data/lib/{generators → padrino-gen/generators}/controller.rb +4 -0
- data/lib/{generators → padrino-gen/generators}/mailer.rb +4 -0
- data/lib/{generators → padrino-gen/generators}/migration.rb +4 -0
- data/lib/{generators → padrino-gen/generators}/model.rb +4 -0
- data/lib/padrino-gen.rb +26 -3
- data/padrino-gen.gemspec +56 -54
- data/test/{test_skeleton_generator.rb → test_app_generator.rb} +37 -29
- data/test/test_controller_generator.rb +10 -9
- data/test/test_generator.rb +17 -0
- data/test/test_mailer_generator.rb +5 -4
- data/test/test_migration_generator.rb +24 -15
- data/test/test_model_generator.rb +21 -20
- metadata +55 -53
- /data/lib/{generators → padrino-gen/generators}/actions.rb +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/.gitignore +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/Gemfile +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/app.rb.tt +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/controllers/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/helpers/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/app/views/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/apps.rb.tt +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/boot.rb +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/initializers/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/initializers/example.rb +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config/urls.rb.tt +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/config.ru +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/lib/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/public/images/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/public/javascripts/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/public/stylesheets/.empty_directory +0 -0
- /data/lib/{generators/skeleton → padrino-gen/generators/app}/tmp/.empty_directory +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/actions.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/mocks/mocha_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/mocks/rr_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/activerecord_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/couchrest_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/datamapper_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/mongomapper_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/orms/sequel_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/renderers/erb_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/renderers/haml_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/scripts/jquery_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/scripts/prototype_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/scripts/rightjs_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/bacon_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/riot_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/rspec_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/shoulda_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/components/tests/testspec_test_gen.rb +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/controller.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/helper.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/mailer.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/mailer_initializer.rb.tt +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/jquery.js +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/lowpro.js +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/protopak.js +0 -0
- /data/lib/{generators → padrino-gen/generators}/templates/scripts/right.js +0 -0
@@ -3,7 +3,8 @@ require 'thor'
|
|
3
3
|
|
4
4
|
class TestMailerGenerator < Test::Unit::TestCase
|
5
5
|
def setup
|
6
|
-
|
6
|
+
Padrino::Generators.lockup!
|
7
|
+
@app = Padrino::Generators::App.dup
|
7
8
|
@mailgen = Padrino::Generators::Mailer.dup
|
8
9
|
`rm -rf /tmp/sample_app`
|
9
10
|
end
|
@@ -16,7 +17,7 @@ class TestMailerGenerator < Test::Unit::TestCase
|
|
16
17
|
end
|
17
18
|
|
18
19
|
should "support generating a new mailer extended from base" do
|
19
|
-
silence_logger { @
|
20
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon']) }
|
20
21
|
silence_logger { @mailgen.start(['demo', '-r=/tmp/sample_app']) }
|
21
22
|
assert_match_in_file(/class DemoMailer < Padrino::Mailer::Base/m, '/tmp/sample_app/app/mailers/demo_mailer.rb')
|
22
23
|
assert_match_in_file(/Padrino::Mailer::Base.smtp_settings/m, '/tmp/sample_app/config/initializers/mailer.rb')
|
@@ -24,7 +25,7 @@ class TestMailerGenerator < Test::Unit::TestCase
|
|
24
25
|
end
|
25
26
|
|
26
27
|
should "support generating a new mailer extended from base with long name" do
|
27
|
-
silence_logger { @
|
28
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon']) }
|
28
29
|
silence_logger { @mailgen.start(['user_notice', '-r=/tmp/sample_app']) }
|
29
30
|
assert_match_in_file(/class UserNoticeMailer/m, '/tmp/sample_app/app/mailers/user_notice_mailer.rb')
|
30
31
|
assert_match_in_file(/Padrino::Mailer::Base.smtp_settings/m, '/tmp/sample_app/config/initializers/mailer.rb')
|
@@ -32,7 +33,7 @@ class TestMailerGenerator < Test::Unit::TestCase
|
|
32
33
|
end
|
33
34
|
|
34
35
|
should "support generating a new mailer extended from base with capitalized name" do
|
35
|
-
silence_logger { @
|
36
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon']) }
|
36
37
|
silence_logger { @mailgen.start(['DEMO', '-r=/tmp/sample_app']) }
|
37
38
|
assert_match_in_file(/class DemoMailer < Padrino::Mailer::Base/m, '/tmp/sample_app/app/mailers/demo_mailer.rb')
|
38
39
|
assert_match_in_file(/Padrino::Mailer::Base.smtp_settings/m, '/tmp/sample_app/config/initializers/mailer.rb')
|
@@ -3,7 +3,8 @@ require 'thor'
|
|
3
3
|
|
4
4
|
class TestMigrationGenerator < Test::Unit::TestCase
|
5
5
|
def setup
|
6
|
-
|
6
|
+
Padrino::Generators.lockup!
|
7
|
+
@app = Padrino::Generators::App.dup
|
7
8
|
@mig_gen = Padrino::Generators::Migration.dup
|
8
9
|
`rm -rf /tmp/sample_app`
|
9
10
|
end
|
@@ -16,29 +17,30 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
16
17
|
end
|
17
18
|
|
18
19
|
should "generate migration inside app root" do
|
19
|
-
silence_logger { @
|
20
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
20
21
|
response_success = silence_logger { @mig_gen.start(['AddEmailToUsers', '-r=/tmp/sample_app']) }
|
21
22
|
migration_file_path = "/tmp/sample_app/db/migrate/001_add_email_to_users.rb"
|
22
23
|
assert_match_in_file(/class AddEmailToUser/m, migration_file_path)
|
23
24
|
end
|
24
25
|
|
25
26
|
should "generate migration inside app root with lowercase migration argument" do
|
26
|
-
silence_logger { @
|
27
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
27
28
|
response_success = silence_logger { @mig_gen.start(['add_email_to_users', '-r=/tmp/sample_app']) }
|
28
29
|
migration_file_path = "/tmp/sample_app/db/migrate/001_add_email_to_users.rb"
|
29
30
|
assert_match_in_file(/class AddEmailToUsers/m, migration_file_path)
|
30
31
|
end
|
31
32
|
|
32
33
|
should "generate migration inside app root with singular table" do
|
33
|
-
silence_logger { @
|
34
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
34
35
|
silence_logger { @mig_gen.start(['add_email_to_user', "email:string", '-r=/tmp/sample_app']) }
|
35
36
|
migration_file_path = "/tmp/sample_app/db/migrate/001_add_email_to_user.rb"
|
36
37
|
assert_match_in_file(/class AddEmailToUser/m, migration_file_path)
|
37
38
|
assert_match_in_file(/t.column :email, :string/, migration_file_path)
|
38
39
|
assert_match_in_file(/t.remove :email/, migration_file_path)
|
39
40
|
end
|
41
|
+
|
40
42
|
should "properly calculate version number" do
|
41
|
-
silence_logger { @
|
43
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=sequel']) }
|
42
44
|
silence_logger { @mig_gen.start(['add_email_to_person', "email:string", '-r=/tmp/sample_app']) }
|
43
45
|
silence_logger { @mig_gen.start(['add_name_to_person', "email:string", '-r=/tmp/sample_app']) }
|
44
46
|
silence_logger { @mig_gen.start(['add_age_to_user', "email:string", '-r=/tmp/sample_app']) }
|
@@ -50,15 +52,16 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
50
52
|
|
51
53
|
context 'the migration generator for activerecord' do
|
52
54
|
should "generate migration for generic needs" do
|
53
|
-
silence_logger { @
|
55
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
54
56
|
response_success = silence_logger { @mig_gen.start(['ModifyUserFields', '-r=/tmp/sample_app']) }
|
55
57
|
migration_file_path = "/tmp/sample_app/db/migrate/001_modify_user_fields.rb"
|
56
58
|
assert_match_in_file(/class ModifyUserFields/m, migration_file_path)
|
57
59
|
assert_match_in_file(/def self\.up\s+end/m, migration_file_path)
|
58
60
|
assert_match_in_file(/def self\.down\s+end/m, migration_file_path)
|
59
61
|
end
|
62
|
+
|
60
63
|
should "generate migration for adding columns" do
|
61
|
-
silence_logger { @
|
64
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
62
65
|
migration_params = ['AddEmailToUsers', "email:string", "age:integer", '-r=/tmp/sample_app']
|
63
66
|
response_success = silence_logger { @mig_gen.start(migration_params) }
|
64
67
|
migration_file_path = "/tmp/sample_app/db/migrate/001_add_email_to_users.rb"
|
@@ -68,8 +71,9 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
68
71
|
assert_match_in_file(/change_table :users.*?t\.remove :email/m, migration_file_path)
|
69
72
|
assert_match_in_file(/t\.remove :age/m, migration_file_path)
|
70
73
|
end
|
74
|
+
|
71
75
|
should "generate migration for removing columns" do
|
72
|
-
silence_logger { @
|
76
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
73
77
|
migration_params = ['RemoveEmailFromUsers', "email:string", "age:integer", '-r=/tmp/sample_app']
|
74
78
|
response_success = silence_logger { @mig_gen.start(migration_params) }
|
75
79
|
migration_file_path = "/tmp/sample_app/db/migrate/001_remove_email_from_users.rb"
|
@@ -83,15 +87,16 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
83
87
|
|
84
88
|
context 'the migration generator for datamapper' do
|
85
89
|
should "generate migration for generic needs" do
|
86
|
-
silence_logger { @
|
90
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=datamapper']) }
|
87
91
|
response_success = silence_logger { @mig_gen.start(['ModifyUserFields', '-r=/tmp/sample_app']) }
|
88
92
|
migration_file_path = "/tmp/sample_app/db/migrate/001_modify_user_fields.rb"
|
89
93
|
assert_match_in_file(/migration\s1.*?:modify_user_fields/m, migration_file_path)
|
90
94
|
assert_match_in_file(/up\sdo\s+end/m, migration_file_path)
|
91
95
|
assert_match_in_file(/down\sdo\s+end/m, migration_file_path)
|
92
96
|
end
|
97
|
+
|
93
98
|
should "generate migration for adding columns" do
|
94
|
-
silence_logger { @
|
99
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=datamapper']) }
|
95
100
|
migration_params = ['AddEmailToUsers', "email:string", "age:integer", '-r=/tmp/sample_app']
|
96
101
|
response_success = silence_logger { @mig_gen.start(migration_params) }
|
97
102
|
migration_file_path = "/tmp/sample_app/db/migrate/001_add_email_to_users.rb"
|
@@ -101,8 +106,9 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
101
106
|
assert_match_in_file(/modify_table :users.*?drop_column :email/m, migration_file_path)
|
102
107
|
assert_match_in_file(/drop_column :age/m, migration_file_path)
|
103
108
|
end
|
109
|
+
|
104
110
|
should "generate migration for removing columns" do
|
105
|
-
silence_logger { @
|
111
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=datamapper']) }
|
106
112
|
migration_params = ['RemoveEmailFromUsers', "email:string", "age:integer", '-r=/tmp/sample_app']
|
107
113
|
response_success = silence_logger { @mig_gen.start(migration_params) }
|
108
114
|
migration_file_path = "/tmp/sample_app/db/migrate/001_remove_email_from_users.rb"
|
@@ -112,8 +118,9 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
112
118
|
assert_match_in_file(/modify_table :users.*?add_column :email, String/m, migration_file_path)
|
113
119
|
assert_match_in_file(/add_column :age, Integer/m, migration_file_path)
|
114
120
|
end
|
121
|
+
|
115
122
|
should "properly version migration files" do
|
116
|
-
silence_logger { @
|
123
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=datamapper']) }
|
117
124
|
response_success = silence_logger { @mig_gen.start(['ModifyUserFields', '-r=/tmp/sample_app']) }
|
118
125
|
response_success = silence_logger { @mig_gen.start(['ModifyUserFields2', '-r=/tmp/sample_app']) }
|
119
126
|
response_success = silence_logger { @mig_gen.start(['ModifyUserFields3', '-r=/tmp/sample_app']) }
|
@@ -125,15 +132,16 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
125
132
|
|
126
133
|
context 'the migration generator for sequel' do
|
127
134
|
should "generate migration for generic needs" do
|
128
|
-
silence_logger { @
|
135
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=sequel']) }
|
129
136
|
response_success = silence_logger { @mig_gen.start(['ModifyUserFields', '-r=/tmp/sample_app']) }
|
130
137
|
migration_file_path = "/tmp/sample_app/db/migrate/001_modify_user_fields.rb"
|
131
138
|
assert_match_in_file(/class ModifyUserFields/m, migration_file_path)
|
132
139
|
assert_match_in_file(/def\sup\s+end/m, migration_file_path)
|
133
140
|
assert_match_in_file(/def\sdown\s+end/m, migration_file_path)
|
134
141
|
end
|
142
|
+
|
135
143
|
should "generate migration for adding columns" do
|
136
|
-
silence_logger { @
|
144
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=sequel']) }
|
137
145
|
migration_params = ['AddEmailToUsers', "email:string", "age:integer", '-r=/tmp/sample_app']
|
138
146
|
response_success = silence_logger { @mig_gen.start(migration_params) }
|
139
147
|
migration_file_path = "/tmp/sample_app/db/migrate/001_add_email_to_users.rb"
|
@@ -143,8 +151,9 @@ class TestMigrationGenerator < Test::Unit::TestCase
|
|
143
151
|
assert_match_in_file(/alter_table :users.*?drop_column :email/m, migration_file_path)
|
144
152
|
assert_match_in_file(/drop_column :age/m, migration_file_path)
|
145
153
|
end
|
154
|
+
|
146
155
|
should "generate migration for removing columns" do
|
147
|
-
silence_logger { @
|
156
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=sequel']) }
|
148
157
|
migration_params = ['RemoveEmailFromUsers', "email:string", "age:integer", '-r=/tmp/sample_app']
|
149
158
|
response_success = silence_logger { @mig_gen.start(migration_params) }
|
150
159
|
migration_file_path = "/tmp/sample_app/db/migrate/001_remove_email_from_users.rb"
|
@@ -3,7 +3,8 @@ require 'thor'
|
|
3
3
|
|
4
4
|
class TestModelGenerator < Test::Unit::TestCase
|
5
5
|
def setup
|
6
|
-
|
6
|
+
Padrino::Generators.lockup!
|
7
|
+
@app = Padrino::Generators::App.dup
|
7
8
|
@model_gen = Padrino::Generators::Model.dup
|
8
9
|
`rm -rf /tmp/sample_app`
|
9
10
|
end
|
@@ -16,7 +17,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
16
17
|
end
|
17
18
|
|
18
19
|
should "generate only generate model once" do
|
19
|
-
silence_logger { @
|
20
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
20
21
|
response_success = silence_logger { @model_gen.start(['user', '-r=/tmp/sample_app']) }
|
21
22
|
response_duplicate = silence_logger { @model_gen.start(['user', '-r=/tmp/sample_app']) }
|
22
23
|
assert_match_in_file(/class User < ActiveRecord::Base/m, '/tmp/sample_app/app/models/user.rb')
|
@@ -24,7 +25,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
24
25
|
end
|
25
26
|
|
26
27
|
should "generate migration file versions properly" do
|
27
|
-
silence_logger { @
|
28
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
28
29
|
silence_logger { @model_gen.start(['user', '-r=/tmp/sample_app']) }
|
29
30
|
silence_logger { @model_gen.start(['account', '-r=/tmp/sample_app']) }
|
30
31
|
silence_logger { @model_gen.start(['bank', '-r=/tmp/sample_app']) }
|
@@ -37,14 +38,14 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
37
38
|
# ACTIVERECORD
|
38
39
|
context "model generator using activerecord" do
|
39
40
|
should "generate model file" do
|
40
|
-
silence_logger { @
|
41
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
41
42
|
silence_logger { @model_gen.start(['user', '-r=/tmp/sample_app']) }
|
42
43
|
assert_match_in_file(/class User < ActiveRecord::Base/m, '/tmp/sample_app/app/models/user.rb')
|
43
44
|
end
|
44
45
|
|
45
46
|
should "generate migration file with no fields" do
|
46
47
|
current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
|
47
|
-
silence_logger { @
|
48
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
48
49
|
silence_logger { @model_gen.start(['user', '-r=/tmp/sample_app']) }
|
49
50
|
migration_file_path = "/tmp/sample_app/db/migrate/001_create_users.rb"
|
50
51
|
assert_match_in_file(/class CreateUsers < ActiveRecord::Migration/m, migration_file_path)
|
@@ -55,7 +56,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
55
56
|
|
56
57
|
should "generate migration file with given fields" do
|
57
58
|
current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
|
58
|
-
silence_logger { @
|
59
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
59
60
|
silence_logger { @model_gen.start(['person', "name:string", "age:integer", "email:string", '-r=/tmp/sample_app']) }
|
60
61
|
migration_file_path = "/tmp/sample_app/db/migrate/001_create_people.rb"
|
61
62
|
assert_match_in_file(/class CreatePeople < ActiveRecord::Migration/m, migration_file_path)
|
@@ -71,7 +72,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
71
72
|
# COUCHREST
|
72
73
|
context "model generator using couchrest" do
|
73
74
|
should "generate model file with no properties" do
|
74
|
-
silence_logger { @
|
75
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=couchrest']) }
|
75
76
|
silence_logger { @model_gen.start(['user', '-r=/tmp/sample_app']) }
|
76
77
|
assert_match_in_file(/class User < CouchRest::ExtendedDocument/m, '/tmp/sample_app/app/models/user.rb')
|
77
78
|
assert_match_in_file(/use_database app \{ couchdb \}/m, '/tmp/sample_app/app/models/user.rb')
|
@@ -79,7 +80,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
79
80
|
end
|
80
81
|
|
81
82
|
should "generate model file with given fields" do
|
82
|
-
silence_logger { @
|
83
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=couchrest']) }
|
83
84
|
silence_logger { @model_gen.start(['person', "name:string", "age", "email:string", '-r=/tmp/sample_app']) }
|
84
85
|
assert_match_in_file(/class Person < CouchRest::ExtendedDocument/m, '/tmp/sample_app/app/models/person.rb')
|
85
86
|
assert_match_in_file(/use_database app \{ couchdb \}/m, '/tmp/sample_app/app/models/person.rb')
|
@@ -92,7 +93,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
92
93
|
# DATAMAPPER
|
93
94
|
context "model generator using datamapper" do
|
94
95
|
should "generate model file with fields" do
|
95
|
-
silence_logger { @
|
96
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=datamapper']) }
|
96
97
|
silence_logger { @model_gen.start(['user', "name:string", "age:integer", "created_at:datetime", '-r=/tmp/sample_app']) }
|
97
98
|
assert_match_in_file(/class User\n\s+include DataMapper::Resource/m, '/tmp/sample_app/app/models/user.rb')
|
98
99
|
assert_match_in_file(/property :name, String/m, '/tmp/sample_app/app/models/user.rb')
|
@@ -101,7 +102,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
101
102
|
end
|
102
103
|
|
103
104
|
should "properly generate version numbers" do
|
104
|
-
silence_logger { @
|
105
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=datamapper']) }
|
105
106
|
silence_logger { @model_gen.start(['user', "name:string", "age:integer", "created_at:datetime", '-r=/tmp/sample_app']) }
|
106
107
|
silence_logger { @model_gen.start(['person', "name:string", "age:integer", "created_at:datetime", '-r=/tmp/sample_app']) }
|
107
108
|
silence_logger { @model_gen.start(['account', "name:string", "age:integer", "created_at:datetime", '-r=/tmp/sample_app']) }
|
@@ -115,7 +116,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
115
116
|
|
116
117
|
should "generate migration with given fields" do
|
117
118
|
current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
|
118
|
-
silence_logger { @
|
119
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=datamapper']) }
|
119
120
|
silence_logger { @model_gen.start(['person', "name:string", "created_at:datetime", "email:string", '-r=/tmp/sample_app']) }
|
120
121
|
assert_match_in_file(/class Person\n\s+include DataMapper::Resource/m, '/tmp/sample_app/app/models/person.rb')
|
121
122
|
migration_file_path = "/tmp/sample_app/db/migrate/001_create_people.rb"
|
@@ -131,14 +132,14 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
131
132
|
# MONGOMAPPER
|
132
133
|
context "model generator using mongomapper" do
|
133
134
|
should "generate model file with no properties" do
|
134
|
-
silence_logger { @
|
135
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=mongomapper']) }
|
135
136
|
silence_logger { @model_gen.start(['person', '-r=/tmp/sample_app']) }
|
136
137
|
assert_match_in_file(/class Person\n\s+include MongoMapper::Document/m, '/tmp/sample_app/app/models/person.rb')
|
137
138
|
assert_match_in_file(/# key <name>, <type>[\n\s]+end/m, '/tmp/sample_app/app/models/person.rb')
|
138
139
|
end
|
139
140
|
|
140
141
|
should "generate model file with given fields" do
|
141
|
-
silence_logger { @
|
142
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=mongomapper']) }
|
142
143
|
silence_logger { @model_gen.start(['user', "name:string", "age:integer", "email:string", '-r=/tmp/sample_app']) }
|
143
144
|
assert_match_in_file(/class User\n\s+include MongoMapper::Document/m, '/tmp/sample_app/app/models/user.rb')
|
144
145
|
assert_match_in_file(/key :name, String/m, '/tmp/sample_app/app/models/user.rb')
|
@@ -150,14 +151,14 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
150
151
|
# SEQUEL
|
151
152
|
context "model generator using sequel" do
|
152
153
|
should "generate model file with given properties" do
|
153
|
-
silence_logger { @
|
154
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=sequel']) }
|
154
155
|
silence_logger { @model_gen.start(['user', "name:string", "age:integer", "created:datetime", '-r=/tmp/sample_app']) }
|
155
156
|
assert_match_in_file(/class User < Sequel::Model/m, '/tmp/sample_app/app/models/user.rb')
|
156
157
|
end
|
157
158
|
|
158
159
|
should "generate migration file with given properties" do
|
159
160
|
current_time = stop_time_for_test.strftime("%Y%m%d%H%M%S")
|
160
|
-
silence_logger { @
|
161
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-d=sequel']) }
|
161
162
|
silence_logger { @model_gen.start(['person', "name:string", "age:integer", "created:datetime", '-r=/tmp/sample_app']) }
|
162
163
|
migration_file_path = "/tmp/sample_app/db/migrate/001_create_people.rb"
|
163
164
|
assert_match_in_file(/class Person < Sequel::Model/m, '/tmp/sample_app/app/models/person.rb')
|
@@ -173,7 +174,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
173
174
|
context "model generator testing files" do
|
174
175
|
# BACON
|
175
176
|
should "generate test file for bacon" do
|
176
|
-
silence_logger { @
|
177
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon', '-d=activerecord']) }
|
177
178
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_app']) }
|
178
179
|
assert_match_in_file(/describe "User Model"/m, '/tmp/sample_app/test/models/user_test.rb')
|
179
180
|
assert_match_in_file(/@user = User.new/m, '/tmp/sample_app/test/models/user_test.rb')
|
@@ -182,7 +183,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
182
183
|
|
183
184
|
# RIOT
|
184
185
|
should "generate test file for riot" do
|
185
|
-
silence_logger { @
|
186
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=riot', '-d=activerecord']) }
|
186
187
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_app']) }
|
187
188
|
assert_match_in_file(/context "User Model" do/m, '/tmp/sample_app/test/models/user_test.rb')
|
188
189
|
assert_match_in_file(/@user = User.new/m, '/tmp/sample_app/test/models/user_test.rb')
|
@@ -191,7 +192,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
191
192
|
|
192
193
|
# RSPEC
|
193
194
|
should "generate test file for rspec" do
|
194
|
-
silence_logger { @
|
195
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=rspec', '-d=activerecord']) }
|
195
196
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_app']) }
|
196
197
|
assert_match_in_file(/describe "User Model"/m, '/tmp/sample_app/test/models/user_spec.rb')
|
197
198
|
assert_match_in_file(/@user = User.new/m, '/tmp/sample_app/test/models/user_spec.rb')
|
@@ -200,7 +201,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
200
201
|
|
201
202
|
# SHOULDA
|
202
203
|
should "generate test file for shoulda" do
|
203
|
-
silence_logger { @
|
204
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=shoulda', '-d=activerecord']) }
|
204
205
|
silence_logger { @model_gen.start(['Person', '-r=/tmp/sample_app']) }
|
205
206
|
assert_match_in_file(/class PersonControllerTest < Test::Unit::TestCase/m, '/tmp/sample_app/test/models/person_test.rb')
|
206
207
|
assert_match_in_file(/context "Person Model"/m, '/tmp/sample_app/test/models/person_test.rb')
|
@@ -210,7 +211,7 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
210
211
|
|
211
212
|
# TESTSPEC
|
212
213
|
should "generate test file for testspec" do
|
213
|
-
silence_logger { @
|
214
|
+
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=testspec', '-d=activerecord']) }
|
214
215
|
silence_logger { @model_gen.start(['User', '-r=/tmp/sample_app']) }
|
215
216
|
assert_match_in_file(/context "User Model"/m, '/tmp/sample_app/test/models/user_test.rb')
|
216
217
|
assert_match_in_file(/@user = User.new/m, '/tmp/sample_app/test/models/user_test.rb')
|
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.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-12-
|
15
|
+
date: 2009-12-21 00:00:00 -08:00
|
16
16
|
default_executable: padrino-gen
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -131,64 +131,66 @@ files:
|
|
131
131
|
- Rakefile
|
132
132
|
- VERSION
|
133
133
|
- bin/padrino-gen
|
134
|
-
- lib/generators/actions.rb
|
135
|
-
- lib/generators/components/actions.rb
|
136
|
-
- lib/generators/components/mocks/mocha_gen.rb
|
137
|
-
- lib/generators/components/mocks/rr_gen.rb
|
138
|
-
- lib/generators/components/orms/activerecord_gen.rb
|
139
|
-
- lib/generators/components/orms/couchrest_gen.rb
|
140
|
-
- lib/generators/components/orms/datamapper_gen.rb
|
141
|
-
- lib/generators/components/orms/mongomapper_gen.rb
|
142
|
-
- lib/generators/components/orms/sequel_gen.rb
|
143
|
-
- lib/generators/components/renderers/erb_gen.rb
|
144
|
-
- lib/generators/components/renderers/haml_gen.rb
|
145
|
-
- lib/generators/components/scripts/jquery_gen.rb
|
146
|
-
- lib/generators/components/scripts/prototype_gen.rb
|
147
|
-
- lib/generators/components/scripts/rightjs_gen.rb
|
148
|
-
- lib/generators/components/tests/bacon_test_gen.rb
|
149
|
-
- lib/generators/components/tests/riot_test_gen.rb
|
150
|
-
- lib/generators/components/tests/rspec_test_gen.rb
|
151
|
-
- lib/generators/components/tests/shoulda_test_gen.rb
|
152
|
-
- lib/generators/components/tests/testspec_test_gen.rb
|
153
|
-
- lib/generators/controller.rb
|
154
|
-
- lib/generators/mailer.rb
|
155
|
-
- lib/generators/migration.rb
|
156
|
-
- lib/generators/model.rb
|
157
|
-
- lib/generators/skeleton.rb
|
158
|
-
- lib/generators/skeleton/.gitignore
|
159
|
-
- lib/generators/skeleton/Gemfile
|
160
|
-
- lib/generators/skeleton/app/.empty_directory
|
161
|
-
- lib/generators/skeleton/app/app.rb.tt
|
162
|
-
- lib/generators/skeleton/app/controllers/.empty_directory
|
163
|
-
- lib/generators/skeleton/app/helpers/.empty_directory
|
164
|
-
- lib/generators/skeleton/app/views/.empty_directory
|
165
|
-
- lib/generators/skeleton/config.ru
|
166
|
-
- lib/generators/skeleton/config/apps.rb.tt
|
167
|
-
- lib/generators/skeleton/config/boot.rb
|
168
|
-
- lib/generators/skeleton/config/initializers/.empty_directory
|
169
|
-
- lib/generators/skeleton/config/initializers/example.rb
|
170
|
-
- lib/generators/skeleton/config/urls.rb.tt
|
171
|
-
- lib/generators/skeleton/lib/.empty_directory
|
172
|
-
- lib/generators/skeleton/public/images/.empty_directory
|
173
|
-
- lib/generators/skeleton/public/javascripts/.empty_directory
|
174
|
-
- lib/generators/skeleton/public/stylesheets/.empty_directory
|
175
|
-
- lib/generators/skeleton/tmp/.empty_directory
|
176
|
-
- lib/generators/templates/controller.rb.tt
|
177
|
-
- lib/generators/templates/helper.rb.tt
|
178
|
-
- lib/generators/templates/mailer.rb.tt
|
179
|
-
- lib/generators/templates/mailer_initializer.rb.tt
|
180
|
-
- lib/generators/templates/scripts/jquery.js
|
181
|
-
- lib/generators/templates/scripts/lowpro.js
|
182
|
-
- lib/generators/templates/scripts/protopak.js
|
183
|
-
- lib/generators/templates/scripts/right.js
|
184
134
|
- lib/padrino-gen.rb
|
135
|
+
- lib/padrino-gen/generators/actions.rb
|
136
|
+
- lib/padrino-gen/generators/app.rb
|
137
|
+
- lib/padrino-gen/generators/app/.gitignore
|
138
|
+
- lib/padrino-gen/generators/app/Gemfile
|
139
|
+
- lib/padrino-gen/generators/app/app/.empty_directory
|
140
|
+
- lib/padrino-gen/generators/app/app/app.rb.tt
|
141
|
+
- lib/padrino-gen/generators/app/app/controllers/.empty_directory
|
142
|
+
- lib/padrino-gen/generators/app/app/helpers/.empty_directory
|
143
|
+
- lib/padrino-gen/generators/app/app/views/.empty_directory
|
144
|
+
- lib/padrino-gen/generators/app/config.ru
|
145
|
+
- lib/padrino-gen/generators/app/config/apps.rb.tt
|
146
|
+
- lib/padrino-gen/generators/app/config/boot.rb
|
147
|
+
- lib/padrino-gen/generators/app/config/initializers/.empty_directory
|
148
|
+
- lib/padrino-gen/generators/app/config/initializers/example.rb
|
149
|
+
- lib/padrino-gen/generators/app/config/urls.rb.tt
|
150
|
+
- lib/padrino-gen/generators/app/lib/.empty_directory
|
151
|
+
- lib/padrino-gen/generators/app/public/images/.empty_directory
|
152
|
+
- lib/padrino-gen/generators/app/public/javascripts/.empty_directory
|
153
|
+
- lib/padrino-gen/generators/app/public/stylesheets/.empty_directory
|
154
|
+
- lib/padrino-gen/generators/app/tmp/.empty_directory
|
155
|
+
- lib/padrino-gen/generators/base.rb
|
156
|
+
- lib/padrino-gen/generators/components/actions.rb
|
157
|
+
- lib/padrino-gen/generators/components/mocks/mocha_gen.rb
|
158
|
+
- lib/padrino-gen/generators/components/mocks/rr_gen.rb
|
159
|
+
- lib/padrino-gen/generators/components/orms/activerecord_gen.rb
|
160
|
+
- lib/padrino-gen/generators/components/orms/couchrest_gen.rb
|
161
|
+
- lib/padrino-gen/generators/components/orms/datamapper_gen.rb
|
162
|
+
- lib/padrino-gen/generators/components/orms/mongomapper_gen.rb
|
163
|
+
- lib/padrino-gen/generators/components/orms/sequel_gen.rb
|
164
|
+
- lib/padrino-gen/generators/components/renderers/erb_gen.rb
|
165
|
+
- lib/padrino-gen/generators/components/renderers/haml_gen.rb
|
166
|
+
- lib/padrino-gen/generators/components/scripts/jquery_gen.rb
|
167
|
+
- lib/padrino-gen/generators/components/scripts/prototype_gen.rb
|
168
|
+
- lib/padrino-gen/generators/components/scripts/rightjs_gen.rb
|
169
|
+
- lib/padrino-gen/generators/components/tests/bacon_test_gen.rb
|
170
|
+
- lib/padrino-gen/generators/components/tests/riot_test_gen.rb
|
171
|
+
- lib/padrino-gen/generators/components/tests/rspec_test_gen.rb
|
172
|
+
- lib/padrino-gen/generators/components/tests/shoulda_test_gen.rb
|
173
|
+
- lib/padrino-gen/generators/components/tests/testspec_test_gen.rb
|
174
|
+
- lib/padrino-gen/generators/controller.rb
|
175
|
+
- lib/padrino-gen/generators/mailer.rb
|
176
|
+
- lib/padrino-gen/generators/migration.rb
|
177
|
+
- lib/padrino-gen/generators/model.rb
|
178
|
+
- lib/padrino-gen/generators/templates/controller.rb.tt
|
179
|
+
- lib/padrino-gen/generators/templates/helper.rb.tt
|
180
|
+
- lib/padrino-gen/generators/templates/mailer.rb.tt
|
181
|
+
- lib/padrino-gen/generators/templates/mailer_initializer.rb.tt
|
182
|
+
- lib/padrino-gen/generators/templates/scripts/jquery.js
|
183
|
+
- lib/padrino-gen/generators/templates/scripts/lowpro.js
|
184
|
+
- lib/padrino-gen/generators/templates/scripts/protopak.js
|
185
|
+
- lib/padrino-gen/generators/templates/scripts/right.js
|
185
186
|
- padrino-gen.gemspec
|
186
187
|
- test/helper.rb
|
188
|
+
- test/test_app_generator.rb
|
187
189
|
- test/test_controller_generator.rb
|
190
|
+
- test/test_generator.rb
|
188
191
|
- test/test_mailer_generator.rb
|
189
192
|
- test/test_migration_generator.rb
|
190
193
|
- test/test_model_generator.rb
|
191
|
-
- test/test_skeleton_generator.rb
|
192
194
|
has_rdoc: true
|
193
195
|
homepage: http://github.com/padrino/padrino-framework/tree/master/padrino-gen
|
194
196
|
licenses: []
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/lib/{generators/skeleton → padrino-gen/generators/app}/app/controllers/.empty_directory
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/lib/{generators/skeleton → padrino-gen/generators/app}/config/initializers/.empty_directory
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/lib/{generators/skeleton → padrino-gen/generators/app}/public/javascripts/.empty_directory
RENAMED
File without changes
|
/data/lib/{generators/skeleton → padrino-gen/generators/app}/public/stylesheets/.empty_directory
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|