blocks 3.0.0.rc2 → 3.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Gemfile +6 -4
- data/blocks.gemspec +0 -2
- data/gemfiles/Gemfile.rails-3-0-stable +2 -0
- data/gemfiles/Gemfile.rails-3-1-stable +2 -0
- data/gemfiles/Gemfile.rails-3-2-stable +2 -0
- data/gemfiles/Gemfile.rails-4-0-stable +2 -0
- data/gemfiles/Gemfile.rails-4-1-stable +2 -0
- data/gemfiles/Gemfile.rails-4-2-stable +2 -0
- data/gemfiles/Gemfile.rails-5-0-stable +2 -0
- data/gemfiles/Gemfile.rails-5-1-stable +2 -0
- data/lib/blocks/builders/builder.rb +6 -0
- data/lib/blocks/renderers/abstract_renderer.rb +1 -1
- data/lib/blocks/renderers/adjacent_blocks_renderer.rb +2 -2
- data/lib/blocks/renderers/nesting_blocks_renderer.rb +4 -4
- data/lib/blocks/renderers/renderer.rb +1 -4
- data/lib/blocks/utilities/configurator.rb +1 -1
- data/lib/blocks/version.rb +1 -1
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 242d94c843469d6a2d4157e4cc145043c4895a79
|
4
|
+
data.tar.gz: 842fdfde31635095c2792cdffd18289f27a13ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3369f0bdf67c5c843e86f9970439c3fbff4d9f016720b20cac2a0bcd7c7c982bb3bf93d35b57e22b35f9a4a6ab65de1664af6a05bd70806ef0afb4efb9216e7
|
7
|
+
data.tar.gz: 38fcbef4d4c1c88f786fa168f0bf551f6bcb62e0aa2aae3327a7d5f2295a6b48f43d82bc24a328a9b7f4efef489ceaf2740010ba72803f56b60a04a5faaf9726
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
@@ -2,15 +2,17 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
+
gem "nokogiri"
|
6
|
+
gem "capybara"
|
5
7
|
gem "rspec", "~> 3.6.0"
|
6
8
|
gem "rails", github: "rails/rails"
|
7
|
-
gem 'rack'
|
9
|
+
gem 'rack'
|
8
10
|
gem "shoulda-matchers", "~> 2.0"
|
9
|
-
gem "haml"
|
11
|
+
gem "haml"
|
10
12
|
|
11
13
|
# Extra development utilities
|
12
|
-
gem 'ruby_dep'
|
14
|
+
gem 'ruby_dep'
|
13
15
|
gem 'guard-rspec', '~> 4.7'
|
14
16
|
gem "terminal-notifier-guard"
|
15
17
|
gem "byebug"
|
16
|
-
gem "codeclimate-test-reporter", "~> 1.0.
|
18
|
+
gem "codeclimate-test-reporter", "~> 1.0.8"
|
data/blocks.gemspec
CHANGED
@@ -30,7 +30,5 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "call_with_params"
|
31
31
|
spec.add_dependency "rails", ">= 3.0.0"
|
32
32
|
|
33
|
-
spec.add_development_dependency "nokogiri", "1.6.8.1"
|
34
|
-
spec.add_development_dependency "capybara"
|
35
33
|
spec.add_development_dependency "simplecov"
|
36
34
|
end
|
@@ -30,6 +30,12 @@ module Blocks
|
|
30
30
|
CONTENT_TAG_WRAPPER_BLOCK = :content_tag_wrapper
|
31
31
|
|
32
32
|
def initialize(view, options={})
|
33
|
+
if defined?(::Haml) && !view.instance_variables.include?(:@haml_buffer)
|
34
|
+
class << view
|
35
|
+
include Haml::Helpers
|
36
|
+
end
|
37
|
+
view.init_haml_helpers
|
38
|
+
end
|
33
39
|
self.view = view
|
34
40
|
self.block_definitions = HashWithIndifferentAccess.new do |hash, key|
|
35
41
|
hash[key] = BlockDefinition.new(key); hash[key]
|
@@ -49,7 +49,7 @@ module Blocks
|
|
49
49
|
# the block would need to be captured in Haml using a Haml buffer.
|
50
50
|
# This workaround accomplishes that.
|
51
51
|
def without_haml_interference(&block)
|
52
|
-
if view.instance_variables.include?(:@haml_buffer)
|
52
|
+
if defined?(::Haml) && view.instance_variables.include?(:@haml_buffer)
|
53
53
|
haml_buffer = view.instance_variable_get(:@haml_buffer)
|
54
54
|
if haml_buffer
|
55
55
|
was_active = haml_buffer.active?
|
@@ -5,8 +5,8 @@ module Blocks
|
|
5
5
|
if block
|
6
6
|
hooks = block.hooks_for hook
|
7
7
|
hooks = hooks.reverse if hook.to_s.index("before") == 0 || hook.to_s.index("prepend") == 0
|
8
|
-
hooks.each do |
|
9
|
-
hook_runtime_context = runtime_context.extend_to_block_definition(
|
8
|
+
hooks.each do |hook_definition|
|
9
|
+
hook_runtime_context = runtime_context.extend_to_block_definition(hook_definition)
|
10
10
|
block_renderer.render(hook_runtime_context)
|
11
11
|
end
|
12
12
|
end
|
@@ -2,12 +2,12 @@ module Blocks
|
|
2
2
|
class NestingBlocksRenderer < AbstractRenderer
|
3
3
|
def render(hook, runtime_context, &block)
|
4
4
|
block = block_for(runtime_context.block_name)
|
5
|
-
|
5
|
+
hooks = block.try(:hooks_for, hook)
|
6
|
+
if hooks.present?
|
6
7
|
content_block = Proc.new { with_output_buffer { yield } }
|
7
|
-
hooks = block.hooks_for(hook)
|
8
8
|
|
9
|
-
renderer = hooks.inject(content_block) do |inner_content,
|
10
|
-
hook_runtime_context = runtime_context.extend_to_block_definition(
|
9
|
+
renderer = hooks.inject(content_block) do |inner_content, hook_definition|
|
10
|
+
hook_runtime_context = runtime_context.extend_to_block_definition(hook_definition)
|
11
11
|
Proc.new {
|
12
12
|
with_output_buffer do
|
13
13
|
block_renderer.render(inner_content, hook_runtime_context)
|
@@ -1,15 +1,12 @@
|
|
1
1
|
module Blocks
|
2
2
|
class Renderer
|
3
3
|
attr_accessor :builder
|
4
|
+
delegate :render, to: :block_with_hooks_renderer
|
4
5
|
|
5
6
|
def initialize(builder)
|
6
7
|
self.builder = builder
|
7
8
|
end
|
8
9
|
|
9
|
-
def render(*args, &block)
|
10
|
-
block_with_hooks_renderer.render(*args, &block)
|
11
|
-
end
|
12
|
-
|
13
10
|
# TODO: this needs to be handled by a new renderer
|
14
11
|
def render_with_overrides(*args, &block)
|
15
12
|
options = args.extract_options!
|
@@ -17,7 +17,7 @@ module Blocks
|
|
17
17
|
configure do |config|
|
18
18
|
config.builder_class = Builder
|
19
19
|
config.renderer_class = Renderer
|
20
|
-
config.lookup_caller_location =
|
20
|
+
config.lookup_caller_location = false
|
21
21
|
config.global_options_set = OptionsSet.new("Global Options")
|
22
22
|
end
|
23
23
|
end
|
data/lib/blocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hunter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: call_with_params
|
@@ -38,34 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.0.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: nokogiri
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.6.8.1
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.6.8.1
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: capybara
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: simplecov
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|