deface 1.5.1 → 1.6.2
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 +2 -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 +45 -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 -2
- 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 +15 -9
- data/lib/deface/version.rb +9 -0
- data/spec/deface/action_view_template_spec.rb +121 -70
- data/spec/deface/environment_spec.rb +8 -12
- data/spec/deface/override_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -6
- metadata +53 -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: d70515c1f6f72cef4d6b7d34d936e5fac929ddda6a896cbd9c0c30dddff8c19e
|
4
|
+
data.tar.gz: e6950eb7f793b4111513744ddb48d7ad7a83a918a1f9b8850619b41c7864f515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd12b650a9104d57bc0b17c7a88324ff77008516e0fa789724f0622f59b26160050ac1eafa9dc42c73b51a93942ccb9c45902761e629f525fd32685a62afbdc9
|
7
|
+
data.tar.gz: 4924e7dfd0a97adf3acebe4f4f15c5d3146e64aea5f75b9d64c0ac5746f9320678988d23af84b196ef30a2e8f1e4f1e8e37d546a5bad676fb12c6fecfc63e596
|
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,46 @@
|
|
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('gem-release')
|
40
|
+
spec.add_development_dependency('rspec', '>= 3.1.0')
|
41
|
+
spec.add_development_dependency('haml', ['>= 4.0', '< 6'])
|
42
|
+
spec.add_development_dependency('slim', '~> 3.0')
|
43
|
+
spec.add_development_dependency('simplecov', '>= 0.6.4')
|
44
|
+
spec.add_development_dependency('generator_spec', '~> 0.8')
|
45
|
+
spec.add_development_dependency('pry')
|
30
46
|
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 if respond_to?(:refresh)
|
45
|
+
end
|
46
|
+
buffer.nil? ? super(view, locals, buffer, &block) : 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,8 +48,8 @@ module Deface
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
#
|
52
|
-
details[:updated_at] = Time.now
|
51
|
+
# Prevents any caching by rails in development mode.
|
52
|
+
details[:updated_at] = Time.now if Deface.before_rails_6?
|
53
53
|
|
54
54
|
source = doc.to_s
|
55
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
@@ -36,19 +36,15 @@ module Deface
|
|
36
36
|
initializer "deface.tweak_eager_loading", :before => :set_load_path do |app|
|
37
37
|
|
38
38
|
# application
|
39
|
-
app
|
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
|
+
|
45
|
+
tweak_eager_loading(railtie)
|
51
46
|
end
|
47
|
+
|
52
48
|
end
|
53
49
|
|
54
50
|
# sets up deface environment and requires / loads all
|
@@ -87,5 +83,15 @@ module Deface
|
|
87
83
|
end
|
88
84
|
end
|
89
85
|
|
86
|
+
private
|
87
|
+
|
88
|
+
def tweak_eager_loading(railtie)
|
89
|
+
paths_to_reject = railtie.config.eager_load_paths.select { |path| path.to_s =~ /app\/overrides\z/ }
|
90
|
+
railtie.config.eager_load_paths = railtie.config.eager_load_paths.reject { |path| path.in?(paths_to_reject) }
|
91
|
+
|
92
|
+
if Rails.configuration.respond_to?(:autoloader) && Rails.configuration.autoloader == :zeitwerk
|
93
|
+
Rails.autoloaders.each { |autoloader| autoloader.ignore(*paths_to_reject) }
|
94
|
+
end
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
@@ -1,95 +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
|
-
|
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
|
49
60
|
end
|
61
|
+
end
|
50
62
|
|
51
|
-
|
52
|
-
|
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
|
53
70
|
|
54
|
-
|
55
|
-
|
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}"
|
56
75
|
|
57
|
-
|
58
|
-
|
76
|
+
expect(template.send(:method_name)).to eq(method_name)
|
77
|
+
end
|
78
|
+
end
|
59
79
|
|
60
|
-
|
61
|
-
|
62
|
-
|
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")
|
63
89
|
end
|
64
90
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
70
96
|
|
71
|
-
|
72
|
-
|
73
|
-
|
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}"
|
74
112
|
end
|
75
113
|
end
|
114
|
+
end
|
76
115
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
expectations.each do |handler, expected|
|
87
|
-
@template = ActionView::Template.new("xml.post => :blah", "/some/path/to/file.erb", handler, {:virtual_path=>"posts/index", :format=>:xml, :updated_at => (Time.now - 100)})
|
88
|
-
expect(@template.is_a?(ActionView::Template)).to eq(true)
|
89
|
-
syntax = @template.send(:determine_syntax, handler)
|
90
|
-
expect(@template.send(:should_be_defaced?, syntax)).to eq(expected), "unexpected result for handler "+handler.to_s
|
91
|
-
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)
|
92
125
|
end
|
93
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
|
94
145
|
end
|
95
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.2
|
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-02-10 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
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: gem-release
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rspec
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,6 +184,20 @@ dependencies:
|
|
170
184
|
- - "~>"
|
171
185
|
- !ruby/object:Gem::Version
|
172
186
|
version: '0.8'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: pry
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
173
201
|
description: Deface is a library that allows you to customize ERB, Haml and Slim views
|
174
202
|
in a Rails application without editing the underlying view.
|
175
203
|
email: brian@spreecommerce.com
|
@@ -177,7 +205,6 @@ executables: []
|
|
177
205
|
extensions: []
|
178
206
|
extra_rdoc_files:
|
179
207
|
- README.markdown
|
180
|
-
- CHANGELOG.markdown
|
181
208
|
files:
|
182
209
|
- ".gitignore"
|
183
210
|
- ".rspec"
|
@@ -188,13 +215,15 @@ files:
|
|
188
215
|
- MIT-LICENSE
|
189
216
|
- README.markdown
|
190
217
|
- Rakefile
|
218
|
+
- bin/rails
|
219
|
+
- bin/rails-engine
|
220
|
+
- bin/rails-sandbox
|
221
|
+
- bin/sandbox
|
222
|
+
- bin/sandbox-setup
|
191
223
|
- deface.gemspec
|
192
|
-
- gemfiles/rails_4.2.gemfile
|
193
|
-
- gemfiles/rails_5.0.gemfile
|
194
|
-
- gemfiles/rails_5.1.gemfile
|
195
224
|
- gemfiles/rails_5.2.gemfile
|
196
225
|
- gemfiles/rails_6.0.gemfile
|
197
|
-
-
|
226
|
+
- gemfiles/rails_6_1.gemfile
|
198
227
|
- lib/deface.rb
|
199
228
|
- lib/deface/action_view_extensions.rb
|
200
229
|
- lib/deface/actions/action.rb
|
@@ -218,6 +247,7 @@ files:
|
|
218
247
|
- lib/deface/dsl/context.rb
|
219
248
|
- lib/deface/dsl/loader.rb
|
220
249
|
- lib/deface/environment.rb
|
250
|
+
- lib/deface/errors.rb
|
221
251
|
- lib/deface/generators
|
222
252
|
- lib/deface/haml_converter.rb
|
223
253
|
- lib/deface/matchers/element.rb
|
@@ -240,6 +270,7 @@ files:
|
|
240
270
|
- lib/deface/sources/text.rb
|
241
271
|
- lib/deface/template_helper.rb
|
242
272
|
- lib/deface/utils/failure_finder.rb
|
273
|
+
- lib/deface/version.rb
|
243
274
|
- lib/generators/deface/USAGE
|
244
275
|
- lib/generators/deface/override_generator.rb
|
245
276
|
- lib/generators/deface/templates/override.html.erb.deface
|
@@ -286,10 +317,14 @@ files:
|
|
286
317
|
- spec/spec_helper.rb
|
287
318
|
- tasks/precompile.rake
|
288
319
|
- tasks/utils.rake
|
289
|
-
homepage: https://github.com/spree/deface
|
290
|
-
licenses:
|
291
|
-
|
292
|
-
|
320
|
+
homepage: https://github.com/spree/deface#readme
|
321
|
+
licenses:
|
322
|
+
- MIT
|
323
|
+
metadata:
|
324
|
+
homepage_uri: https://github.com/spree/deface#readme
|
325
|
+
source_code_uri: https://github.com/spree/deface
|
326
|
+
changelog_uri: https://github.com/spree/deface/releases
|
327
|
+
post_install_message:
|
293
328
|
rdoc_options:
|
294
329
|
- "--charset=UTF-8"
|
295
330
|
require_paths:
|
@@ -298,15 +333,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
333
|
requirements:
|
299
334
|
- - ">="
|
300
335
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
336
|
+
version: 2.5.0
|
302
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
338
|
requirements:
|
304
339
|
- - ">="
|
305
340
|
- !ruby/object:Gem::Version
|
306
341
|
version: '0'
|
307
342
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
309
|
-
signing_key:
|
343
|
+
rubygems_version: 3.2.3
|
344
|
+
signing_key:
|
310
345
|
specification_version: 4
|
311
346
|
summary: Deface is a library that allows you to customize ERB, Haml and Slim views
|
312
347
|
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'
|