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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4c7897223c480b20fd3787e150b311af20625db
4
- data.tar.gz: 4c864e0ee1318de35c64bc27e726b29bb0751d4e
3
+ metadata.gz: 242d94c843469d6a2d4157e4cc145043c4895a79
4
+ data.tar.gz: 842fdfde31635095c2792cdffd18289f27a13ad6
5
5
  SHA512:
6
- metadata.gz: 59d329e7bcfbc630e0e83a66405343ddd6ef3b53a954f38fe8d5b3dba68bca75e3f441e4f8fb248954d22934457f8bc78623ced9fc8058ec429b71f5543fb48a
7
- data.tar.gz: 7ba7fed39355412d3c31f3eef190cea23e04fa998b26be04dc50e4c23b82405ccb7477cca75596f13917140f75860aa18f98632e62cd3d06d618421d55e2dcb2
6
+ metadata.gz: f3369f0bdf67c5c843e86f9970439c3fbff4d9f016720b20cac2a0bcd7c7c982bb3bf93d35b57e22b35f9a4a6ab65de1664af6a05bd70806ef0afb4efb9216e7
7
+ data.tar.gz: 38fcbef4d4c1c88f786fa168f0bf551f6bcb62e0aa2aae3327a7d5f2295a6b48f43d82bc24a328a9b7f4efef489ceaf2740010ba72803f56b60a04a5faaf9726
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
1
  --colour
2
2
  --backtrace
3
+ --exclude-pattern "spec/features/*_spec.rb"
4
+ --format documentation
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', git: 'git://github.com/rack/rack.git'
9
+ gem 'rack'
8
10
  gem "shoulda-matchers", "~> 2.0"
9
- gem "haml", "~> 5.0.0"
11
+ gem "haml"
10
12
 
11
13
  # Extra development utilities
12
- gem 'ruby_dep', '~> 1.3.0'
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.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
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: ".."
4
4
 
5
+ gem "nokogiri", "1.6.8.1"
6
+ gem "capybara"
5
7
  gem "rake", "< 11.0"
6
8
  gem "public_suffix", "~> 1.4.6"
7
9
  gem "mime-types", "< 3.0"
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: ".."
4
4
 
5
+ gem "nokogiri", "1.6.8.1"
6
+ gem "capybara"
5
7
  gem "rake", "< 11.0"
6
8
  gem "public_suffix", "~> 1.4.6"
7
9
  gem "mime-types", "< 3.0"
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: ".."
4
4
 
5
+ gem "nokogiri", "1.6.8.1"
6
+ gem "capybara"
5
7
  gem "rake", "< 11.0"
6
8
  gem "public_suffix", "~> 1.4.6"
7
9
  gem "mime-types", "< 3.0"
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: ".."
4
4
 
5
+ gem "nokogiri", "1.6.8.1"
6
+ gem "capybara"
5
7
  gem "rake", "< 11.0"
6
8
  gem "public_suffix", "~> 1.4.6"
7
9
  gem "mime-types", "< 3.0"
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: ".."
4
4
 
5
+ gem "nokogiri", "1.6.8.1"
6
+ gem "capybara"
5
7
  gem "rake", "< 11.0"
6
8
  gem "public_suffix", "~> 1.4.6"
7
9
  gem "mime-types", "< 3.0"
@@ -2,6 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec path: ".."
4
4
 
5
+ gem "nokogiri", "1.6.8.1"
6
+ gem "capybara"
5
7
  gem "rake", "< 11.0"
6
8
  gem "public_suffix", "~> 1.4.6"
7
9
  gem "mime-types", "< 3.0"
@@ -4,6 +4,8 @@ gemspec path: ".."
4
4
 
5
5
  # Requires min Ruby version 2.2.2
6
6
 
7
+ gem "nokogiri", "1.6.8.1"
8
+ gem "capybara"
7
9
  gem "rspec", "~> 3.6.0"
8
10
  gem "rails", github: "rails/rails", branch: "5-0-stable"
9
11
  gem "shoulda-matchers", "~> 2.0"
@@ -4,6 +4,8 @@ gemspec path: ".."
4
4
 
5
5
  # Requires min Ruby version 2.2.2
6
6
 
7
+ gem "nokogiri", "1.6.8.1"
8
+ gem "capybara"
7
9
  gem "rspec", "~> 3.6.0"
8
10
  gem "rails", github: "rails/rails", branch: "5-1-stable"
9
11
  gem "shoulda-matchers", "~> 2.0"
@@ -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 |block_definition|
9
- hook_runtime_context = runtime_context.extend_to_block_definition(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
- if block
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, block_definition|
10
- hook_runtime_context = runtime_context.extend_to_block_definition(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 = true
20
+ config.lookup_caller_location = false
21
21
  config.global_options_set = OptionsSet.new("Global Options")
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Blocks
2
- VERSION = "3.0.0.rc2"
2
+ VERSION = "3.0.0.rc3"
3
3
  end
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.rc2
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-06-20 00:00:00.000000000 Z
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