blocks 2.8.0 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +4 -4
- data/.travis.yml +51 -0
- data/Gemfile +15 -2
- data/Guardfile +15 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +3 -7
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/blocks.gemspec +18 -11
- data/gemfiles/Gemfile.rails-3-0-stable +13 -0
- data/gemfiles/Gemfile.rails-3-1-stable +13 -0
- data/gemfiles/Gemfile.rails-3-2-stable +13 -0
- data/gemfiles/Gemfile.rails-4-0-stable +12 -0
- data/gemfiles/Gemfile.rails-4-1-stable +12 -0
- data/gemfiles/Gemfile.rails-4-2-stable +12 -0
- data/gemfiles/Gemfile.rails-5-0-stable +10 -0
- data/gemfiles/Gemfile.rails-5-1-stable +10 -0
- data/lib/blocks.rb +41 -20
- data/lib/blocks/action_view_extensions/view_extensions.rb +26 -0
- data/lib/blocks/builders/block_definition.rb +71 -0
- data/lib/blocks/builders/builder.rb +159 -0
- data/lib/blocks/builders/hook_definition.rb +25 -0
- data/lib/blocks/experimental/builder_permissions.rb +52 -0
- data/lib/blocks/experimental/invalid_permissions_handler.rb +27 -0
- data/lib/blocks/renderers/abstract_renderer.rb +69 -0
- data/lib/blocks/renderers/adjacent_blocks_renderer.rb +15 -0
- data/lib/blocks/renderers/block_placeholder.rb +13 -0
- data/lib/blocks/renderers/block_renderer.rb +13 -0
- data/lib/blocks/renderers/block_with_hooks_renderer.rb +35 -0
- data/lib/blocks/renderers/collection_renderer.rb +17 -0
- data/lib/blocks/renderers/nesting_blocks_renderer.rb +24 -0
- data/lib/blocks/renderers/partial_renderer.rb +18 -0
- data/lib/blocks/renderers/renderer.rb +43 -0
- data/lib/blocks/renderers/runtime_context.rb +193 -0
- data/lib/blocks/renderers/wrapper_renderer.rb +19 -0
- data/lib/blocks/utilities/configurator.rb +26 -0
- data/lib/blocks/utilities/dynamic_configuration.rb +71 -0
- data/lib/blocks/utilities/hash_with_caller.rb +73 -0
- data/lib/blocks/utilities/hash_with_render_strategy.rb +47 -0
- data/lib/blocks/utilities/options_set.rb +95 -0
- data/lib/blocks/version.rb +1 -1
- metadata +70 -80
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/README.rdoc +0 -99
- data/blocks_render_order.graffle +0 -1397
- data/blocks_render_order.png +0 -0
- data/lib/blocks/base.rb +0 -580
- data/lib/blocks/container.rb +0 -5
- data/lib/blocks/controller_additions.rb +0 -9
- data/lib/blocks/view_additions.rb +0 -10
- data/rails/init.rb +0 -1
- data/spec/blocks/base_spec.rb +0 -641
- data/spec/blocks/blocks_spec.rb +0 -12
- data/spec/blocks/view_additions_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -22
data/spec/blocks/blocks_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Blocks do
|
4
|
-
it "should provide a setup method that can be called from an initializer" do
|
5
|
-
Blocks.config.partials_folder.should eql("blocks")
|
6
|
-
Blocks.setup do |config|
|
7
|
-
config.should be_a(Hashie::Mash)
|
8
|
-
config.partials_folder = "shared"
|
9
|
-
end
|
10
|
-
Blocks.config.partials_folder.should eql("shared")
|
11
|
-
end
|
12
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Blocks::ViewAdditions do
|
4
|
-
before(:each) do
|
5
|
-
@view_class = Class.new
|
6
|
-
@view = @view_class.new
|
7
|
-
@view_class.send(:include, Blocks::ViewAdditions)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#blocks" do
|
11
|
-
it "should pass the view as the only parameter to Blocks::Base initialization" do
|
12
|
-
Blocks::Base.expects(:new).with {|view| view == @view}
|
13
|
-
@view.blocks
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should memoize the Blocks::Base instance for 'blocks' call" do
|
17
|
-
Blocks::Base.expects(:new).once.with {|view| view == @view}.returns "something"
|
18
|
-
@view.blocks.should eql "something"
|
19
|
-
@view.blocks.should eql "something"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
require 'ruby-debug'
|
4
|
-
|
5
|
-
require 'blocks' # and any other gems you need
|
6
|
-
|
7
|
-
def print_hash(hash)
|
8
|
-
hash.inject("") { |s, (k, v)| "#{s} #{k}: #{v}." }
|
9
|
-
end
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.mock_with :mocha
|
13
|
-
|
14
|
-
config.before :each do
|
15
|
-
Blocks.setup do |config|
|
16
|
-
config.partials_folder = "blocks"
|
17
|
-
config.wrap_before_and_after_blocks = false
|
18
|
-
config.use_partials = false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|