deface 1.5.3 → 1.6.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +15 -16
- data/Appraisals +5 -13
- data/CHANGELOG.markdown +1 -4
- data/README.markdown +1 -1
- data/bin/rails +8 -0
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +18 -0
- data/bin/sandbox +40 -0
- data/bin/sandbox-setup +24 -0
- data/deface.gemspec +44 -29
- data/gemfiles/rails_6.0.gemfile +1 -1
- data/gemfiles/{rails_4.2.gemfile → rails_6_1.gemfile} +1 -1
- data/lib/deface.rb +12 -8
- data/lib/deface/action_view_extensions.rb +50 -76
- data/lib/deface/applicator.rb +2 -4
- data/lib/deface/environment.rb +4 -12
- data/lib/deface/errors.rb +5 -0
- data/lib/deface/override.rb +14 -20
- data/lib/deface/railtie.rb +2 -8
- data/lib/deface/version.rb +5 -0
- data/spec/deface/action_view_template_spec.rb +121 -76
- data/spec/deface/environment_spec.rb +8 -12
- data/spec/deface/override_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -6
- metadata +39 -18
- data/gemfiles/rails_5.0.gemfile +0 -13
- data/gemfiles/rails_5.1.gemfile +0 -13
- data/init.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e130d9b889669220392d0fa6fe04ba7cd39604bf8b12edff68308b89d6f3f5f6
|
4
|
+
data.tar.gz: 997c7d4cc5d95a5a5168e70c9da588a9c56b7b67a404b0e4ffaf0410a06426b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 800d393fb3a99206dd0b7922e094458b806e114ab244c8229d37a392affa0faec9455caa85fdba554ece13c95c70064fc663a1644c41cb1b48d693aa35293a56
|
7
|
+
data.tar.gz: 713aaca8fa816ba00f9d66ac8b39596b4818099aff3aa533aa2301d56f1ccd6a15b650477b5621ca669a45b6c949b8f1699fbad4b1a7f339bc7e9ae32f460a8d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
script: "bundle exec rake"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
- gem install bundler -v '< 2'
|
3
|
+
cache:
|
4
|
+
bundler: true
|
6
5
|
|
7
6
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.
|
10
|
-
- 2.
|
7
|
+
- 2.5.8
|
8
|
+
- 2.6.6
|
9
|
+
- 2.7.2
|
10
|
+
- 3.0.0
|
11
|
+
|
11
12
|
gemfile:
|
12
|
-
- gemfiles/rails_4.2.gemfile
|
13
|
-
- gemfiles/rails_5.0.gemfile
|
14
|
-
- gemfiles/rails_5.1.gemfile
|
15
13
|
- gemfiles/rails_5.2.gemfile
|
16
14
|
- gemfiles/rails_6.0.gemfile
|
17
|
-
|
18
|
-
email:
|
19
|
-
- brian@spreecommerce.com
|
20
|
-
- ryan@spreecommerce.com
|
15
|
+
- gemfiles/rails_6_1.gemfile
|
21
16
|
|
22
17
|
matrix:
|
23
18
|
exclude:
|
24
|
-
- rvm: 2.
|
25
|
-
gemfile: gemfiles/
|
26
|
-
- rvm: 2.
|
19
|
+
- rvm: 2.6.6
|
20
|
+
gemfile: gemfiles/rails_5.2.gemfile
|
21
|
+
- rvm: 2.7.2
|
22
|
+
gemfile: gemfiles/rails_5.2.gemfile
|
23
|
+
- rvm: 3.0.0
|
24
|
+
gemfile: gemfiles/rails_5.2.gemfile
|
25
|
+
- rvm: 3.0.0
|
27
26
|
gemfile: gemfiles/rails_6.0.gemfile
|
data/Appraisals
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
appraise 'rails-4.2' do
|
2
|
-
gem 'rails', '~> 4.2.0'
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise 'rails-5.0' do
|
6
|
-
gem 'rails', '~> 5.0.0'
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise 'rails-5.1' do
|
10
|
-
gem 'rails', '~> 5.1.0'
|
11
|
-
end
|
12
|
-
|
13
1
|
appraise 'rails-5.2' do
|
14
2
|
gem 'rails', '~> 5.2.0'
|
15
3
|
end
|
16
4
|
|
17
5
|
appraise 'rails-6.0' do
|
18
|
-
gem 'rails', '~> 6.0.0
|
6
|
+
gem 'rails', '~> 6.0.0'
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise 'rails-6.1' do
|
10
|
+
gem 'rails', '~> 6.1.0'
|
19
11
|
end
|
data/CHANGELOG.markdown
CHANGED
@@ -1,4 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* [BREAKING CHANGE] ERB blocks are no longer converted into <code erb-loud|erb-silent>, now they are <erb loud|silent> [jhawthorn]
|
4
|
-
* Lots of other changes too numerous to list here in the first changelog entry, will get better going forward :)
|
1
|
+
*See https://github.com/spree/deface/releases*
|
data/README.markdown
CHANGED
@@ -295,7 +295,7 @@ When using the DSL, overrides automatically take their name from the filename of
|
|
295
295
|
even if they are defined in separate engines. If you want to avoid this, you can use the `namespaced` option :
|
296
296
|
|
297
297
|
```erb
|
298
|
-
<!-- insert_bottom 'head' namespaced-->
|
298
|
+
<!-- insert_bottom 'head' namespaced -->
|
299
299
|
```
|
300
300
|
or activate it globally for all DSL overrides in your app's `application.rb` file:
|
301
301
|
|
data/bin/rails
ADDED
data/bin/rails-engine
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('..', __dir__)
|
6
|
+
ENGINE_PATH = File.expand_path('../lib/solidus_paypal_commerce_platform/engine', __dir__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
11
|
+
|
12
|
+
require 'rails/all'
|
13
|
+
require 'rails/engine/commands'
|
data/bin/rails-sandbox
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
app_root = 'sandbox'
|
6
|
+
|
7
|
+
unless File.exist? "#{app_root}/bin/rails"
|
8
|
+
warn 'Creating the sandbox app...'
|
9
|
+
Dir.chdir "#{__dir__}/.." do
|
10
|
+
system "#{__dir__}/sandbox" or begin # rubocop:disable Style/AndOr
|
11
|
+
warn 'Automatic creation of the sandbox app failed'
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Dir.chdir app_root
|
18
|
+
exec 'bin/rails', *ARGV
|
data/bin/sandbox
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
gem_name="$(ruby -rpathname -e"puts Pathname(ARGV.first).join('../..').expand_path.glob('*.gemspec').first.basename('.gemspec')" -- $0)"
|
4
|
+
|
5
|
+
# Stay away from the bundler env of the containing extension.
|
6
|
+
function unbundled {
|
7
|
+
ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
|
8
|
+
}
|
9
|
+
|
10
|
+
rm -rf ./sandbox
|
11
|
+
unbundled bundle exec rails new sandbox \
|
12
|
+
--skip-bundle \
|
13
|
+
--skip-git \
|
14
|
+
--skip-javascript \
|
15
|
+
--skip-keeps \
|
16
|
+
--skip-rc \
|
17
|
+
--skip-spring \
|
18
|
+
--skip-test \
|
19
|
+
$@
|
20
|
+
|
21
|
+
if [ ! -d "sandbox" ]; then
|
22
|
+
echo 'sandbox rails application failed'
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
cd ./sandbox
|
27
|
+
cat <<RUBY >> Gemfile
|
28
|
+
gem '$gem_name', path: '..'
|
29
|
+
RUBY
|
30
|
+
|
31
|
+
unbundled bundle install --gemfile Gemfile
|
32
|
+
|
33
|
+
unbundled bundle exec rake db:drop db:create
|
34
|
+
|
35
|
+
cd .. # Back to the project root.
|
36
|
+
bin/sandbox-setup # Run any custom setup.
|
37
|
+
|
38
|
+
echo
|
39
|
+
echo "🚀 Sandbox app successfully created for $gem_name!"
|
40
|
+
|
data/bin/sandbox-setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
bin/rails g scaffold Post title body
|
4
|
+
bin/rails db:migrate
|
5
|
+
|
6
|
+
mkdir sandbox/app/overrides
|
7
|
+
|
8
|
+
echo <<RUBY >> sandbox/app/overrides/sparkling_title.rb
|
9
|
+
Deface::Override.new(
|
10
|
+
virtual_path: "posts/show",
|
11
|
+
name: "sparkling_title",
|
12
|
+
replace: 'p:nth-child(2)',
|
13
|
+
text: "<h1>✨<%= @post.title %>✨</h1>"
|
14
|
+
)
|
15
|
+
|
16
|
+
Deface::Override.new(
|
17
|
+
virtual_path: "posts/show",
|
18
|
+
name: "sparkling_body",
|
19
|
+
replace: 'p:nth-child(3)',
|
20
|
+
text: "<p style='border:2px gray solid; padding: 1rem;'><%= @post.body %></p>"
|
21
|
+
)
|
22
|
+
RUBY
|
23
|
+
|
24
|
+
bin/rails runner "Post.create(title: 'Foo', body: 'Bar '*10)"
|
data/deface.gemspec
CHANGED
@@ -1,30 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
require_relative 'lib/deface/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "deface"
|
5
|
+
spec.version = Deface::VERSION
|
6
|
+
spec.authors = ["Brian D Quinn"]
|
7
|
+
spec.email = "brian@spreecommerce.com"
|
8
|
+
|
9
|
+
spec.summary = "Deface is a library that allows you to customize ERB, Haml and Slim views in Rails"
|
10
|
+
spec.description = "Deface is a library that allows you to customize ERB, Haml and Slim views in a Rails application without editing the underlying view."
|
11
|
+
spec.homepage = "https://github.com/spree/deface#readme"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
15
|
+
spec.metadata['source_code_uri'] = 'https://github.com/spree/deface'
|
16
|
+
spec.metadata['changelog_uri'] = 'https://github.com/spree/deface/releases'
|
17
|
+
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
23
|
+
|
24
|
+
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
25
|
+
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
spec.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
spec.extra_rdoc_files = ["README.markdown"]
|
31
|
+
|
32
|
+
spec.add_dependency('nokogiri', '>= 1.6')
|
33
|
+
spec.add_dependency('rails', '>= 5.2')
|
34
|
+
spec.add_dependency('rainbow', '>= 2.1.0')
|
35
|
+
spec.add_dependency('polyglot')
|
36
|
+
|
37
|
+
spec.add_development_dependency('appraisal')
|
38
|
+
spec.add_development_dependency('erubis')
|
39
|
+
spec.add_development_dependency('rspec', '>= 3.1.0')
|
40
|
+
spec.add_development_dependency('haml', ['>= 4.0', '< 6'])
|
41
|
+
spec.add_development_dependency('slim', '~> 3.0')
|
42
|
+
spec.add_development_dependency('simplecov', '>= 0.6.4')
|
43
|
+
spec.add_development_dependency('generator_spec', '~> 0.8')
|
44
|
+
spec.add_development_dependency('pry')
|
30
45
|
end
|
data/gemfiles/rails_6.0.gemfile
CHANGED
data/lib/deface.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "action_view"
|
2
2
|
require "action_controller"
|
3
|
+
require "deface/errors"
|
3
4
|
require "deface/template_helper"
|
4
5
|
require "deface/original_validator"
|
5
6
|
require "deface/applicator"
|
@@ -38,18 +39,21 @@ require "deface/matchers/range"
|
|
38
39
|
require "deface/environment"
|
39
40
|
require "deface/precompiler"
|
40
41
|
|
42
|
+
require "deface/railtie" if defined?(Rails)
|
43
|
+
|
41
44
|
module Deface
|
42
|
-
|
43
|
-
|
45
|
+
@before_rails_6 = ActionView.gem_version < Gem::Version.new('6.0.0')
|
46
|
+
@template_class = @before_rails_6 ? ActionView::CompiledTemplates : ActionDispatch::DebugView
|
47
|
+
|
48
|
+
def self.before_rails_6?
|
49
|
+
@before_rails_6
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.template_class
|
53
|
+
@template_class
|
44
54
|
end
|
45
55
|
|
46
56
|
if defined?(ActiveSupport::Digest)
|
47
57
|
Deface::Digest.digest_class = ActiveSupport::Digest
|
48
58
|
end
|
49
|
-
|
50
|
-
# Exceptions
|
51
|
-
class DefaceError < StandardError; end
|
52
|
-
|
53
|
-
class NotSupportedError < DefaceError; end
|
54
|
-
|
55
59
|
end
|
@@ -1,51 +1,50 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# force change in handler before continuing to original Rails method
|
12
|
-
# as we've just converted some other template language into ERB!
|
13
|
-
#
|
14
|
-
if [:slim, :haml].include?(syntax) && processed_source != source.to_param
|
15
|
-
handler = ActionView::Template::Handlers::ERB
|
16
|
-
end
|
1
|
+
module Deface::ActionViewExtensions
|
2
|
+
def self.determine_syntax(handler)
|
3
|
+
return unless Rails.application.config.deface.enabled
|
4
|
+
|
5
|
+
if handler.to_s == "Haml::Plugin"
|
6
|
+
:haml
|
7
|
+
elsif handler.class.to_s == "Slim::RailsTemplate"
|
8
|
+
:slim
|
9
|
+
elsif handler.to_s.demodulize == "ERB" || handler.class.to_s.demodulize == "ERB"
|
10
|
+
:erb
|
17
11
|
else
|
18
|
-
|
12
|
+
nil
|
19
13
|
end
|
20
|
-
|
21
|
-
initialize_without_deface(processed_source, identifier, handler, details)
|
22
14
|
end
|
23
15
|
|
24
|
-
|
16
|
+
module DefacedTemplate
|
17
|
+
def initialize(source, identifier, handler, details)
|
18
|
+
syntax = Deface::ActionViewExtensions.determine_syntax(handler)
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
def render(view, locals, buffer=nil, &block)
|
20
|
+
if syntax
|
21
|
+
processed_source = Deface::Override.apply(source.to_param, details, true, syntax)
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
23
|
+
# force change in handler before continuing to original Rails method
|
24
|
+
# as we've just converted some other template language into ERB!
|
25
|
+
#
|
26
|
+
if [:slim, :haml].include?(syntax) && processed_source != source.to_param
|
27
|
+
handler = ActionView::Template::Handlers::ERB
|
28
|
+
end
|
29
|
+
else
|
30
|
+
processed_source = source.to_param
|
31
|
+
end
|
38
32
|
|
39
|
-
|
40
|
-
@compiled = false
|
41
|
-
@source = refresh(view).source
|
33
|
+
super(processed_source, identifier, handler, **details)
|
42
34
|
end
|
43
|
-
render_without_deface(view, locals, buffer, &block)
|
44
|
-
end
|
45
35
|
|
46
|
-
|
36
|
+
# refresh view to get source again if
|
37
|
+
# view needs to be recompiled
|
38
|
+
#
|
39
|
+
def render(view, locals, buffer=nil, &block)
|
40
|
+
mod = view.is_a?(Deface.template_class) ? Deface.template_class : view.singleton_class
|
47
41
|
|
48
|
-
|
42
|
+
if @compiled && !mod.instance_methods.include?(method_name.to_sym)
|
43
|
+
@compiled = false
|
44
|
+
@source = refresh(view).source
|
45
|
+
end
|
46
|
+
super(view, locals, buffer, &block)
|
47
|
+
end
|
49
48
|
|
50
49
|
# inject deface hash into compiled view method name
|
51
50
|
# used to determine if recompilation is needed
|
@@ -54,49 +53,24 @@ ActionView::Template.class_eval do
|
|
54
53
|
deface_hash = Deface::Override.digest(:virtual_path => @virtual_path)
|
55
54
|
|
56
55
|
#we digest the whole method name as if it gets too long there's problems
|
57
|
-
"_#{Deface::Digest.hexdigest("#{deface_hash}_#{
|
56
|
+
"_#{Deface::Digest.hexdigest("#{deface_hash}_#{super}")}"
|
58
57
|
end
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
def should_be_defaced?(syntax)
|
63
|
-
syntax != :unknown
|
64
|
-
end
|
65
|
-
|
66
|
-
def determine_syntax(handler)
|
67
|
-
if handler.to_s == "Haml::Plugin"
|
68
|
-
:haml
|
69
|
-
elsif handler.class.to_s == "Slim::RailsTemplate"
|
70
|
-
:slim
|
71
|
-
elsif handler.to_s.demodulize == "ERB" || handler.class.to_s.demodulize == "ERB"
|
72
|
-
:erb
|
73
|
-
else
|
74
|
-
:unknown
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
59
|
+
ActionView::Template.prepend self
|
60
|
+
end
|
78
61
|
|
79
|
-
# Rails 6 fix
|
80
|
-
#
|
81
|
-
# https://github.com/rails/rails/commit/
|
82
|
-
|
83
|
-
|
62
|
+
# Rails 6 fix.
|
63
|
+
#
|
64
|
+
# https://github.com/rails/rails/commit/ec5c946138f63dc975341d6521587adc74f6b441
|
65
|
+
# https://github.com/rails/rails/commit/ccfa01c36e79013881ffdb7ebe397cec733d15b2#diff-dfb6e0314ad9639bab460ea64871aa47R27
|
66
|
+
module ErubiHandlerFix
|
84
67
|
def initialize(input, properties = {})
|
85
|
-
@
|
86
|
-
|
87
|
-
# Dup properties so that we don't modify argument
|
88
|
-
properties = Hash[properties]
|
89
|
-
properties[:preamble] = "@output_buffer = output_buffer || ActionView::OutputBuffer.new;"
|
90
|
-
properties[:postamble] = "@output_buffer.to_s"
|
91
|
-
properties[:bufvar] = "@output_buffer"
|
92
|
-
properties[:escapefunc] = ""
|
93
|
-
|
68
|
+
properties[:preamble] = "@output_buffer = output_buffer || ActionView::OutputBuffer.new;"
|
94
69
|
super
|
95
70
|
end
|
96
|
-
end
|
97
|
-
end
|
98
71
|
|
99
|
-
#
|
100
|
-
|
101
|
-
|
72
|
+
# We use include to place the module between the class' call to super and the
|
73
|
+
# actual execution within Erubi::Engine.
|
74
|
+
ActionView::Template::Handlers::ERB::Erubi.include self unless Deface.before_rails_6?
|
75
|
+
end
|
102
76
|
end
|
data/lib/deface/applicator.rb
CHANGED
@@ -48,10 +48,8 @@ module Deface
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
details[:updated_at] = Time.now
|
54
|
-
end
|
51
|
+
# Prevents any caching by rails in development mode.
|
52
|
+
details[:updated_at] = Time.now if Deface.before_rails_6?
|
55
53
|
|
56
54
|
source = doc.to_s
|
57
55
|
|
data/lib/deface/environment.rb
CHANGED
@@ -57,13 +57,7 @@ module Deface
|
|
57
57
|
Deface::DSL::Loader.register
|
58
58
|
|
59
59
|
# check all railties / engines / extensions / application for overrides
|
60
|
-
railties
|
61
|
-
app.railties._all
|
62
|
-
else
|
63
|
-
app.railties.all
|
64
|
-
end
|
65
|
-
|
66
|
-
railties.dup.push(app).each do |railtie|
|
60
|
+
app.railties._all.dup.push(app).each do |railtie|
|
67
61
|
next unless railtie.respond_to? :root
|
68
62
|
load_overrides(railtie)
|
69
63
|
end
|
@@ -89,11 +83,9 @@ module Deface
|
|
89
83
|
paths ||= ["app/overrides"]
|
90
84
|
|
91
85
|
paths.each do |path|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
Rails.application.config.watchable_dirs[root.join(path).to_s] = [:rb, :deface]
|
96
|
-
end
|
86
|
+
# add path to watchable_dir so Rails will call to_prepare on file changes
|
87
|
+
# allowing overrides to be updated / reloaded in development mode.
|
88
|
+
Rails.application.config.watchable_dirs[root.join(path).to_s] = [:rb, :deface]
|
97
89
|
|
98
90
|
Dir.glob(root.join path, "**/*.rb") do |c|
|
99
91
|
Rails.application.config.cache_classes ? require(c) : load(c)
|
data/lib/deface/override.rb
CHANGED
@@ -211,28 +211,22 @@ module Deface
|
|
211
211
|
|
212
212
|
private
|
213
213
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
ActionView::CompiledTemplates.send :remove_method, compiled_method_name
|
225
|
-
end
|
226
|
-
end
|
227
|
-
else
|
228
|
-
if compiled_method_name = ActionDispatch::DebugView.instance_methods.detect { |name| name =~ /#{args[:virtual_path].gsub(/[^a-z_]/, '_')}/ }
|
229
|
-
unless compiled_method_name =~ /\A_#{self.class.digest(:virtual_path => @args[:virtual_path])}_/
|
230
|
-
ActionDispatch::DebugView.send :remove_method, compiled_method_name
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
214
|
+
# Check if method is compiled for the current virtual path.
|
215
|
+
#
|
216
|
+
# If the compiled method does not contain the current deface digest
|
217
|
+
# then remove the old method - this will allow the template to be
|
218
|
+
# recompiled the next time it is rendered (showing the latest changes).
|
219
|
+
def expire_compiled_template
|
220
|
+
virtual_path = args[:virtual_path]
|
221
|
+
|
222
|
+
method_name = Deface.template_class.instance_methods.detect do |name|
|
223
|
+
name =~ /#{virtual_path.gsub(/[^a-z_]/, '_')}/
|
234
224
|
end
|
235
225
|
|
226
|
+
if method_name && method_name !~ /\A_#{self.class.digest(virtual_path: virtual_path)}_/
|
227
|
+
Deface.template_class.send :remove_method, method_name
|
228
|
+
end
|
229
|
+
end
|
236
230
|
end
|
237
231
|
|
238
232
|
end
|
data/lib/deface/railtie.rb
CHANGED
@@ -39,13 +39,7 @@ module Deface
|
|
39
39
|
tweak_eager_loading(app)
|
40
40
|
|
41
41
|
# railites / engines / extensions
|
42
|
-
railties
|
43
|
-
app.railties._all
|
44
|
-
else
|
45
|
-
app.railties.all
|
46
|
-
end
|
47
|
-
|
48
|
-
railties.each do |railtie|
|
42
|
+
app.railties._all.each do |railtie|
|
49
43
|
next unless railtie.respond_to?(:root) && railtie.config.respond_to?(:eager_load_paths)
|
50
44
|
|
51
45
|
tweak_eager_loading(railtie)
|
@@ -95,7 +89,7 @@ module Deface
|
|
95
89
|
paths_to_reject = railtie.config.eager_load_paths.select { |path| path.to_s =~ /app\/overrides\z/ }
|
96
90
|
railtie.config.eager_load_paths = railtie.config.eager_load_paths.reject { |path| path.in?(paths_to_reject) }
|
97
91
|
|
98
|
-
if Rails.
|
92
|
+
if Rails.configuration.respond_to?(:autoloader) && Rails.configuration.autoloader == :zeitwerk
|
99
93
|
Rails.autoloaders.each { |autoloader| autoloader.ignore(*paths_to_reject) }
|
100
94
|
end
|
101
95
|
end
|
@@ -1,101 +1,146 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
include_context "mock Rails.application"
|
6
|
-
|
7
|
-
describe "with no overrides defined" do
|
8
|
-
before(:each) do
|
9
|
-
@updated_at = Time.now - 600
|
10
|
-
@template = ActionView::Template.new("<p>test</p>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html, :updated_at => @updated_at})
|
11
|
-
#stub for Rails < 3.1
|
12
|
-
unless defined?(@template.updated_at)
|
13
|
-
allow(@template).to receive(:updated_at).and_return(@updated_at)
|
14
|
-
end
|
15
|
-
end
|
3
|
+
describe Deface::ActionViewExtensions do
|
4
|
+
include_context "mock Rails.application"
|
16
5
|
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
before supports_updated_at: true do
|
7
|
+
skip "Current Rails doesn't support the updated_at attribute on ActionView" unless supports_updated_at?
|
8
|
+
end
|
20
9
|
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
let(:template) { ActionView::Template.new(
|
11
|
+
source,
|
12
|
+
path,
|
13
|
+
handler,
|
14
|
+
**options,
|
15
|
+
**(supports_updated_at? ? {updated_at: updated_at} : {})
|
16
|
+
) }
|
17
|
+
|
18
|
+
let(:source) { "<p>test</p>" }
|
19
|
+
let(:path) { "/some/path/to/file.erb" }
|
20
|
+
let(:handler) { ActionView::Template::Handlers::ERB }
|
21
|
+
let(:options) {{
|
22
|
+
virtual_path: virtual_path,
|
23
|
+
format: format,
|
24
|
+
locals: {}
|
25
|
+
}}
|
26
|
+
let(:format) { :html }
|
27
|
+
let(:virtual_path) { "posts/index" }
|
28
|
+
|
29
|
+
let(:supports_updated_at?) { Deface.before_rails_6? }
|
30
|
+
let(:updated_at) { Time.now - 600 }
|
31
|
+
|
32
|
+
describe "with no overrides defined" do
|
33
|
+
it "should initialize new template object" do
|
34
|
+
expect(template.is_a?(ActionView::Template)).to eq(true)
|
35
|
+
end
|
24
36
|
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
it "should return unmodified source" do
|
38
|
+
expect(template.source).to eq("<p>test</p>")
|
39
|
+
end
|
28
40
|
|
41
|
+
it "should not change updated_at", :supports_updated_at do
|
42
|
+
expect(template.updated_at).to eq(updated_at)
|
29
43
|
end
|
44
|
+
end
|
30
45
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :remove => "p", :text => "<h1>Argh!</h1>")
|
35
|
-
@template = ActionView::Template.new("<p>test</p><%= raw(text) %>", "/some/path/to/file.erb", ActionView::Template::Handlers::ERB, {:virtual_path=>"posts/index", :format=>:html, :updated_at => @updated_at})
|
36
|
-
#stub for Rails < 3.1
|
37
|
-
unless defined?(@template.updated_at)
|
38
|
-
allow(@template).to receive(:updated_at).and_return(@updated_at + 500)
|
39
|
-
end
|
40
|
-
end
|
46
|
+
describe "with a single remove override defined" do
|
47
|
+
let(:updated_at) { Time.now - 300 }
|
48
|
+
let(:source) { "<p>test</p><%= raw(text) %>" }
|
41
49
|
|
42
|
-
|
43
|
-
|
44
|
-
|
50
|
+
before do
|
51
|
+
Deface::Override.new(virtual_path: "posts/index", name: "Posts#index", remove: "p", text: "<h1>Argh!</h1>")
|
52
|
+
end
|
45
53
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
expect(@template.updated_at).to be > @updated_at
|
53
|
-
end
|
54
|
-
end
|
54
|
+
it "should return modified source" do
|
55
|
+
expect(template.source).to eq("<%= raw(text) %>")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should change updated_at", :supports_updated_at do
|
59
|
+
expect(template.updated_at).to be > updated_at
|
55
60
|
end
|
61
|
+
end
|
56
62
|
|
57
|
-
|
58
|
-
|
63
|
+
describe "#method_name" do
|
64
|
+
before do
|
65
|
+
ActionView::Template.define_method(
|
66
|
+
:method_name_without_deface,
|
67
|
+
ActionView::Template.instance_method(:method_name)
|
68
|
+
)
|
69
|
+
end
|
59
70
|
|
60
|
-
|
61
|
-
|
71
|
+
it "returns hash of overrides plus original method_name " do
|
72
|
+
deface_hash = Deface::Override.digest(virtual_path: 'posts/index')
|
73
|
+
super_method = template.method(:method_name).super_method
|
74
|
+
method_name = "_#{Digest::MD5.new.update("#{deface_hash}_#{super_method.call}").hexdigest}"
|
62
75
|
|
63
|
-
|
64
|
-
|
76
|
+
expect(template.send(:method_name)).to eq(method_name)
|
77
|
+
end
|
78
|
+
end
|
65
79
|
|
66
|
-
|
67
|
-
|
68
|
-
|
80
|
+
describe "non erb or haml template" do
|
81
|
+
let(:source) { "xml.post => :blah" }
|
82
|
+
let(:path) { "/some/path/to/file.erb" }
|
83
|
+
let(:handler) { ActionView::Template::Handlers::Builder }
|
84
|
+
let(:updated_at) { Time.now - 100 }
|
85
|
+
let(:format) { :xml }
|
86
|
+
|
87
|
+
before(:each) do
|
88
|
+
Deface::Override.new(virtual_path: "posts/index", name: "Posts#index", remove: "p")
|
69
89
|
end
|
70
90
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
91
|
+
it "should return unmodified source" do
|
92
|
+
expect(template.source).to eq("xml.post => :blah")
|
93
|
+
expect(template.source).not_to include("=>")
|
94
|
+
end
|
95
|
+
end
|
76
96
|
|
77
|
-
|
78
|
-
|
79
|
-
|
97
|
+
describe ".determine_syntax(handler)" do
|
98
|
+
let(:source) { "xml.post => :blah" }
|
99
|
+
let(:format) { :xml }
|
100
|
+
|
101
|
+
# Not so BDD, but it keeps us from making mistakes in the future for instance,
|
102
|
+
# we test ActionView::Template here with a handler == ....::Handlers::ERB,
|
103
|
+
# while in rails it seems it's an instance of ...::Handlers::ERB.
|
104
|
+
it "recognizes supported syntaxes" do
|
105
|
+
expectations = { Haml::Plugin => :haml,
|
106
|
+
ActionView::Template::Handlers::ERB => :erb,
|
107
|
+
ActionView::Template::Handlers::ERB.new => :erb,
|
108
|
+
ActionView::Template::Handlers::Builder => nil }
|
109
|
+
expectations.each do |handler, expected|
|
110
|
+
expect(template.is_a?(ActionView::Template)).to eq(true)
|
111
|
+
expect(described_class.determine_syntax(handler)).to eq(expected), "unexpected result for handler #{handler}"
|
80
112
|
end
|
81
113
|
end
|
114
|
+
end
|
82
115
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
expectations.each do |handler, expected|
|
93
|
-
@template = ActionView::Template.new("xml.post => :blah", "/some/path/to/file.erb", handler, {:virtual_path=>"posts/index", :format=>:xml, :updated_at => (Time.now - 100)})
|
94
|
-
expect(@template.is_a?(ActionView::Template)).to eq(true)
|
95
|
-
syntax = @template.send(:determine_syntax, handler)
|
96
|
-
expect(@template.send(:should_be_defaced?, syntax)).to eq(expected), "unexpected result for handler "+handler.to_s
|
97
|
-
end
|
116
|
+
describe '#render' do
|
117
|
+
let(:source) { "<p>test</p><%= raw(text) %>".inspect }
|
118
|
+
let(:local_assigns) { {text: "some <br> text"} }
|
119
|
+
let(:lookup_context) { ActionView::LookupContext.new(["#{__dir__}/views"]) }
|
120
|
+
let(:view) do
|
121
|
+
if Rails::VERSION::STRING >= '6.1'
|
122
|
+
ActionView::Base.with_empty_template_cache.new(lookup_context, {}, nil)
|
123
|
+
else
|
124
|
+
ActionView::Base.new(lookup_context)
|
98
125
|
end
|
99
126
|
end
|
127
|
+
let(:options) { {
|
128
|
+
virtual_path: virtual_path,
|
129
|
+
format: format,
|
130
|
+
locals: local_assigns.keys
|
131
|
+
} }
|
132
|
+
|
133
|
+
let!(:deface) {
|
134
|
+
Deface::Override.new(
|
135
|
+
virtual_path: virtual_path,
|
136
|
+
name: "Posts#index",
|
137
|
+
replace: "p",
|
138
|
+
text: "<h1>Argh!</h1>"
|
139
|
+
)
|
140
|
+
}
|
141
|
+
|
142
|
+
it 'renders the template modified by deface' do
|
143
|
+
expect(template.render(view, local_assigns)).to eq(%{"<h1>Argh!</h1>some <br> text"})
|
144
|
+
end
|
100
145
|
end
|
101
146
|
end
|
@@ -19,8 +19,6 @@ module Deface
|
|
19
19
|
Deface::Override.new(:virtual_path => "posts/new", :name => "Posts#new", :replace => "h1", :text => "<h1>argh!</h1>")
|
20
20
|
end
|
21
21
|
|
22
|
-
let(:railties_collection_accessor) { Rails.version >= "4.0" ? :_all : :all }
|
23
|
-
|
24
22
|
describe ".overrides" do
|
25
23
|
|
26
24
|
it "should return all overrides" do
|
@@ -37,7 +35,7 @@ module Deface
|
|
37
35
|
before do
|
38
36
|
allow(Rails.application).to receive_messages :root => Pathname.new(File.join(File.dirname(__FILE__), '..', "assets"))
|
39
37
|
allow(Rails.application).to receive_messages :paths => {}
|
40
|
-
allow(Rails.application).to receive_message_chain :railties,
|
38
|
+
allow(Rails.application).to receive_message_chain :railties, :_all => []
|
41
39
|
|
42
40
|
expect(Deface::DSL::Loader).to receive(:register)
|
43
41
|
end
|
@@ -54,7 +52,7 @@ module Deface
|
|
54
52
|
end
|
55
53
|
|
56
54
|
it "should enumerate_and_load nil when railtie has no app/overrides path set" do
|
57
|
-
allow(Rails.application).to receive_message_chain :railties,
|
55
|
+
allow(Rails.application).to receive_message_chain :railties, :_all => [double('railtie', :root => "/some/path")]
|
58
56
|
|
59
57
|
expect(Rails.application.config.deface.overrides).to receive(:enumerate_and_load).with(nil, Rails.application.root)
|
60
58
|
expect(Rails.application.config.deface.overrides).to receive(:enumerate_and_load).with(nil, "/some/path")
|
@@ -62,7 +60,7 @@ module Deface
|
|
62
60
|
end
|
63
61
|
|
64
62
|
it "should enumerate_and_load path when railtie has app/overrides path set" do
|
65
|
-
allow(Rails.application).to receive_message_chain :railties,
|
63
|
+
allow(Rails.application).to receive_message_chain :railties, :_all => [ double('railtie', :root => "/some/path", :paths => {"app/overrides" => ["app/some_path"] } )]
|
66
64
|
|
67
65
|
expect(Rails.application.config.deface.overrides).to receive(:enumerate_and_load).with(nil, Rails.application.root)
|
68
66
|
expect(Rails.application.config.deface.overrides).to receive(:enumerate_and_load).with(["app/some_path"] , "/some/path")
|
@@ -70,7 +68,7 @@ module Deface
|
|
70
68
|
end
|
71
69
|
|
72
70
|
it "should enumerate_and_load railties first, followed by the application iteslf" do
|
73
|
-
allow(Rails.application).to receive_message_chain :railties,
|
71
|
+
allow(Rails.application).to receive_message_chain :railties, :_all => [ double('railtie', :root => "/some/path", :paths => {"app/overrides" => ["app/some_path"] } )]
|
74
72
|
|
75
73
|
expect(Rails.application.config.deface.overrides).to receive(:enumerate_and_load).with(["app/some_path"] , "/some/path").ordered
|
76
74
|
expect(Rails.application.config.deface.overrides).to receive(:enumerate_and_load).with(nil, Rails.application.root).ordered
|
@@ -79,7 +77,7 @@ module Deface
|
|
79
77
|
|
80
78
|
it "should ignore railtie with no root" do
|
81
79
|
railtie = double('railtie')
|
82
|
-
allow(Rails.application).to receive_message_chain :railties,
|
80
|
+
allow(Rails.application).to receive_message_chain :railties, :_all => [railtie]
|
83
81
|
|
84
82
|
expect(railtie).to receive(:respond_to?).with(:root)
|
85
83
|
expect(railtie).not_to receive(:respond_to?).with(:paths)
|
@@ -101,7 +99,7 @@ module Deface
|
|
101
99
|
|
102
100
|
it "should keep a reference to which railtie/app defined the override" do
|
103
101
|
allow(Rails.application).to receive_messages :root => assets_path, :paths => {"app/overrides" => ["dummy_app"] }
|
104
|
-
allow(Rails.application).to receive_message_chain :railties,
|
102
|
+
allow(Rails.application).to receive_message_chain :railties, :_all => [ engine ]
|
105
103
|
|
106
104
|
Rails.application.config.deface.overrides.load_all(Rails.application)
|
107
105
|
|
@@ -127,10 +125,8 @@ module Deface
|
|
127
125
|
end
|
128
126
|
|
129
127
|
it "should add paths to watchable_dir when running Rails 3.2" do
|
130
|
-
|
131
|
-
|
132
|
-
expect(Rails.application.config.watchable_dirs).to eq({"/some/path/app/gold" => [:rb, :deface] })
|
133
|
-
end
|
128
|
+
Rails.application.config.deface.overrides.send(:enumerate_and_load, ["app/gold"], root)
|
129
|
+
expect(Rails.application.config.watchable_dirs).to eq({"/some/path/app/gold" => [:rb, :deface] })
|
134
130
|
end
|
135
131
|
|
136
132
|
end
|
@@ -561,7 +561,7 @@ module Deface
|
|
561
561
|
|
562
562
|
describe "#expire_compiled_template" do
|
563
563
|
it "should remove compiled method when method name matches virtual path but not digest" do
|
564
|
-
if
|
564
|
+
if Deface.before_rails_6?
|
565
565
|
instance_methods_count = ActionView::CompiledTemplates.instance_methods.size
|
566
566
|
|
567
567
|
module ActionView::CompiledTemplates
|
@@ -598,7 +598,7 @@ module Deface
|
|
598
598
|
end
|
599
599
|
|
600
600
|
it "should not remove compiled method when virtual path and digest matach" do
|
601
|
-
if
|
601
|
+
if Deface.before_rails_6?
|
602
602
|
instance_methods_count = ActionView::CompiledTemplates.instance_methods.size
|
603
603
|
|
604
604
|
module ActionView::CompiledTemplates
|
data/spec/spec_helper.rb
CHANGED
@@ -2,13 +2,12 @@ require 'simplecov'
|
|
2
2
|
SimpleCov.start 'rails'
|
3
3
|
require 'rspec'
|
4
4
|
require 'active_support'
|
5
|
-
require 'action_view'
|
6
|
-
require 'action_controller'
|
7
5
|
require 'deface'
|
8
6
|
require 'rails/generators'
|
9
7
|
# have to manually require following for testing purposes
|
10
8
|
require 'deface/action_view_extensions'
|
11
9
|
require 'rails/version'
|
10
|
+
require 'pry'
|
12
11
|
|
13
12
|
#adding fake class as it's needed by haml 4.0, don't
|
14
13
|
#want to have to require the entire rails stack in specs.
|
@@ -42,7 +41,7 @@ RSpec.configure do |config|
|
|
42
41
|
config.mock_framework = :rspec
|
43
42
|
end
|
44
43
|
|
45
|
-
if
|
44
|
+
if Deface.before_rails_6?
|
46
45
|
module ActionView::CompiledTemplates
|
47
46
|
#empty module for testing purposes
|
48
47
|
end
|
@@ -69,9 +68,7 @@ shared_context "mock Rails" do
|
|
69
68
|
allow(Rails.application.config).to receive(:deface).and_return ActiveSupport::OrderedOptions.new
|
70
69
|
Rails.application.config.deface.enabled = true
|
71
70
|
|
72
|
-
|
73
|
-
allow(Rails.application.config).to receive(:watchable_dirs).and_return({})
|
74
|
-
end
|
71
|
+
allow(Rails.application.config).to receive(:watchable_dirs).and_return({})
|
75
72
|
|
76
73
|
allow(Rails).to receive(:root).and_return Pathname.new('spec/dummy')
|
77
74
|
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian D Quinn
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.2'
|
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
|
-
version: '
|
40
|
+
version: '5.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rainbow
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,6 +170,20 @@ dependencies:
|
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0.8'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: pry
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
173
187
|
description: Deface is a library that allows you to customize ERB, Haml and Slim views
|
174
188
|
in a Rails application without editing the underlying view.
|
175
189
|
email: brian@spreecommerce.com
|
@@ -177,7 +191,6 @@ executables: []
|
|
177
191
|
extensions: []
|
178
192
|
extra_rdoc_files:
|
179
193
|
- README.markdown
|
180
|
-
- CHANGELOG.markdown
|
181
194
|
files:
|
182
195
|
- ".gitignore"
|
183
196
|
- ".rspec"
|
@@ -188,13 +201,15 @@ files:
|
|
188
201
|
- MIT-LICENSE
|
189
202
|
- README.markdown
|
190
203
|
- Rakefile
|
204
|
+
- bin/rails
|
205
|
+
- bin/rails-engine
|
206
|
+
- bin/rails-sandbox
|
207
|
+
- bin/sandbox
|
208
|
+
- bin/sandbox-setup
|
191
209
|
- deface.gemspec
|
192
|
-
- gemfiles/rails_4.2.gemfile
|
193
|
-
- gemfiles/rails_5.0.gemfile
|
194
|
-
- gemfiles/rails_5.1.gemfile
|
195
210
|
- gemfiles/rails_5.2.gemfile
|
196
211
|
- gemfiles/rails_6.0.gemfile
|
197
|
-
-
|
212
|
+
- gemfiles/rails_6_1.gemfile
|
198
213
|
- lib/deface.rb
|
199
214
|
- lib/deface/action_view_extensions.rb
|
200
215
|
- lib/deface/actions/action.rb
|
@@ -218,6 +233,7 @@ files:
|
|
218
233
|
- lib/deface/dsl/context.rb
|
219
234
|
- lib/deface/dsl/loader.rb
|
220
235
|
- lib/deface/environment.rb
|
236
|
+
- lib/deface/errors.rb
|
221
237
|
- lib/deface/generators
|
222
238
|
- lib/deface/haml_converter.rb
|
223
239
|
- lib/deface/matchers/element.rb
|
@@ -240,6 +256,7 @@ files:
|
|
240
256
|
- lib/deface/sources/text.rb
|
241
257
|
- lib/deface/template_helper.rb
|
242
258
|
- lib/deface/utils/failure_finder.rb
|
259
|
+
- lib/deface/version.rb
|
243
260
|
- lib/generators/deface/USAGE
|
244
261
|
- lib/generators/deface/override_generator.rb
|
245
262
|
- lib/generators/deface/templates/override.html.erb.deface
|
@@ -286,10 +303,14 @@ files:
|
|
286
303
|
- spec/spec_helper.rb
|
287
304
|
- tasks/precompile.rake
|
288
305
|
- tasks/utils.rake
|
289
|
-
homepage: https://github.com/spree/deface
|
290
|
-
licenses:
|
291
|
-
|
292
|
-
|
306
|
+
homepage: https://github.com/spree/deface#readme
|
307
|
+
licenses:
|
308
|
+
- MIT
|
309
|
+
metadata:
|
310
|
+
homepage_uri: https://github.com/spree/deface#readme
|
311
|
+
source_code_uri: https://github.com/spree/deface
|
312
|
+
changelog_uri: https://github.com/spree/deface/releases
|
313
|
+
post_install_message:
|
293
314
|
rdoc_options:
|
294
315
|
- "--charset=UTF-8"
|
295
316
|
require_paths:
|
@@ -298,15 +319,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
319
|
requirements:
|
299
320
|
- - ">="
|
300
321
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
322
|
+
version: 2.5.0
|
302
323
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
324
|
requirements:
|
304
325
|
- - ">="
|
305
326
|
- !ruby/object:Gem::Version
|
306
327
|
version: '0'
|
307
328
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
309
|
-
signing_key:
|
329
|
+
rubygems_version: 3.2.3
|
330
|
+
signing_key:
|
310
331
|
specification_version: 4
|
311
332
|
summary: Deface is a library that allows you to customize ERB, Haml and Slim views
|
312
333
|
in Rails
|
data/gemfiles/rails_5.0.gemfile
DELETED
data/gemfiles/rails_5.1.gemfile
DELETED
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'deface'
|