deface 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -2
  4. data/README.markdown +3 -11
  5. data/deface.gemspec +4 -4
  6. data/lib/deface/applicator.rb +1 -1
  7. data/lib/deface/dsl/loader.rb +42 -34
  8. data/lib/deface/railtie.rb +2 -2
  9. data/lib/deface/slim_converter.rb +15 -0
  10. data/lib/deface/sources/copy.rb +1 -1
  11. data/lib/deface/sources/slim.rb +2 -2
  12. data/lib/deface/template_helper.rb +1 -1
  13. data/spec/deface/action_view_template_spec.rb +12 -12
  14. data/spec/deface/actions/add_to_attributes_spec.rb +8 -8
  15. data/spec/deface/actions/insert_after_spec.rb +1 -1
  16. data/spec/deface/actions/insert_before_spec.rb +1 -1
  17. data/spec/deface/actions/insert_bottom_spec.rb +2 -2
  18. data/spec/deface/actions/insert_top_spec.rb +2 -2
  19. data/spec/deface/actions/remove_from_attributes_spec.rb +9 -9
  20. data/spec/deface/actions/remove_spec.rb +2 -2
  21. data/spec/deface/actions/replace_contents_spec.rb +2 -2
  22. data/spec/deface/actions/replace_spec.rb +10 -10
  23. data/spec/deface/actions/set_attributes_spec.rb +11 -11
  24. data/spec/deface/actions/surround_contents_spec.rb +5 -5
  25. data/spec/deface/actions/surround_spec.rb +5 -5
  26. data/spec/deface/applicator_spec.rb +6 -6
  27. data/spec/deface/dsl/context_spec.rb +7 -7
  28. data/spec/deface/dsl/loader_spec.rb +74 -77
  29. data/spec/deface/environment_spec.rb +38 -38
  30. data/spec/deface/haml_converter_spec.rb +24 -24
  31. data/spec/deface/override_spec.rb +90 -90
  32. data/spec/deface/parser_spec.rb +54 -54
  33. data/spec/deface/precompiler_spec.rb +7 -7
  34. data/spec/deface/search_spec.rb +7 -7
  35. data/spec/deface/slim_converter_spec.rb +32 -0
  36. data/spec/deface/template_helper_spec.rb +21 -22
  37. data/spec/deface/utils/failure_finder_spec.rb +11 -11
  38. data/spec/spec_helper.rb +25 -17
  39. metadata +33 -69
@@ -10,7 +10,7 @@ module Deface
10
10
 
11
11
  before do
12
12
  #stub view paths to be local spec/assets directory
13
- ActionController::Base.stub(:view_paths).and_return([File.join(File.dirname(__FILE__), '../..', "assets")])
13
+ allow(ActionController::Base).to receive(:view_paths).and_return([File.join(File.dirname(__FILE__), '../..', "assets")])
14
14
  end
15
15
 
16
16
  context "given failing overrides" do
@@ -24,15 +24,15 @@ module Deface
24
24
  fails = overrides_by_virtual_path('shared/_post')
25
25
  count = fails.group_by{ |o| !o.failure.nil? }
26
26
 
27
- count[true].size.should == 1
28
- count[true].first.name.should == 'bad'
29
- count[false].size.should == 1
30
- count[false].first.name.should == 'good'
27
+ expect(count[true].size).to eq 1
28
+ expect(count[true].first.name).to eq 'bad'
29
+ expect(count[false].size).to eq 1
30
+ expect(count[false].first.name).to eq 'good'
31
31
  end
32
32
 
33
33
  it "should return nil for path virtual_path value" do
34
34
  silence_stream(STDOUT) do
35
- overrides_by_virtual_path('shared/_poster').should be_nil
35
+ expect(overrides_by_virtual_path('shared/_poster')).to be_nil
36
36
  end
37
37
  end
38
38
  end
@@ -40,7 +40,7 @@ module Deface
40
40
  context "output_results_by_virtual_path" do
41
41
  it "should return count of failed overrides for given path" do
42
42
  silence_stream(STDOUT) do
43
- output_results_by_virtual_path('shared/_post').should == 1
43
+ expect(output_results_by_virtual_path('shared/_post')).to eq 1
44
44
  end
45
45
  end
46
46
  end
@@ -56,9 +56,9 @@ module Deface
56
56
  fails = overrides_by_virtual_path('shared/_post')
57
57
  count = fails.group_by{ |o| !o.failure.nil? }
58
58
 
59
- count.key?('true').should be_false
60
- count[false].size.should == 1
61
- count[false].first.name.should == 'good'
59
+ expect(count.key?('true')).to be_falsy
60
+ expect(count[false].size).to eq 1
61
+ expect(count[false].first.name).to eq 'good'
62
62
  end
63
63
 
64
64
  end
@@ -66,7 +66,7 @@ module Deface
66
66
  context "output_results_by_virtual_path" do
67
67
  it "should return count of failed overrides for given path" do
68
68
  silence_stream(STDOUT) do
69
- output_results_by_virtual_path('shared/_post').should == 0
69
+ expect(output_results_by_virtual_path('shared/_post')).to eq 0
70
70
  end
71
71
  end
72
72
  end
@@ -19,9 +19,17 @@ module Rails
19
19
  end
20
20
  end
21
21
 
22
+ begin
23
+ I18n.enforce_available_locales = false
24
+ rescue
25
+ #shut the hell up
26
+ end
27
+
22
28
  require 'haml'
23
- require 'slim'
24
29
  require 'deface/haml_converter'
30
+
31
+ require 'slim'
32
+ require 'deface/slim_converter'
25
33
  require 'generators/deface/override_generator'
26
34
  require 'time'
27
35
 
@@ -47,28 +55,28 @@ shared_context "mock Rails" do
47
55
  Rails = double 'Rails'
48
56
  end
49
57
 
50
- Rails.stub :version => rails_version
58
+ allow(Rails).to receive(:version).and_return rails_version
51
59
 
52
- Rails.stub :application => double('application')
53
- Rails.application.stub :config => double('config')
54
- Rails.application.config.stub :cache_classes => true
55
- Rails.application.config.stub :deface => ActiveSupport::OrderedOptions.new
60
+ allow(Rails).to receive(:application).and_return double('application')
61
+ allow(Rails.application).to receive(:config).and_return double('config')
62
+ allow(Rails.application.config).to receive(:cache_classes).and_return true
63
+ allow(Rails.application.config).to receive(:deface).and_return ActiveSupport::OrderedOptions.new
56
64
  Rails.application.config.deface.enabled = true
57
65
 
58
- if Rails.version[0..2] == '3.2'
59
- Rails.application.config.stub :watchable_dirs => {}
66
+ if Rails.version[0..2] >= '3.2'
67
+ allow(Rails.application.config).to receive(:watchable_dirs).and_return({})
60
68
  end
61
69
 
62
- Rails.stub :root => Pathname.new('spec/dummy')
70
+ allow(Rails).to receive(:root).and_return Pathname.new('spec/dummy')
63
71
 
64
- Rails.stub :logger => double('logger')
65
- Rails.logger.stub(:error)
66
- Rails.logger.stub(:warning)
67
- Rails.logger.stub(:info)
68
- Rails.logger.stub(:debug)
72
+ allow(Rails).to receive(:logger).and_return double('logger')
73
+ allow(Rails.logger).to receive :error
74
+ allow(Rails.logger).to receive :warning
75
+ allow(Rails.logger).to receive :info
76
+ allow(Rails.logger).to receive :debug
69
77
 
70
- Time.stub :zone => double('zone')
71
- Time.zone.stub(:now).and_return Time.parse('1979-05-25')
78
+ allow(Time).to receive(:zone).and_return double('zone')
79
+ allow(Time.zone).to receive(:now).and_return Time.parse('1979-05-25')
72
80
 
73
81
  require "haml/template/plugin"
74
82
  require 'slim/erb_converter'
@@ -79,7 +87,7 @@ shared_context "mock Rails.application" do
79
87
  include_context "mock Rails"
80
88
 
81
89
  before(:each) do
82
- Rails.application.config.stub :deface => Deface::Environment.new
90
+ allow(Rails.application.config).to receive(:deface).and_return Deface::Environment.new
83
91
  Rails.application.config.deface.haml_support = true
84
92
  Rails.application.config.deface.slim_support = true
85
93
  end
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deface
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian D Quinn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-09 00:00:00.000000000 Z
11
+ date: 2015-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.5.8
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.5.8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: polyglot
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.11.0
75
+ version: 3.1.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.11.0
82
+ version: 3.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: haml
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.1.4
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.1.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: slim
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 2.0.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.0.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.6.4
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.6.4
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: generator_spec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.8'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.8'
139
139
  description: Deface is a library that allows you to customize ERB, Haml and Slim views
@@ -145,9 +145,9 @@ extra_rdoc_files:
145
145
  - README.markdown
146
146
  - CHANGELOG.markdown
147
147
  files:
148
- - .gitignore
149
- - .rspec
150
- - .travis.yml
148
+ - ".gitignore"
149
+ - ".rspec"
150
+ - ".travis.yml"
151
151
  - CHANGELOG.markdown
152
152
  - Gemfile
153
153
  - MIT-LICENSE
@@ -191,6 +191,7 @@ files:
191
191
  - lib/deface/precompiler.rb
192
192
  - lib/deface/railtie.rb
193
193
  - lib/deface/search.rb
194
+ - lib/deface/slim_converter.rb
194
195
  - lib/deface/sources/copy.rb
195
196
  - lib/deface/sources/cut.rb
196
197
  - lib/deface/sources/erb.rb
@@ -240,73 +241,36 @@ files:
240
241
  - spec/deface/parser_spec.rb
241
242
  - spec/deface/precompiler_spec.rb
242
243
  - spec/deface/search_spec.rb
244
+ - spec/deface/slim_converter_spec.rb
243
245
  - spec/deface/template_helper_spec.rb
244
246
  - spec/deface/utils/failure_finder_spec.rb
245
247
  - spec/generators/deface/override_generator_spec.rb
246
248
  - spec/spec_helper.rb
247
249
  - tasks/precompile.rake
248
250
  - tasks/utils.rake
249
- homepage: https://github.com/spree/deface
251
+ homepage: https://github.com/DefaceCommunity/deface
250
252
  licenses: []
251
253
  metadata: {}
252
254
  post_install_message:
253
255
  rdoc_options:
254
- - --charset=UTF-8
256
+ - "--charset=UTF-8"
255
257
  require_paths:
256
258
  - lib
257
259
  required_ruby_version: !ruby/object:Gem::Requirement
258
260
  requirements:
259
- - - '>='
261
+ - - ">="
260
262
  - !ruby/object:Gem::Version
261
263
  version: '0'
262
264
  required_rubygems_version: !ruby/object:Gem::Requirement
263
265
  requirements:
264
- - - '>='
266
+ - - ">="
265
267
  - !ruby/object:Gem::Version
266
268
  version: '0'
267
269
  requirements: []
268
270
  rubyforge_project:
269
- rubygems_version: 2.0.14
271
+ rubygems_version: 2.4.5
270
272
  signing_key:
271
273
  specification_version: 4
272
274
  summary: Deface is a library that allows you to customize ERB, Haml and Slim views
273
275
  in Rails
274
- test_files:
275
- - spec/assets/admin/posts/index.html.erb
276
- - spec/assets/dummy_app/overrides/posts/index/app_override.html.erb.deface
277
- - spec/assets/dummy_app/overrides/posts/precompileme/precompileme.html.erb.deface
278
- - spec/assets/dummy_engine/overrides/users/index/engine_override.html.erb.deface
279
- - spec/assets/posts/precompileme.html.erb
280
- - spec/assets/shared/_hello.html.haml
281
- - spec/assets/shared/_hi.html.slim
282
- - spec/assets/shared/_post.html.erb
283
- - spec/assets/shared/person.html.erb
284
- - spec/assets/shared/pirate.html.haml
285
- - spec/assets/shared/public.html.slim
286
- - spec/deface/action_view_template_spec.rb
287
- - spec/deface/actions/add_to_attributes_spec.rb
288
- - spec/deface/actions/insert_after_spec.rb
289
- - spec/deface/actions/insert_before_spec.rb
290
- - spec/deface/actions/insert_bottom_spec.rb
291
- - spec/deface/actions/insert_top_spec.rb
292
- - spec/deface/actions/remove_from_attributes_spec.rb
293
- - spec/deface/actions/remove_spec.rb
294
- - spec/deface/actions/replace_contents_spec.rb
295
- - spec/deface/actions/replace_spec.rb
296
- - spec/deface/actions/set_attributes_spec.rb
297
- - spec/deface/actions/surround_contents_spec.rb
298
- - spec/deface/actions/surround_spec.rb
299
- - spec/deface/applicator_spec.rb
300
- - spec/deface/dsl/context_spec.rb
301
- - spec/deface/dsl/loader_spec.rb
302
- - spec/deface/environment_spec.rb
303
- - spec/deface/haml_converter_spec.rb
304
- - spec/deface/override_spec.rb
305
- - spec/deface/parser_spec.rb
306
- - spec/deface/precompiler_spec.rb
307
- - spec/deface/search_spec.rb
308
- - spec/deface/template_helper_spec.rb
309
- - spec/deface/utils/failure_finder_spec.rb
310
- - spec/generators/deface/override_generator_spec.rb
311
- - spec/spec_helper.rb
312
- has_rdoc:
276
+ test_files: []