rails3_assist 0.3.4 → 0.3.5
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.
- data/VERSION +1 -1
- data/lib/rails3_assist/artifact.rb +1 -1
- data/lib/rails3_assist/artifact/files.rb +2 -2
- data/rails3_assist.gemspec +6 -2
- data/spec/fixtures/Gemfile +3 -0
- data/spec/fixtures/app/licenses/blogging_license.rb +0 -0
- data/spec/fixtures/app/validators/email_validator.rb +0 -0
- data/spec/rails3_assist/artifact/files_spec.rb +18 -4
- data/spec/rails3_assist/file/special_spec.rb +40 -36
- metadata +7 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
@@ -14,7 +14,7 @@ module Rails3::Assist::Artifact
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# artifact files using xxx_[artifact].rb convention, i.e postfixing with type of artifact
|
17
|
-
[:mailer, :observer, :permit, :controller, :helper].each do |name|
|
17
|
+
[:mailer, :observer, :permit, :license, :controller, :helper, :validator].each do |name|
|
18
18
|
class_eval %{
|
19
19
|
def #{name}_files expr=nil
|
20
20
|
files = Rails3::Assist::Files.rails_app_files(:#{name.to_s.pluralize}, :pattern => '**/*_#{name}.rb').grep_it expr
|
@@ -34,7 +34,7 @@ module Rails3::Assist::Artifact
|
|
34
34
|
end
|
35
35
|
|
36
36
|
|
37
|
-
[:erb, :haml].each do |name|
|
37
|
+
[:erb, :haml, :slim].each do |name|
|
38
38
|
class_eval %{
|
39
39
|
def #{name}_view_files *args
|
40
40
|
view_files args, :template_language => :#{name}
|
data/rails3_assist.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails3_assist}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-24}
|
13
13
|
s.description = %q{Basic file operation helpers for working with Rails 3 artifacts}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -53,10 +53,12 @@ Gem::Specification.new do |s|
|
|
53
53
|
"spec/fixtures/app/controllers/users_controller.rb",
|
54
54
|
"spec/fixtures/app/helpers/application_helper.rb",
|
55
55
|
"spec/fixtures/app/helpers/users_helper.rb",
|
56
|
+
"spec/fixtures/app/licenses/blogging_license.rb",
|
56
57
|
"spec/fixtures/app/mailers/user_mailer.rb",
|
57
58
|
"spec/fixtures/app/models/user.rb",
|
58
59
|
"spec/fixtures/app/models/user_observer.rb",
|
59
60
|
"spec/fixtures/app/permits/user_permit.rb",
|
61
|
+
"spec/fixtures/app/validators/email_validator.rb",
|
60
62
|
"spec/fixtures/app/views/layouts/application.html.erb",
|
61
63
|
"spec/fixtures/app/views/users/_form.html.erb",
|
62
64
|
"spec/fixtures/app/views/users/edit.html.erb",
|
@@ -137,10 +139,12 @@ Gem::Specification.new do |s|
|
|
137
139
|
"spec/fixtures/app/controllers/users_controller.rb",
|
138
140
|
"spec/fixtures/app/helpers/application_helper.rb",
|
139
141
|
"spec/fixtures/app/helpers/users_helper.rb",
|
142
|
+
"spec/fixtures/app/licenses/blogging_license.rb",
|
140
143
|
"spec/fixtures/app/mailers/user_mailer.rb",
|
141
144
|
"spec/fixtures/app/models/user.rb",
|
142
145
|
"spec/fixtures/app/models/user_observer.rb",
|
143
146
|
"spec/fixtures/app/permits/user_permit.rb",
|
147
|
+
"spec/fixtures/app/validators/email_validator.rb",
|
144
148
|
"spec/fixtures/config/application.rb",
|
145
149
|
"spec/fixtures/config/boot.rb",
|
146
150
|
"spec/fixtures/config/environment.rb",
|
data/spec/fixtures/Gemfile
CHANGED
File without changes
|
File without changes
|
@@ -8,7 +8,9 @@ class ArtDir
|
|
8
8
|
end
|
9
9
|
|
10
10
|
describe Rails3::Assist::Artifact::Files do
|
11
|
-
|
11
|
+
extend Rails3::Assist::UseMacro
|
12
|
+
|
13
|
+
use_helpers :directory
|
12
14
|
|
13
15
|
before do
|
14
16
|
Rails3::Assist::Directory.rails_root = fixtures_dir
|
@@ -23,19 +25,31 @@ describe Rails3::Assist::Artifact::Files do
|
|
23
25
|
|
24
26
|
describe '#mailer_files' do
|
25
27
|
it "should return :mailer files" do
|
26
|
-
|
28
|
+
@test.mailer_files.file_names.should include 'user_mailer.rb'
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
32
|
describe '#observer_files' do
|
31
33
|
it "should return :observer files" do
|
32
|
-
|
34
|
+
@test.observer_files.file_names.should include 'user_observer.rb'
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
38
|
describe '#permit_files' do
|
37
39
|
it "should return :permit files" do
|
38
|
-
|
40
|
+
@test.permit_files.file_names.should include 'user_permit.rb'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#license_files' do
|
45
|
+
it "should return :license files" do
|
46
|
+
@test.license_files.file_names.should include 'blogging_license.rb'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#validator_files' do
|
51
|
+
it "should return :validator files" do
|
52
|
+
@test.validator_files.file_names.should include 'email_validator.rb'
|
39
53
|
end
|
40
54
|
end
|
41
55
|
|
@@ -7,6 +7,26 @@ class AppDir
|
|
7
7
|
use_helper :special
|
8
8
|
end
|
9
9
|
|
10
|
+
def test_routes_file &block
|
11
|
+
old_content = AppDir.new.read_routes_file
|
12
|
+
|
13
|
+
yield if block
|
14
|
+
|
15
|
+
File.overwrite CLASS.routes_file do
|
16
|
+
old_content
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_gem_file &block
|
21
|
+
old_content = AppDir.new.read_gem_file
|
22
|
+
|
23
|
+
yield if block
|
24
|
+
|
25
|
+
File.overwrite CLASS.gem_file do
|
26
|
+
old_content
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
10
30
|
describe Rails3::Assist::File::Special do
|
11
31
|
before do
|
12
32
|
Rails3::Assist::Directory.rails_root = fixtures_dir
|
@@ -63,18 +83,14 @@ describe Rails3::Assist::File::Special do
|
|
63
83
|
end
|
64
84
|
end
|
65
85
|
|
86
|
+
# create test_routes macro
|
87
|
+
|
66
88
|
describe '#insert_into_routes' do
|
67
89
|
it 'should insert into block of Routes file' do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
CLASS.insert_into_routes routes_stmt
|
73
|
-
|
74
|
-
AppDir.new.read_routes_file.should match /do\s*#{Regexp.escape(routes_stmt)}\s*/
|
75
|
-
|
76
|
-
File.overwrite CLASS.routes_file do
|
77
|
-
old_routes_content
|
90
|
+
test_routes_file do
|
91
|
+
routes_stmt = 'devise_for :users'
|
92
|
+
CLASS.insert_into_routes routes_stmt
|
93
|
+
AppDir.new.read_routes_file.should match /do\s*#{Regexp.escape(routes_stmt)}\s*/
|
78
94
|
end
|
79
95
|
end
|
80
96
|
end
|
@@ -97,38 +113,26 @@ describe Rails3::Assist::File::Special do
|
|
97
113
|
|
98
114
|
describe '#clean_gemfile' do
|
99
115
|
it 'should be true that it has cleaned the Gemfile ensuring newlines between each gem' do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
AppDir.new.clean_gemfile
|
107
|
-
|
108
|
-
expected = "gem 'hello'\ngem 'hi'"
|
109
|
-
|
110
|
-
AppDir.new.read_gem_file.should match /#{Regexp.escape(expected)}/
|
116
|
+
test_gem_file do
|
117
|
+
CLASS.append_to_gem_file do
|
118
|
+
"gem 'hello'gem 'hi'gem 'blip'"
|
119
|
+
end
|
111
120
|
|
112
|
-
|
113
|
-
|
121
|
+
AppDir.new.clean_gemfile
|
122
|
+
expected = "gem 'hello'\ngem 'hi'"
|
123
|
+
AppDir.new.read_gem_file.should match /#{Regexp.escape(expected)}/
|
114
124
|
end
|
115
125
|
end
|
116
126
|
|
117
127
|
it 'should be true that it has cleaned the Gemfile ensuring newlines between each gem and after end' do
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
123
|
-
|
124
|
-
AppDir.new.clean_gemfile
|
125
|
-
|
126
|
-
expected = "group :dev end\ngem 'hi'"
|
127
|
-
|
128
|
-
AppDir.new.read_gem_file.should match /#{Regexp.escape(expected)}/
|
128
|
+
test_gem_file do
|
129
|
+
CLASS.append_to_gem_file do
|
130
|
+
"group :dev endgem 'hi'gem 'blip'"
|
131
|
+
end
|
129
132
|
|
130
|
-
|
131
|
-
|
133
|
+
AppDir.new.clean_gemfile
|
134
|
+
expected = "group :dev end\ngem 'hi'"
|
135
|
+
AppDir.new.read_gem_file.should match /#{Regexp.escape(expected)}/
|
132
136
|
end
|
133
137
|
end
|
134
138
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 5
|
9
|
+
version: 0.3.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-24 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -167,10 +167,12 @@ files:
|
|
167
167
|
- spec/fixtures/app/controllers/users_controller.rb
|
168
168
|
- spec/fixtures/app/helpers/application_helper.rb
|
169
169
|
- spec/fixtures/app/helpers/users_helper.rb
|
170
|
+
- spec/fixtures/app/licenses/blogging_license.rb
|
170
171
|
- spec/fixtures/app/mailers/user_mailer.rb
|
171
172
|
- spec/fixtures/app/models/user.rb
|
172
173
|
- spec/fixtures/app/models/user_observer.rb
|
173
174
|
- spec/fixtures/app/permits/user_permit.rb
|
175
|
+
- spec/fixtures/app/validators/email_validator.rb
|
174
176
|
- spec/fixtures/app/views/layouts/application.html.erb
|
175
177
|
- spec/fixtures/app/views/users/_form.html.erb
|
176
178
|
- spec/fixtures/app/views/users/edit.html.erb
|
@@ -278,10 +280,12 @@ test_files:
|
|
278
280
|
- spec/fixtures/app/controllers/users_controller.rb
|
279
281
|
- spec/fixtures/app/helpers/application_helper.rb
|
280
282
|
- spec/fixtures/app/helpers/users_helper.rb
|
283
|
+
- spec/fixtures/app/licenses/blogging_license.rb
|
281
284
|
- spec/fixtures/app/mailers/user_mailer.rb
|
282
285
|
- spec/fixtures/app/models/user.rb
|
283
286
|
- spec/fixtures/app/models/user_observer.rb
|
284
287
|
- spec/fixtures/app/permits/user_permit.rb
|
288
|
+
- spec/fixtures/app/validators/email_validator.rb
|
285
289
|
- spec/fixtures/config/application.rb
|
286
290
|
- spec/fixtures/config/boot.rb
|
287
291
|
- spec/fixtures/config/environment.rb
|