rails3_assist 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/.rspec +1 -0
  4. data/LICENSE +20 -0
  5. data/README.markdown +63 -0
  6. data/Rakefile +21 -0
  7. data/VERSION +1 -0
  8. data/lib/rails3_assist/app/file_names.rb +34 -0
  9. data/lib/rails3_assist/app/methods/crud.rb +31 -0
  10. data/lib/rails3_assist/app/methods/new_content.rb +11 -0
  11. data/lib/rails3_assist/app/rails_dirs.rb +105 -0
  12. data/lib/rails3_assist/app/rails_files.rb +128 -0
  13. data/lib/rails3_assist/app.rb +47 -0
  14. data/lib/rails3_assist/artifact/markers.rb +39 -0
  15. data/lib/rails3_assist/artifact/migration.rb +24 -0
  16. data/lib/rails3_assist/artifact/orm.rb +136 -0
  17. data/lib/rails3_assist/artifact/view.rb +67 -0
  18. data/lib/rails3_assist/base/class_methods.rb +11 -0
  19. data/lib/rails3_assist/base/create.rb +48 -0
  20. data/lib/rails3_assist/base/file_name.rb +17 -0
  21. data/lib/rails3_assist/base/insert.rb +53 -0
  22. data/lib/rails3_assist/base/read.rb +19 -0
  23. data/lib/rails3_assist/base/remove.rb +14 -0
  24. data/lib/rails3_assist/base.rb +49 -0
  25. data/lib/rails3_assist/extensions/core_ext.rb +29 -0
  26. data/lib/rails3_assist/rspec/macro.rb +34 -0
  27. data/lib/rails3_assist.rb +21 -0
  28. data/rails3_assist.gemspec +107 -0
  29. data/rails_generator.log +14 -0
  30. data/spec/load_spec.rb +1 -0
  31. data/spec/rails3_assist/app/app_dirs_spec.rb +23 -0
  32. data/spec/rails3_assist/app/app_file_names_spec.rb +0 -0
  33. data/spec/rails3_assist/app/app_files_spec.rb +0 -0
  34. data/spec/rails3_assist/artifact/controller/controller_spec.rb +33 -0
  35. data/spec/rails3_assist/artifact/helper/helper_spec.rb +33 -0
  36. data/spec/rails3_assist/artifact/mailer/mailer_spec.rb +33 -0
  37. data/spec/rails3_assist/artifact/migration/migration_spec.rb +34 -0
  38. data/spec/rails3_assist/artifact/model/model_spec.rb +34 -0
  39. data/spec/rails3_assist/artifact/observer/observer_spec.rb +34 -0
  40. data/spec/rails3_assist/artifact/orm/active_record_spec.rb +33 -0
  41. data/spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb +63 -0
  42. data/spec/rails3_assist/artifact/orm/mongoid_spec.rb +63 -0
  43. data/spec/rails3_assist/artifact/view_spec/view_spec.rb +32 -0
  44. data/spec/spec_helper.rb +43 -0
  45. metadata +168 -0
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'model without orm' do
4
+ use_orm :none
5
+
6
+ before :each do
7
+ remove_model :account
8
+ create_model :account do
9
+ %q{def index
10
+ end}
11
+ end
12
+ end
13
+
14
+ after :each do
15
+ # remove_model :account
16
+ end
17
+
18
+ it "should have an account_model file that contains an index method and two inserted comments" do
19
+ insert_into_model :account, :content => '# hello'
20
+ insert_into_model :account do
21
+ '# goodbye'
22
+ end
23
+ puts read_model(:account)
24
+ read_model(:account).should have_comment 'hello'
25
+
26
+
27
+ # root_dir.should have_model :account do |model_file|
28
+ # model_file.should have_method :index
29
+ # model_file.should have_comment 'hello'
30
+ # model_file.should have_comment 'goodbye'
31
+ # end
32
+ end
33
+ end
34
+
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'observer' do
4
+ use_helpers :app, :observer
5
+
6
+ before :each do
7
+ remove_observer :account
8
+ create_observer :account do
9
+ %q{
10
+ def index
11
+ end
12
+ }
13
+ end
14
+ end
15
+
16
+ after :each do
17
+ # remove_observer :account
18
+ end
19
+
20
+ it "should have an account_observer file that contains an index method and two inserted comments" do
21
+ insert_into_observer :account, :content => '# hello'
22
+ insert_into_observer :account do
23
+ '# goodbye'
24
+ end
25
+ read_observer(:account).should have_comment 'hello'
26
+ puts read_observer(:account)
27
+
28
+ # root_dir.should have_observer :account do |observer_file|
29
+ # observer_file.should have_method :index
30
+ # observer_file.should have_comment 'hello'
31
+ # observer_file.should have_comment 'goodbye'
32
+ # end
33
+ end
34
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'model with active_record' do
4
+ use_orm :active_record
5
+
6
+ before :each do
7
+ remove_model :account
8
+ create_model :account do
9
+ %q{def index
10
+ end}
11
+ end
12
+ end
13
+
14
+ after :each do
15
+ # remove_model :account
16
+ end
17
+
18
+ it "should have an account_model file that contains an index method and two inserted comments" do
19
+ insert_into_model :account, :content => '# hello'
20
+ insert_into_model :account do
21
+ '# goodbye'
22
+ end
23
+ puts read_model(:account)
24
+ read_model(:account).should have_comment 'hello'
25
+
26
+ # root_dir.should have_model :account do |model_file|
27
+ # model_file.should have_method :index
28
+ # model_file.should have_comment 'hello'
29
+ # model_file.should have_comment 'goodbye'
30
+ # end
31
+ end
32
+ end
33
+
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'model with Mongo Mapper' do
4
+ use_orm :mongo_mapper
5
+
6
+ before :each do
7
+ remove_model :account
8
+ create_model :account do
9
+ %q{ def index
10
+ end}
11
+ end
12
+ end
13
+
14
+ after :each do
15
+ # remove_model :account
16
+ end
17
+
18
+ it "should have an account_model file that contains an index method and two inserted comments" do
19
+ insert_into_model :account, :content => '# hello'
20
+ insert_into_model :account do
21
+ '# goodbye'
22
+ end
23
+ puts read_model(:account)
24
+ read_model(:account).should have_comment 'hello'
25
+
26
+ # root_dir.should have_model :account do |model_file|
27
+ # model_file.should have_method :index
28
+ # model_file.should have_comment 'hello'
29
+ # model_file.should have_comment 'goodbye'
30
+ # end
31
+ end
32
+ end
33
+
34
+ describe 'model with Data Mapper' do
35
+ use_orm :data_mapper
36
+
37
+ before :each do
38
+ remove_model :account
39
+ create_model :account do
40
+ %q{ def index
41
+ end}
42
+ end
43
+ end
44
+
45
+ after :each do
46
+ # remove_model :account
47
+ end
48
+
49
+ it "should have an account_model file that contains an index method and two inserted comments" do
50
+ insert_into_model :account, :content => '# hello'
51
+ insert_into_model :account do
52
+ '# goodbye'
53
+ end
54
+ puts read_model(:account)
55
+ read_model(:account).should have_comment 'hello'
56
+
57
+ # root_dir.should have_model :account do |model_file|
58
+ # model_file.should have_method :index
59
+ # model_file.should have_comment 'hello'
60
+ # model_file.should have_comment 'goodbye'
61
+ # end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'model with Mongoid' do
4
+ use_orm :mongoid
5
+
6
+ before :each do
7
+ remove_model :account
8
+ create_model :account do
9
+ %q{def index
10
+ end}
11
+ end
12
+ end
13
+
14
+ after :each do
15
+ # remove_model :account
16
+ end
17
+
18
+ it "should have an account_model file that contains an index method and two inserted comments" do
19
+ insert_into_model :account, :content => '# hello'
20
+ insert_into_model :account do
21
+ '# goodbye'
22
+ end
23
+ puts read_model(:account)
24
+ read_model(:account).should have_comment 'hello'
25
+
26
+ # root_dir.should have_model :account do |model_file|
27
+ # model_file.should have_method :index
28
+ # model_file.should have_comment 'hello'
29
+ # model_file.should have_comment 'goodbye'
30
+ # end
31
+ end
32
+ end
33
+
34
+ describe 'model with Mongoid - embedded document' do
35
+ use_orm :mongoid
36
+
37
+ before :each do
38
+ remove_model :account
39
+ create_model :account, :model_type => :embedded do
40
+ %q{def index
41
+ end}
42
+ end
43
+ end
44
+
45
+ after :each do
46
+ # remove_model :account
47
+ end
48
+
49
+ it "should have an account_model file that contains an index method and two inserted comments" do
50
+ insert_into_model :account, :content => '# hello'
51
+ insert_into_model :account do
52
+ '# goodbye'
53
+ end
54
+ puts read_model(:account)
55
+ read_model(:account).should have_comment 'hello'
56
+
57
+ # root_dir.should have_model :account do |model_file|
58
+ # model_file.should have_method :index
59
+ # model_file.should have_comment 'hello'
60
+ # model_file.should have_comment 'goodbye'
61
+ # end
62
+ end
63
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'view' do
4
+ use_helpers :app, :view
5
+
6
+ before :each do
7
+ remove_view :account
8
+ create_view :account do
9
+ %q{ def index
10
+ end}
11
+ end
12
+ end
13
+
14
+ after :each do
15
+ # remove_view :account
16
+ end
17
+
18
+ it "should have an account_view file that contains an index method and two inserted comments" do
19
+ insert_into_view :account, :content => '# hello', :before => 'def'
20
+ insert_into_view :account, :before => 'def' do
21
+ '# goodbye'
22
+ end
23
+ puts read_view(:account)
24
+ read_view(:account).should have_comment 'hello'
25
+
26
+ # root_dir.should have_view :account do |view_file|
27
+ # view_file.should have_method :index
28
+ # view_file.should have_comment 'hello'
29
+ # view_file.should have_comment 'goodbye'
30
+ # end
31
+ end
32
+ end
@@ -0,0 +1,43 @@
1
+ require 'rspec'
2
+ require 'rspec/autorun'
3
+ # require 'generator_spec'
4
+ require 'rails3_assist'
5
+ require 'tmpdir'
6
+ require 'file-spec'
7
+ require 'code-spec'
8
+ # require 'rails3_app_spec'
9
+
10
+ # RSpec::Generator.configure do |config|
11
+ # config.debug = false
12
+ # config.remove_temp_dir = false #true
13
+ # config.default_rails_root(__FILE__)
14
+ # config.lib = File.dirname(__FILE__) + '/../lib'
15
+ # config.logger = :stdout
16
+ # end
17
+ #
18
+
19
+ def project_dir
20
+ File.dirname(__FILE__) + '/..'
21
+ end
22
+
23
+ def temp_dir name
24
+ File.join(project_dir, name)
25
+ end
26
+
27
+ def make_temp_dir name
28
+ FileUtils.mkdir_p temp_dir(name)
29
+ temp_dir(name)
30
+ end
31
+
32
+ def remove_temp_dir name
33
+ FileUtils.rm_rf temp_dir(name)
34
+ end
35
+
36
+ Rails::Assist::App.rails_root_dir = temp_dir('tmp_rails')
37
+
38
+ RSpec.configure do |config|
39
+ config.after do
40
+ remove_temp_dir 'tmp_rails'
41
+ end
42
+ end
43
+
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails3_assist
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 2
9
+ version: 0.2.2
10
+ platform: ruby
11
+ authors:
12
+ - Kristian Mandrup
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-08-19 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 0
31
+ - 0
32
+ - beta
33
+ - 19
34
+ version: 2.0.0.beta.19
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: require_all
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 1
47
+ - 1
48
+ - 0
49
+ version: 1.1.0
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: migration_assist
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
62
+ - 1
63
+ - 2
64
+ version: 0.1.2
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ description: Assist in operating on Rails 3 artifacts including migrations
68
+ email: kmandrup@gmail.com
69
+ executables: []
70
+
71
+ extensions: []
72
+
73
+ extra_rdoc_files:
74
+ - LICENSE
75
+ - README.markdown
76
+ files:
77
+ - .document
78
+ - .gitignore
79
+ - .rspec
80
+ - LICENSE
81
+ - README.markdown
82
+ - Rakefile
83
+ - VERSION
84
+ - lib/rails3_assist.rb
85
+ - lib/rails3_assist/app.rb
86
+ - lib/rails3_assist/app/file_names.rb
87
+ - lib/rails3_assist/app/methods/crud.rb
88
+ - lib/rails3_assist/app/methods/new_content.rb
89
+ - lib/rails3_assist/app/rails_dirs.rb
90
+ - lib/rails3_assist/app/rails_files.rb
91
+ - lib/rails3_assist/artifact/markers.rb
92
+ - lib/rails3_assist/artifact/migration.rb
93
+ - lib/rails3_assist/artifact/orm.rb
94
+ - lib/rails3_assist/artifact/view.rb
95
+ - lib/rails3_assist/base.rb
96
+ - lib/rails3_assist/base/class_methods.rb
97
+ - lib/rails3_assist/base/create.rb
98
+ - lib/rails3_assist/base/file_name.rb
99
+ - lib/rails3_assist/base/insert.rb
100
+ - lib/rails3_assist/base/read.rb
101
+ - lib/rails3_assist/base/remove.rb
102
+ - lib/rails3_assist/extensions/core_ext.rb
103
+ - lib/rails3_assist/rspec/macro.rb
104
+ - rails3_assist.gemspec
105
+ - rails_generator.log
106
+ - spec/load_spec.rb
107
+ - spec/rails3_assist/app/app_dirs_spec.rb
108
+ - spec/rails3_assist/app/app_file_names_spec.rb
109
+ - spec/rails3_assist/app/app_files_spec.rb
110
+ - spec/rails3_assist/artifact/controller/controller_spec.rb
111
+ - spec/rails3_assist/artifact/helper/helper_spec.rb
112
+ - spec/rails3_assist/artifact/mailer/mailer_spec.rb
113
+ - spec/rails3_assist/artifact/migration/migration_spec.rb
114
+ - spec/rails3_assist/artifact/model/model_spec.rb
115
+ - spec/rails3_assist/artifact/observer/observer_spec.rb
116
+ - spec/rails3_assist/artifact/orm/active_record_spec.rb
117
+ - spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb
118
+ - spec/rails3_assist/artifact/orm/mongoid_spec.rb
119
+ - spec/rails3_assist/artifact/view_spec/view_spec.rb
120
+ - spec/spec_helper.rb
121
+ has_rdoc: true
122
+ homepage: http://github.com/kristianmandrup/rails3-assist
123
+ licenses: []
124
+
125
+ post_install_message:
126
+ rdoc_options:
127
+ - --charset=UTF-8
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ segments:
144
+ - 0
145
+ version: "0"
146
+ requirements: []
147
+
148
+ rubyforge_project:
149
+ rubygems_version: 1.3.7
150
+ signing_key:
151
+ specification_version: 3
152
+ summary: Assist in operating on Rails 3 artifacts including migrations
153
+ test_files:
154
+ - spec/load_spec.rb
155
+ - spec/rails3_assist/app/app_dirs_spec.rb
156
+ - spec/rails3_assist/app/app_file_names_spec.rb
157
+ - spec/rails3_assist/app/app_files_spec.rb
158
+ - spec/rails3_assist/artifact/controller/controller_spec.rb
159
+ - spec/rails3_assist/artifact/helper/helper_spec.rb
160
+ - spec/rails3_assist/artifact/mailer/mailer_spec.rb
161
+ - spec/rails3_assist/artifact/migration/migration_spec.rb
162
+ - spec/rails3_assist/artifact/model/model_spec.rb
163
+ - spec/rails3_assist/artifact/observer/observer_spec.rb
164
+ - spec/rails3_assist/artifact/orm/active_record_spec.rb
165
+ - spec/rails3_assist/artifact/orm/mongo_mapper_spec.rb
166
+ - spec/rails3_assist/artifact/orm/mongoid_spec.rb
167
+ - spec/rails3_assist/artifact/view_spec/view_spec.rb
168
+ - spec/spec_helper.rb