deface 0.8.0 → 0.9.0
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/.travis.yml +3 -1
- data/README.markdown +118 -32
- data/deface.gemspec +2 -2
- data/gemfiles/rails3_1.gemfile +5 -0
- data/gemfiles/rails3_2.gemfile +5 -0
- data/lib/deface.rb +7 -0
- data/lib/deface/action_view_extensions.rb +19 -9
- data/lib/deface/applicator.rb +62 -12
- data/lib/deface/dsl/context.rb +67 -0
- data/lib/deface/dsl/loader.rb +125 -0
- data/lib/deface/environment.rb +22 -11
- data/lib/deface/haml_converter.rb +23 -11
- data/lib/deface/override.rb +78 -65
- data/lib/deface/railtie.rb +4 -0
- data/lib/deface/search.rb +10 -0
- data/spec/assets/dummy_app/overrides/posts/index/app_override.html.erb.deface +2 -0
- data/spec/assets/dummy_engine/overrides/users/index/engine_override.html.erb.deface +2 -0
- data/spec/deface/action_view_template_spec.rb +16 -0
- data/spec/deface/applicator_spec.rb +79 -0
- data/spec/deface/dsl/context_spec.rb +149 -0
- data/spec/deface/dsl/loader_spec.rb +197 -0
- data/spec/deface/environment_spec.rb +39 -9
- data/spec/deface/haml_converter_spec.rb +27 -0
- data/spec/deface/override_spec.rb +140 -16
- data/spec/deface/search_spec.rb +41 -0
- data/spec/spec_helper.rb +13 -0
- data/tasks/utils.rake +1 -1
- metadata +86 -87
@@ -36,6 +36,8 @@ module Deface
|
|
36
36
|
Rails.application.stub :root => Pathname.new(File.join(File.dirname(__FILE__), '..', "assets"))
|
37
37
|
Rails.application.stub :paths => {}
|
38
38
|
Rails.application.stub_chain :railties, :all => []
|
39
|
+
|
40
|
+
Deface::DSL::Loader.should_receive(:register)
|
39
41
|
end
|
40
42
|
|
41
43
|
it "should enumerate_and_load nil when app has no app/overrides path set" do
|
@@ -57,7 +59,7 @@ module Deface
|
|
57
59
|
Rails.application.config.deface.overrides.load_all(Rails.application)
|
58
60
|
end
|
59
61
|
|
60
|
-
it "should enumerate_and_load path when railtie has
|
62
|
+
it "should enumerate_and_load path when railtie has app/overrides path set" do
|
61
63
|
Rails.application.stub_chain :railties, :all => [ mock('railtie', :root => "/some/path", :paths => {"app/overrides" => ["app/some_path"] } )]
|
62
64
|
|
63
65
|
Rails.application.config.deface.overrides.should_receive(:enumerate_and_load).with(nil, Rails.application.root)
|
@@ -65,6 +67,14 @@ module Deface
|
|
65
67
|
Rails.application.config.deface.overrides.load_all(Rails.application)
|
66
68
|
end
|
67
69
|
|
70
|
+
it "should enumerate_and_load railties first, followed by the application iteslf" do
|
71
|
+
Rails.application.stub_chain :railties, :all => [ mock('railtie', :root => "/some/path", :paths => {"app/overrides" => ["app/some_path"] } )]
|
72
|
+
|
73
|
+
Rails.application.config.deface.overrides.should_receive(:enumerate_and_load).with(["app/some_path"] , "/some/path").ordered
|
74
|
+
Rails.application.config.deface.overrides.should_receive(:enumerate_and_load).with(nil, Rails.application.root).ordered
|
75
|
+
Rails.application.config.deface.overrides.load_all(Rails.application)
|
76
|
+
end
|
77
|
+
|
68
78
|
it "should ignore railtie with no root" do
|
69
79
|
railtie = mock('railtie')
|
70
80
|
Rails.application.stub_chain :railties, :all => [railtie]
|
@@ -79,25 +89,45 @@ module Deface
|
|
79
89
|
Rails.application.config.deface.overrides.load_all(Rails.application)
|
80
90
|
end
|
81
91
|
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
describe 'load_overrides' do
|
96
|
+
let(:assets_path) { Pathname.new(File.join(File.dirname(__FILE__), '..', "assets")) }
|
97
|
+
let(:engine) { mock('railtie', :root => assets_path, :paths => {"app/overrides" => ["dummy_engine"]}) }
|
98
|
+
|
99
|
+
it "should keep a reference to which railtie/app defined the override" do
|
100
|
+
Rails.application.stub :root => assets_path, :paths => {"app/overrides" => ["dummy_app"] }
|
101
|
+
Rails.application.stub_chain :railties, :all => [ engine ]
|
102
|
+
|
103
|
+
Rails.application.config.deface.overrides.load_all(Rails.application)
|
104
|
+
|
105
|
+
Deface::Override.all.values.map(&:values).flatten.map(&:railtie).should include(Rails.application, engine)
|
106
|
+
end
|
82
107
|
end
|
83
108
|
|
84
109
|
describe "enumerate_and_load" do
|
85
110
|
let(:root) { Pathname.new("/some/path") }
|
86
111
|
|
87
112
|
it "should be enumerate default path when none supplied" do
|
88
|
-
Dir.should_receive(:glob).with(root.join "app/overrides", "*.rb")
|
113
|
+
Dir.should_receive(:glob).with(root.join "app/overrides", "**", "*.rb")
|
114
|
+
Dir.should_receive(:glob).with(root.join "app/overrides", "**", "*.deface")
|
89
115
|
Rails.application.config.deface.overrides.send(:enumerate_and_load, nil, root)
|
90
116
|
end
|
91
117
|
|
92
|
-
it "should
|
93
|
-
Dir.should_receive(:glob).with(root.join "app/junk", "*.rb")
|
94
|
-
|
118
|
+
it "should enumerate supplied paths" do
|
119
|
+
Dir.should_receive(:glob).with(root.join "app/junk", "**", "*.rb" )
|
120
|
+
Dir.should_receive(:glob).with(root.join "app/junk", "**", "*.deface" )
|
121
|
+
Dir.should_receive(:glob).with(root.join "app/gold", "**", "*.rb" )
|
122
|
+
Dir.should_receive(:glob).with(root.join "app/gold", "**", "*.deface" )
|
123
|
+
Rails.application.config.deface.overrides.send(:enumerate_and_load, ["app/junk", "app/gold"], root)
|
95
124
|
end
|
96
125
|
|
97
|
-
it "should
|
98
|
-
|
99
|
-
|
100
|
-
|
126
|
+
it "should add paths to watchable_dir when running Rails 3.2" do
|
127
|
+
if Rails.version[0..2] == '3.2'
|
128
|
+
Rails.application.config.deface.overrides.send(:enumerate_and_load, ["app/gold"], root)
|
129
|
+
Rails.application.config.watchable_dirs.should == {"/some/path/app/gold" => [:rb, :deface] }
|
130
|
+
end
|
101
131
|
end
|
102
132
|
|
103
133
|
end
|
@@ -23,6 +23,33 @@ module Deface
|
|
23
23
|
= render :partial => "sidebar"}).should == "<div id='content'> <div class='left column'> <h2>Welcome to our site!</h2> <p> <%= print_information %></p> </div> <div class='right column'> <%= render :partial => \"sidebar\" %> </div></div>"
|
24
24
|
end
|
25
25
|
|
26
|
+
it "should handle simple haml attributes" do
|
27
|
+
haml_to_erb("%meta{:charset => 'utf-8'}").should == "<meta charset='utf-8' />"
|
28
|
+
haml_to_erb("%p(alt='hello world')Hello World!").should == "<p alt='hello world'>Hello World!</p>"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should handle haml attributes with commas" do
|
32
|
+
haml_to_erb("%meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1'}").should == "<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible' />"
|
33
|
+
haml_to_erb("%meta(http-equiv='X-UA-Compatible' content='IE=edge,chrome=1')").should == "<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible' />"
|
34
|
+
haml_to_erb('%meta{:name => "author", :content => "Example, Inc."}').should == "<meta content='Example, Inc.' name='author' />"
|
35
|
+
haml_to_erb('%meta(name="author" content="Example, Inc.")').should == "<meta content='Example, Inc.' name='author' />"
|
36
|
+
|
37
|
+
if RUBY_VERSION > "1.9"
|
38
|
+
haml_to_erb('%meta{name: "author", content: "Example, Inc."}').should == "<meta content='Example, Inc.' name='author' />"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should handle haml attributes with evaluated values" do
|
43
|
+
haml_to_erb("%p{ :alt => hello_world}Hello World!").should == "<p data-erb-alt='<%= hello_world %>'>Hello World!</p>"
|
44
|
+
|
45
|
+
if RUBY_VERSION > "1.9"
|
46
|
+
haml_to_erb("%p{ alt: @hello_world}Hello World!").should == "<p data-erb-alt='<%= @hello_world %>'>Hello World!</p>"
|
47
|
+
end
|
48
|
+
|
49
|
+
haml_to_erb("%p(alt=hello_world)Hello World!").should == "<p data-erb-alt='<%= hello_world %>'>Hello World!</p>"
|
50
|
+
haml_to_erb("%p(alt=@hello_world)Hello World!").should == "<p data-erb-alt='<%= @hello_world %>'>Hello World!</p>"
|
51
|
+
end
|
52
|
+
|
26
53
|
it "should handle erb loud" do
|
27
54
|
haml_to_erb("%h3.title= entry.title").should == "<h3 class='title'><%= entry.title %></h3>"
|
28
55
|
end
|
@@ -16,10 +16,18 @@ module Deface
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should have a sources method" do
|
20
|
+
Deface::Override.sources.should include(:text)
|
21
|
+
end
|
22
|
+
|
19
23
|
it "should return correct selector" do
|
20
24
|
@override.selector.should == "h1"
|
21
25
|
end
|
22
26
|
|
27
|
+
it "should set default :updated_at" do
|
28
|
+
@override.args[:updated_at].should_not be_nil
|
29
|
+
end
|
30
|
+
|
23
31
|
describe "#original_source" do
|
24
32
|
it "should return nil with not specified" do
|
25
33
|
@override.original_source.should be_nil
|
@@ -59,18 +67,6 @@ module Deface
|
|
59
67
|
end
|
60
68
|
end
|
61
69
|
|
62
|
-
describe "#find" do
|
63
|
-
it "should find by virtual_path" do
|
64
|
-
Deface::Override.find({:virtual_path => "posts/index"}).size.should == 1
|
65
|
-
Deface::Override.find({:virtual_path => "/posts/index"}).size.should == 1
|
66
|
-
Deface::Override.find({:virtual_path => "/posts/index.html"}).size.should == 1
|
67
|
-
Deface::Override.find({:virtual_path => "posts/index.html"}).size.should == 1
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should return empty array when no details hash passed" do
|
71
|
-
Deface::Override.find({}).should == []
|
72
|
-
end
|
73
|
-
end
|
74
70
|
|
75
71
|
describe "#new" do
|
76
72
|
|
@@ -89,17 +85,21 @@ module Deface
|
|
89
85
|
|
90
86
|
it "should return un-convert text as source" do
|
91
87
|
@override.source.should == "<h1 id=\"<%= dom_id @pirate %>\">Argh!</h1>"
|
88
|
+
|
89
|
+
@override.source_argument.should == :text
|
92
90
|
end
|
93
91
|
end
|
94
92
|
|
95
93
|
describe "with :erb" do
|
96
94
|
|
97
95
|
before(:each) do
|
98
|
-
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :
|
96
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :erb => "<h1 id=\"<%= dom_id @pirate %>\">Argh!</h1>")
|
99
97
|
end
|
100
98
|
|
101
99
|
it "should return un-convert text as source" do
|
102
100
|
@override.source.should == "<h1 id=\"<%= dom_id @pirate %>\">Argh!</h1>"
|
101
|
+
|
102
|
+
@override.source_argument.should == :erb
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -112,6 +112,8 @@ module Deface
|
|
112
112
|
|
113
113
|
it "should return erb converted from haml as source" do
|
114
114
|
@override.source.should == "<strong class='code' id='message'><%= 'Hello, World!' %>\n</strong>\n"
|
115
|
+
|
116
|
+
@override.source_argument.should == :haml
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
@@ -127,6 +129,8 @@ module Deface
|
|
127
129
|
|
128
130
|
it "should return un-convert partial contents as source" do
|
129
131
|
@override.source.should == "<p>I'm from shared/post partial</p>\n<%= \"And I've got ERB\" %>\n"
|
132
|
+
|
133
|
+
@override.source_argument.should == :partial
|
130
134
|
end
|
131
135
|
|
132
136
|
end
|
@@ -142,8 +146,111 @@ module Deface
|
|
142
146
|
|
143
147
|
it "should return un-convert template contents as source" do
|
144
148
|
@override.source.should == "<p>I'm from shared/person template</p>\n<%= \"I've got ERB too\" %>\n"
|
149
|
+
|
150
|
+
@override.source_argument.should == :template
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
describe "with :copy" do
|
156
|
+
|
157
|
+
let(:parsed) { Deface::Parser.convert("<div><h1>Manage Posts</h1><%= some_method %></div>") }
|
158
|
+
|
159
|
+
before(:each) do
|
160
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "h1", :copy => "h1")
|
161
|
+
@override.stub(:parsed_document).and_return(parsed)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should not change original parsed source" do
|
165
|
+
@override.source
|
166
|
+
parsed.to_s.gsub(/\n/,'').should == "<div><h1>Manage Posts</h1><code erb-loud> some_method </code></div>"
|
167
|
+
|
168
|
+
@override.source_argument.should == :copy
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should return copy of content from source document" do
|
172
|
+
@override.source.should == "<h1>Manage Posts</h1>\n"
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should return unescaped content for source document" do
|
176
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "h1", :copy => "code[erb-loud]:contains('some_method')")
|
177
|
+
@override.stub(:parsed_document).and_return(parsed)
|
178
|
+
@override.source.should == "<%= some_method %>"
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
describe "with :copy using :start and :end" do
|
184
|
+
|
185
|
+
let(:parsed) { Deface::Parser.convert("<h1>World</h1><% if true %><p>True that!</p><% end %><p>Hello</p>") }
|
186
|
+
|
187
|
+
before(:each) do
|
188
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "h1",
|
189
|
+
:copy => {:start => "code:contains('if true')", :end => "code:contains('end')"})
|
190
|
+
|
191
|
+
@override.stub(:parsed_document).and_return(parsed)
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should not change original parsed source" do
|
195
|
+
@override.source
|
196
|
+
parsed.to_s.gsub(/\n/,'').should == "<h1>World</h1><code erb-silent> if true </code><p>True that!</p><code erb-silent> end </code><p>Hello</p>"
|
197
|
+
|
198
|
+
@override.source_argument.should == :copy
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should return copy of content from source document" do
|
202
|
+
@override.source.should == "<% if true %><p>True that!</p><% end %>"
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe "with :cut" do
|
207
|
+
let(:parsed) { Deface::Parser.convert("<div><h1>Manage Posts</h1><%= some_method %></div>") }
|
208
|
+
before(:each) do
|
209
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "h1", :cut => "h1")
|
210
|
+
@override.stub(:parsed_document).and_return(parsed)
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should remove cut element from original parsed source" do
|
214
|
+
@override.source
|
215
|
+
parsed.to_s.gsub(/\n/,'').should == "<div><code erb-loud> some_method </code></div>"
|
216
|
+
|
217
|
+
@override.source_argument.should == :cut
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should remove and return content from source document" do
|
221
|
+
@override.source.should == "<h1>Manage Posts</h1>"
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should return unescaped content for source document" do
|
225
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "h1", :cut => "code[erb-loud]:contains('some_method')")
|
226
|
+
@override.stub(:parsed_document).and_return(parsed)
|
227
|
+
@override.source.should == "<%= some_method %>"
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
|
233
|
+
describe "with :cut using :start and :end" do
|
234
|
+
|
235
|
+
let(:parsed) { Deface::Parser.convert("<h1>World</h1><% if true %><p>True that!</p><% end %><%= hello %>") }
|
236
|
+
|
237
|
+
before(:each) do
|
238
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :insert_after => "h1",
|
239
|
+
:cut => {:start => "code:contains('if true')", :end => "code:contains('end')"})
|
240
|
+
|
241
|
+
@override.stub(:parsed_document).and_return(parsed)
|
242
|
+
end
|
243
|
+
|
244
|
+
it "should remove cut element from original parsed source" do
|
245
|
+
@override.source
|
246
|
+
parsed.to_s.gsub(/\n/,'').should == "<h1>World</h1><code erb-loud> hello </code>"
|
247
|
+
|
248
|
+
@override.source_argument.should == :cut
|
145
249
|
end
|
146
250
|
|
251
|
+
it "should return copy of content from source document" do
|
252
|
+
@override.source.should == "<% if true %><p>True that!</p><% end %>"
|
253
|
+
end
|
147
254
|
end
|
148
255
|
|
149
256
|
describe "with block" do
|
@@ -272,14 +379,28 @@ module Deface
|
|
272
379
|
@override.end_selector.should be_nil
|
273
380
|
end
|
274
381
|
|
275
|
-
it "should return
|
382
|
+
it "should return closing_selector is present" do
|
276
383
|
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :closing_selector => "h4", :text => "<h1>Argh!</h1>")
|
277
|
-
@override.end_selector.should == "
|
384
|
+
@override.end_selector.should == "h4"
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
describe "#touch" do
|
389
|
+
it "should change the overrides :updated_at value" do
|
390
|
+
before_touch = @override.args[:updated_at]
|
391
|
+
Time.zone.stub(:now).and_return(Time.parse('2006-08-24'))
|
392
|
+
@override.touch
|
393
|
+
@override.args[:updated_at].should_not == before_touch
|
278
394
|
end
|
279
395
|
end
|
280
396
|
|
281
397
|
describe "#digest" do
|
282
|
-
before
|
398
|
+
before do
|
399
|
+
Deface::Override.all.clear
|
400
|
+
|
401
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :text => "<h1>Argh!</h1>")
|
402
|
+
@digest = @override.digest.clone
|
403
|
+
end
|
283
404
|
|
284
405
|
it "should return hex digest based on override's args" do
|
285
406
|
@override.digest.should =~ /[a-f0-9]{32}/
|
@@ -299,6 +420,9 @@ module Deface
|
|
299
420
|
|
300
421
|
describe "self#digest" do
|
301
422
|
before do
|
423
|
+
Deface::Override.all.clear
|
424
|
+
|
425
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1", :text => "<h1>Argh!</h1>")
|
302
426
|
@second = Deface::Override.new(:virtual_path => "posts/index", :name => "second", :insert_after => "p", :text => "<pre>this is code?</pre>")
|
303
427
|
|
304
428
|
@digest = Deface::Override.digest(:virtual_path => "posts/index")
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Deface
|
4
|
+
describe Search do
|
5
|
+
include_context "mock Rails.application"
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1",
|
9
|
+
:text => "<h1>Argh!</h1>")
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#find" do
|
13
|
+
it "should find by virtual_path" do
|
14
|
+
Deface::Override.find({:virtual_path => "posts/index"}).size.should == 1
|
15
|
+
Deface::Override.find({:virtual_path => "/posts/index"}).size.should == 1
|
16
|
+
Deface::Override.find({:virtual_path => "/posts/index.html"}).size.should == 1
|
17
|
+
Deface::Override.find({:virtual_path => "posts/index.html"}).size.should == 1
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return empty array when no details hash passed" do
|
21
|
+
Deface::Override.find({}).should == []
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#find_using" do
|
26
|
+
before do
|
27
|
+
@override_partial = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#edit", :replace => "h1",
|
28
|
+
:partial => "shared/post")
|
29
|
+
|
30
|
+
@override_template = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#show", :replace => "h1",
|
31
|
+
:template => "shared/person")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should find by virtual_path" do
|
35
|
+
Deface::Override.find_using("shared/post").size.should == 1
|
36
|
+
Deface::Override.find_using("shared/person").size.should == 1
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,7 @@ require 'deface'
|
|
7
7
|
require 'deface/action_view_extensions'
|
8
8
|
require 'haml'
|
9
9
|
require 'deface/haml_converter'
|
10
|
+
require 'time'
|
10
11
|
|
11
12
|
Haml.init_rails(nil)
|
12
13
|
|
@@ -20,20 +21,32 @@ end
|
|
20
21
|
|
21
22
|
shared_context "mock Rails" do
|
22
23
|
before(:each) do
|
24
|
+
rails_version = Gem.loaded_specs['rails'].version.to_s
|
25
|
+
|
26
|
+
# mock rails to keep specs FAST!
|
23
27
|
unless defined? Rails
|
24
28
|
Rails = mock 'Rails'
|
25
29
|
end
|
26
30
|
|
31
|
+
Rails.stub :version => rails_version
|
32
|
+
|
27
33
|
Rails.stub :application => mock('application')
|
28
34
|
Rails.application.stub :config => mock('config')
|
29
35
|
Rails.application.config.stub :cache_classes => true
|
30
36
|
Rails.application.config.stub :deface => ActiveSupport::OrderedOptions.new
|
31
37
|
Rails.application.config.deface.enabled = true
|
32
38
|
|
39
|
+
if Rails.version[0..2] == '3.2'
|
40
|
+
Rails.application.config.stub :watchable_dirs => {}
|
41
|
+
end
|
42
|
+
|
33
43
|
Rails.stub :logger => mock('logger')
|
34
44
|
Rails.logger.stub(:error)
|
35
45
|
Rails.logger.stub(:warning)
|
36
46
|
Rails.logger.stub(:info)
|
47
|
+
|
48
|
+
Time.stub :zone => mock('zone')
|
49
|
+
Time.zone.stub(:now).and_return Time.parse('1979-05-25')
|
37
50
|
end
|
38
51
|
end
|
39
52
|
|
data/tasks/utils.rake
CHANGED
metadata
CHANGED
@@ -1,95 +1,88 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: deface
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 8
|
9
|
-
- 0
|
10
|
-
version: 0.8.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Brian D Quinn
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: nokogiri
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 5
|
32
|
-
- 0
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 1.5.0
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rails
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
25
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.5.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.1'
|
50
38
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rspec
|
54
39
|
prerelease: false
|
55
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
56
49
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 47
|
61
|
-
segments:
|
62
|
-
- 2
|
63
|
-
- 8
|
64
|
-
- 0
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
65
53
|
version: 2.8.0
|
66
54
|
type: :development
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: haml
|
70
55
|
prerelease: false
|
71
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
57
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.8.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: haml
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
81
69
|
version: 3.1.4
|
82
70
|
type: :development
|
83
|
-
|
84
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 3.1.4
|
78
|
+
description: Deface is a library that allows you to customize ERB & HAML views in
|
79
|
+
a Rails application without editing the underlying view.
|
85
80
|
email: brian@spreecommerce.com
|
86
81
|
executables: []
|
87
|
-
|
88
82
|
extensions: []
|
89
|
-
|
90
|
-
extra_rdoc_files:
|
83
|
+
extra_rdoc_files:
|
91
84
|
- README.markdown
|
92
|
-
files:
|
85
|
+
files:
|
93
86
|
- .gitignore
|
94
87
|
- .travis.yml
|
95
88
|
- Gemfile
|
@@ -97,10 +90,14 @@ files:
|
|
97
90
|
- README.markdown
|
98
91
|
- Rakefile
|
99
92
|
- deface.gemspec
|
93
|
+
- gemfiles/rails3_1.gemfile
|
94
|
+
- gemfiles/rails3_2.gemfile
|
100
95
|
- init.rb
|
101
96
|
- lib/deface.rb
|
102
97
|
- lib/deface/action_view_extensions.rb
|
103
98
|
- lib/deface/applicator.rb
|
99
|
+
- lib/deface/dsl/context.rb
|
100
|
+
- lib/deface/dsl/loader.rb
|
104
101
|
- lib/deface/environment.rb
|
105
102
|
- lib/deface/haml_converter.rb
|
106
103
|
- lib/deface/original_validator.rb
|
@@ -110,64 +107,66 @@ files:
|
|
110
107
|
- lib/deface/search.rb
|
111
108
|
- lib/deface/template_helper.rb
|
112
109
|
- spec/assets/admin/posts/index.html.erb
|
110
|
+
- spec/assets/dummy_app/overrides/posts/index/app_override.html.erb.deface
|
111
|
+
- spec/assets/dummy_engine/overrides/users/index/engine_override.html.erb.deface
|
113
112
|
- spec/assets/shared/_hello.html.haml
|
114
113
|
- spec/assets/shared/_post.html.erb
|
115
114
|
- spec/assets/shared/person.html.erb
|
116
115
|
- spec/assets/shared/pirate.html.haml
|
117
116
|
- spec/deface/action_view_template_spec.rb
|
118
117
|
- spec/deface/applicator_spec.rb
|
118
|
+
- spec/deface/dsl/context_spec.rb
|
119
|
+
- spec/deface/dsl/loader_spec.rb
|
119
120
|
- spec/deface/environment_spec.rb
|
120
121
|
- spec/deface/haml_converter_spec.rb
|
121
122
|
- spec/deface/override_spec.rb
|
122
123
|
- spec/deface/parser_spec.rb
|
124
|
+
- spec/deface/search_spec.rb
|
123
125
|
- spec/deface/template_helper_spec.rb
|
124
126
|
- spec/spec_helper.rb
|
125
127
|
- tasks/precompile.rake
|
126
128
|
- tasks/utils.rake
|
127
129
|
homepage: http://github.com/railsdog/deface
|
128
130
|
licenses: []
|
129
|
-
|
130
131
|
post_install_message:
|
131
|
-
rdoc_options:
|
132
|
+
rdoc_options:
|
132
133
|
- --charset=UTF-8
|
133
|
-
require_paths:
|
134
|
+
require_paths:
|
134
135
|
- lib
|
135
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
137
|
none: false
|
137
|
-
requirements:
|
138
|
-
- -
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
|
141
|
-
|
142
|
-
- 0
|
143
|
-
version: "0"
|
144
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
143
|
none: false
|
146
|
-
requirements:
|
147
|
-
- -
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
|
150
|
-
segments:
|
151
|
-
- 0
|
152
|
-
version: "0"
|
144
|
+
requirements:
|
145
|
+
- - ! '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
153
148
|
requirements: []
|
154
|
-
|
155
149
|
rubyforge_project:
|
156
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.22
|
157
151
|
signing_key:
|
158
152
|
specification_version: 3
|
159
153
|
summary: Deface is a library that allows you to customize ERB & HAML views in Rails
|
160
|
-
test_files:
|
154
|
+
test_files:
|
161
155
|
- spec/assets/admin/posts/index.html.erb
|
156
|
+
- spec/assets/dummy_app/overrides/posts/index/app_override.html.erb.deface
|
157
|
+
- spec/assets/dummy_engine/overrides/users/index/engine_override.html.erb.deface
|
162
158
|
- spec/assets/shared/_hello.html.haml
|
163
159
|
- spec/assets/shared/_post.html.erb
|
164
160
|
- spec/assets/shared/person.html.erb
|
165
161
|
- spec/assets/shared/pirate.html.haml
|
166
162
|
- spec/deface/action_view_template_spec.rb
|
167
163
|
- spec/deface/applicator_spec.rb
|
164
|
+
- spec/deface/dsl/context_spec.rb
|
165
|
+
- spec/deface/dsl/loader_spec.rb
|
168
166
|
- spec/deface/environment_spec.rb
|
169
167
|
- spec/deface/haml_converter_spec.rb
|
170
168
|
- spec/deface/override_spec.rb
|
171
169
|
- spec/deface/parser_spec.rb
|
170
|
+
- spec/deface/search_spec.rb
|
172
171
|
- spec/deface/template_helper_spec.rb
|
173
172
|
- spec/spec_helper.rb
|