scaffoldhub 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/generators/erb/scaffoldhub_generator.rb +1 -1
- data/lib/scaffoldhub.rb +2 -2
- data/lib/scaffoldhub/specification.rb +2 -2
- data/spec/helper_spec.rb +15 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ module Erb
|
|
10
10
|
|
11
11
|
def copy_view_files
|
12
12
|
each_template_file(:view) do |erb_template_file|
|
13
|
-
template erb_template_file.src, File.join("app/views", controller_file_path, erb_template_file.dest)
|
13
|
+
template erb_template_file.src, File.join("app/views", controller_file_path, replace_name_tokens(erb_template_file.dest))
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/scaffoldhub.rb
CHANGED
@@ -75,9 +75,9 @@ module Scaffoldhub
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def adjusted_base_url
|
78
|
-
if base_url =~ /github.com\/(
|
78
|
+
if base_url =~ /github.com\/([^\s]+\/[^\s]+)\/(tree|blob)\/(.*)$/
|
79
79
|
"https://github.com/#{$1}/raw/#{$3}"
|
80
|
-
elsif base_url =~ /github.com\/(
|
80
|
+
elsif base_url =~ /github.com\/([^\s^\/]+\/[^\s^\/]+)\/?$/
|
81
81
|
"https://github.com/#{$1}/raw/master"
|
82
82
|
else
|
83
83
|
base_url
|
data/spec/helper_spec.rb
CHANGED
@@ -136,4 +136,19 @@ describe Scaffoldhub::Helper do
|
|
136
136
|
end
|
137
137
|
|
138
138
|
end
|
139
|
+
|
140
|
+
describe '#replace_name_tokens' do
|
141
|
+
subject { FakeGenerator.new(false) }
|
142
|
+
before do
|
143
|
+
subject.expects(:file_name).returns('person')
|
144
|
+
subject.expects(:file_name).returns(name = mock)
|
145
|
+
name.stubs(:pluralize).returns('people')
|
146
|
+
end
|
147
|
+
it 'should replace the NAME token' do
|
148
|
+
subject.replace_name_tokens('_NAME.html.erb').should == '_person.html.erb'
|
149
|
+
end
|
150
|
+
it 'should replace the PLURAL_NAME token' do
|
151
|
+
subject.replace_name_tokens('PLURAL_NAME.html.erb').should == 'people.html.erb'
|
152
|
+
end
|
153
|
+
end
|
139
154
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffoldhub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 12
|
10
|
+
version: 0.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Shaughnessy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-24 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|