deface 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/deface.gemspec +4 -3
- data/lib/deface.rb +0 -1
- data/lib/deface/slim_converter.rb +17 -1
- data/lib/deface/utils/failure_finder.rb +4 -2
- data/spec/deface/slim_converter_spec.rb +7 -0
- data/tasks/utils.rake +3 -3
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 937f69c6ba33fac6bceb0447b96ba785a8e91052
|
4
|
+
data.tar.gz: d630926e26e6a795e4756b8acf5e029e4d503b59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a18ff66d387178239b92e2bbd9e5a9de610fd1bebab2f2d2d77bfb7190e3c6bf37216799fc1f1e2d7036877a0b75bef2be6c95f43ee1b5a4c3ed235c801dd9c
|
7
|
+
data.tar.gz: 7064fed47ace50841d4b4706fe9c08f56baa0345f4c378ac53ff0cbe1d5d130f020c7191751990124acb041556ef573bfc65ab8690508343c76577d3106115e7
|
data/deface.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "deface"
|
3
|
-
s.version = "1.
|
3
|
+
s.version = "1.2.0"
|
4
4
|
|
5
5
|
s.authors = ["Brian D Quinn"]
|
6
6
|
s.description = "Deface is a library that allows you to customize ERB, Haml and Slim views in a Rails application without editing the underlying view."
|
@@ -15,12 +15,13 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
s.summary = "Deface is a library that allows you to customize ERB, Haml and Slim views in Rails"
|
17
17
|
|
18
|
-
s.add_dependency('nokogiri', '~> 1.6
|
18
|
+
s.add_dependency('nokogiri', '~> 1.6')
|
19
19
|
s.add_dependency('rails', '>= 4.1')
|
20
|
-
s.add_dependency('
|
20
|
+
s.add_dependency('rainbow', '>= 2.1.0')
|
21
21
|
s.add_dependency('polyglot')
|
22
22
|
|
23
23
|
s.add_development_dependency('appraisal')
|
24
|
+
s.add_development_dependency('erubis')
|
24
25
|
s.add_development_dependency('rspec', '>= 3.1.0')
|
25
26
|
s.add_development_dependency('haml', '~> 4.0')
|
26
27
|
s.add_development_dependency('slim', '~> 3.0')
|
data/lib/deface.rb
CHANGED
@@ -8,8 +8,24 @@ module Deface
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def result
|
11
|
-
|
11
|
+
conv = defined?(Slim::RailsTemplate) ? rails_converter : generic_converter
|
12
|
+
conv.call(@template).gsub(/<%\s*%>/, '')
|
12
13
|
end
|
13
14
|
|
15
|
+
private
|
16
|
+
|
17
|
+
def rails_converter
|
18
|
+
slim_erb_converter.new(
|
19
|
+
Temple::OptionMap.new(Slim::RailsTemplate.options.to_h.except(:engine))
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def generic_converter
|
24
|
+
slim_erb_converter.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def slim_erb_converter
|
28
|
+
::Slim::ERBConverter
|
29
|
+
end
|
14
30
|
end
|
15
31
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rainbow'
|
2
|
+
|
1
3
|
module Deface
|
2
4
|
module Utils
|
3
5
|
module FailureFinder
|
@@ -28,9 +30,9 @@ module Deface
|
|
28
30
|
|
29
31
|
fails.each do |override|
|
30
32
|
if override.failure.nil?
|
31
|
-
puts " '#{override.name}' reported no failures".green
|
33
|
+
puts Rainbow(" '#{override.name}' reported no failures").green
|
32
34
|
else
|
33
|
-
puts " '#{override.name}' #{override.failure}".red
|
35
|
+
puts Rainbow(" '#{override.name}' #{override.failure}").red
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
@@ -26,6 +26,13 @@ module Deface
|
|
26
26
|
li = link_to 'Log out', logout_path
|
27
27
|
})).to eq("<nav id=\"top-nav-bar\"><ul class=\"inline\" data-hook=\"\" id=\"nav-bar\"><% if true %><div class=\"nav-links high_res\"><li class=\"dropdown\"><div class=\"welcome\">Welcome <%= ::Temple::Utils.escape_html_safe((Spree::User.first.email)) %> ▾</div><ul class=\"dropdown\"><li><%= ::Temple::Utils.escape_html_safe((link_to 'Account', account_path)) %></li><li><%= ::Temple::Utils.escape_html_safe((link_to 'Log out', logout_path)) %></li></ul></li></div><% end %></ul></nav>")
|
28
28
|
end
|
29
|
+
|
30
|
+
it "should handle Rails capturing" do
|
31
|
+
expect(slim_to_erb(%q{#wishlist-form
|
32
|
+
= form_for Spree::WishedProduct.new do |f|
|
33
|
+
= f.submit 'Save'
|
34
|
+
})).to eq("<div id=\"wishlist-form\"><% _slim_controls1 = form_for Spree::WishedProduct.new do |f| %><%= ::Temple::Utils.escape_html_safe((f.submit 'Save')) %><% end %><%= ::Temple::Utils.escape_html_safe((_slim_controls1)) %></div>")
|
35
|
+
end
|
29
36
|
end
|
30
37
|
|
31
38
|
end
|
data/tasks/utils.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'deface'
|
2
2
|
require 'deface/utils/failure_finder'
|
3
|
-
require '
|
3
|
+
require 'rainbow'
|
4
4
|
|
5
5
|
namespace :deface do
|
6
6
|
include Deface::TemplateHelper
|
@@ -68,10 +68,10 @@ namespace :deface do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
if fail_count == 0
|
71
|
-
puts "\nEverything's looking good!".green
|
71
|
+
puts Rainbow("\nEverything's looking good!").green
|
72
72
|
exit(0)
|
73
73
|
else
|
74
|
-
puts "\nYou had a total of #{fail_count} failures.".red
|
74
|
+
puts Rainbow("\nYou had a total of #{fail_count} failures.").red
|
75
75
|
exit(1)
|
76
76
|
end
|
77
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
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:
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.6
|
19
|
+
version: '1.6'
|
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
|
-
version: 1.6
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rainbow
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.1.0
|
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
|
-
version:
|
54
|
+
version: 2.1.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: polyglot
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: erubis
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -282,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
296
|
version: '0'
|
283
297
|
requirements: []
|
284
298
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.
|
299
|
+
rubygems_version: 2.6.10
|
286
300
|
signing_key:
|
287
301
|
specification_version: 4
|
288
302
|
summary: Deface is a library that allows you to customize ERB, Haml and Slim views
|