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
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmRhYjAwZmFlNGE3YTQ2MGYxNWNmMzEwOGU3NDFkNWJhNGFlNDNiZQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8368c42c087cbd7899de66fb0db01e2df45f1914
|
4
|
+
data.tar.gz: 9b8b8dafa633483adf853110c8ae80201b38f100
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZDQwMjg0NzE4NzljMmVjZDE0MTc3YTkyODk3Nzk1NjkxOGNjNmZhNGRhMjI2
|
11
|
-
MjI4NGUwNmU2MjQ1MDE3MjFmMGI2MDZjMTI4MzE4NTliNjhmNjU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OTdlYmUwMjRhMTcwMzdmZGY5NDkyMjE4YjY5MTlhNWYxZDg0NDUxMjJiMjky
|
14
|
-
NWFiOTNlMDA0OGIwZDZiNDMxMmNiNjc2MDgwMDdjMGIyNDg3ZTZkMDI4OTJi
|
15
|
-
Yjg3YTc4ODA5ODI3MTFiMDA0MWJhMzRlMDBmNDRjZGVlZDdlNjA=
|
6
|
+
metadata.gz: 95ab7e809192edd72f89b3cc1e249f56b578be139fbbdd89b93dd6e379649551445fe2b41e3129ce7470a37e77ad8498f6420368c4b023f07fd483eeb817c99c
|
7
|
+
data.tar.gz: f6d4020302ef7242e7378a0aec69ea8677611125c23275aefce7845631affb9000ac6c3dda3528814725ed1e2eb4fd4483c5962f012fcd5e8318bdff64e10468
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1.10
|
8
|
+
- 2.2.7
|
9
|
+
- 2.3.4
|
10
|
+
- 2.4.1
|
11
|
+
|
12
|
+
gemfile:
|
13
|
+
- gemfiles/Gemfile.rails-3-0-stable
|
14
|
+
- gemfiles/Gemfile.rails-3-1-stable
|
15
|
+
- gemfiles/Gemfile.rails-3-2-stable
|
16
|
+
- gemfiles/Gemfile.rails-4-0-stable
|
17
|
+
- gemfiles/Gemfile.rails-4-1-stable
|
18
|
+
- gemfiles/Gemfile.rails-4-2-stable
|
19
|
+
- gemfiles/Gemfile.rails-5-0-stable
|
20
|
+
- gemfiles/Gemfile.rails-5-1-stable
|
21
|
+
- Gemfile
|
22
|
+
matrix:
|
23
|
+
allow_failures:
|
24
|
+
- rvm: ruby-head
|
25
|
+
exclude:
|
26
|
+
- rvm: 1.9.3
|
27
|
+
gemfile: gemfiles/Gemfile.rails-5-1-stable
|
28
|
+
- rvm: 1.9.3
|
29
|
+
gemfile: gemfiles/Gemfile.rails-5-0-stable
|
30
|
+
- rvm: 1.9.3
|
31
|
+
gemfile: Gemfile
|
32
|
+
- rvm: 2.0.0
|
33
|
+
gemfile: gemfiles/Gemfile.rails-5-1-stable
|
34
|
+
- rvm: 2.0.0
|
35
|
+
gemfile: gemfiles/Gemfile.rails-5-0-stable
|
36
|
+
- rvm: 2.0.0
|
37
|
+
gemfile: Gemfile
|
38
|
+
- rvm: 2.1.10
|
39
|
+
gemfile: gemfiles/Gemfile.rails-5-1-stable
|
40
|
+
- rvm: 2.1.10
|
41
|
+
gemfile: gemfiles/Gemfile.rails-5-0-stable
|
42
|
+
- rvm: 2.1.10
|
43
|
+
gemfile: Gemfile
|
44
|
+
script: 'bundle exec rake'
|
45
|
+
|
46
|
+
notifications:
|
47
|
+
email:
|
48
|
+
recipients:
|
49
|
+
- hunterae@gmail.com
|
50
|
+
on_failure: change
|
51
|
+
on_success: never
|
data/Gemfile
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem "rspec", "~> 3.6.0"
|
6
|
+
gem "rails", github: "rails/rails"
|
7
|
+
gem 'rack', git: 'git://github.com/rack/rack.git'
|
8
|
+
gem "shoulda-matchers", "~> 2.0"
|
9
|
+
gem "haml", "~> 5.0.0"
|
10
|
+
|
11
|
+
# Extra development utilities
|
12
|
+
gem 'ruby_dep', '~> 1.3.0'
|
13
|
+
gem 'guard-rspec', '~> 4.7'
|
14
|
+
gem "terminal-notifier-guard"
|
15
|
+
gem "byebug"
|
16
|
+
gem "codeclimate-test-reporter", "~> 1.0.0"
|
data/Guardfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
notification :terminal_notifier if `uname` =~ /Darwin/
|
2
|
+
|
3
|
+
rspec_options = {
|
4
|
+
cmd: "rspec",
|
5
|
+
all_after_pass: false,
|
6
|
+
all_on_start: false,
|
7
|
+
failed_mode: :focus
|
8
|
+
}
|
9
|
+
|
10
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
11
|
+
watch(%r{^spec/.+_spec\.rb$})
|
12
|
+
watch(%r{^lib/blocks/(.+)\.rb$}) { |m| ["spec/features", "spec/unit/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^lib/blocks.rb$}) { "spec" }
|
14
|
+
watch('spec/spec_helper.rb') { "spec" }
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Andrew Hunter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Blocks
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/blocks`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'blocks'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install blocks
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/blocks.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
+
|
data/Rakefile
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
|
5
|
-
# Run with `rake spec`
|
6
|
-
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
-
task.rspec_opts = ['--color', '--format', 'documentation']
|
8
|
-
end
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
5
|
|
10
6
|
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "blocks"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/blocks.gemspec
CHANGED
@@ -8,22 +8,29 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Blocks::VERSION
|
9
9
|
spec.authors = ["Andrew Hunter"]
|
10
10
|
spec.email = ["hunterae@gmail.com"]
|
11
|
-
|
12
|
-
spec.
|
13
|
-
spec.
|
11
|
+
|
12
|
+
spec.summary = %q{Blocks gives you total control over how your blocks of code render.}
|
13
|
+
spec.description = %q{Blocks gives you total control over how your blocks of code render.}
|
14
|
+
spec.homepage = "https://github.com/hunterae/blocks"
|
14
15
|
spec.license = "MIT"
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
28
|
spec.require_paths = ["lib"]
|
20
29
|
|
30
|
+
spec.add_dependency "call_with_params"
|
21
31
|
spec.add_dependency "rails", ">= 3.0.0"
|
22
|
-
spec.add_dependency "call_with_params", "~> 0.0.2"
|
23
|
-
spec.add_dependency "hashie"
|
24
32
|
|
33
|
+
spec.add_development_dependency "nokogiri", "1.6.8.1"
|
34
|
+
spec.add_development_dependency "capybara"
|
25
35
|
spec.add_development_dependency "simplecov"
|
26
|
-
spec.add_development_dependency "rspec-rails"
|
27
|
-
spec.add_development_dependency "mocha"
|
28
|
-
spec.add_development_dependency "debugger"
|
29
36
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rake", "< 11.0"
|
6
|
+
gem "public_suffix", "~> 1.4.6"
|
7
|
+
gem "mime-types", "< 3.0"
|
8
|
+
gem "rack", "< 2.0"
|
9
|
+
gem "rspec", "~> 3.0.0"
|
10
|
+
gem "rails", github: "rails/rails", branch: "3-0-stable"
|
11
|
+
gem "shoulda-matchers", "~> 2.0"
|
12
|
+
gem 'test-unit', '~> 3.0'
|
13
|
+
gem "haml", "4.0.4"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rake", "< 11.0"
|
6
|
+
gem "public_suffix", "~> 1.4.6"
|
7
|
+
gem "mime-types", "< 3.0"
|
8
|
+
gem "rack", "< 2.0"
|
9
|
+
gem "rspec", "~> 3.0.0"
|
10
|
+
gem "rails", github: "rails/rails", branch: "3-1-stable"
|
11
|
+
gem "shoulda-matchers", "~> 2.0"
|
12
|
+
gem 'test-unit', '~> 3.0'
|
13
|
+
gem "haml", "4.0.4"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rake", "< 11.0"
|
6
|
+
gem "public_suffix", "~> 1.4.6"
|
7
|
+
gem "mime-types", "< 3.0"
|
8
|
+
gem "rack", "< 2.0"
|
9
|
+
gem "rspec", "~> 3.0.0"
|
10
|
+
gem "rails", github: "rails/rails", branch: "3-2-stable"
|
11
|
+
gem "shoulda-matchers", "~> 2.0"
|
12
|
+
gem 'test-unit', '~> 3.0'
|
13
|
+
gem "haml", "4.0.4"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rake", "< 11.0"
|
6
|
+
gem "public_suffix", "~> 1.4.6"
|
7
|
+
gem "mime-types", "< 3.0"
|
8
|
+
gem "rack", "< 2.0"
|
9
|
+
gem "rspec", "~> 3.0.0"
|
10
|
+
gem "rails", github: "rails/rails", branch: "4-0-stable"
|
11
|
+
gem "shoulda-matchers", "~> 2.0"
|
12
|
+
gem "haml", "4.0.4"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rake", "< 11.0"
|
6
|
+
gem "public_suffix", "~> 1.4.6"
|
7
|
+
gem "mime-types", "< 3.0"
|
8
|
+
gem "rack", "< 2.0"
|
9
|
+
gem "rspec", "~> 3.0.0"
|
10
|
+
gem "rails", github: "rails/rails", branch: "4-1-stable"
|
11
|
+
gem "shoulda-matchers", "~> 2.0"
|
12
|
+
gem "haml", "4.0.4"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: ".."
|
4
|
+
|
5
|
+
gem "rake", "< 11.0"
|
6
|
+
gem "public_suffix", "~> 1.4.6"
|
7
|
+
gem "mime-types", "< 3.0"
|
8
|
+
gem "rack", "< 2.0"
|
9
|
+
gem "rspec", "~> 3.0.0"
|
10
|
+
gem "rails", github: "rails/rails", branch: "4-2-stable"
|
11
|
+
gem "shoulda-matchers", "~> 2.0"
|
12
|
+
gem "haml", "4.0.4"
|
data/lib/blocks.rb
CHANGED
@@ -1,26 +1,47 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require "hashie"
|
1
|
+
require 'active_support/core_ext/hash'
|
2
|
+
require 'active_support/hash_with_indifferent_access'
|
3
|
+
require 'blocks/action_view_extensions/view_extensions'
|
5
4
|
|
6
5
|
module Blocks
|
7
|
-
|
8
|
-
autoload :Container, "blocks/container"
|
9
|
-
autoload :ViewAdditions, "blocks/view_additions"
|
10
|
-
autoload :ControllerAdditions, "blocks/controller_additions"
|
6
|
+
extend ActiveSupport::Autoload
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
eager_autoload do
|
9
|
+
autoload_under 'renderers' do
|
10
|
+
autoload :Renderer
|
11
|
+
autoload :RuntimeContext
|
12
|
+
autoload :AbstractRenderer
|
13
|
+
autoload :PartialRenderer
|
14
|
+
autoload :BlockWithHooksRenderer
|
15
|
+
autoload :AdjacentBlocksRenderer
|
16
|
+
autoload :NestingBlocksRenderer
|
17
|
+
autoload :CollectionRenderer
|
18
|
+
autoload :WrapperRenderer
|
19
|
+
autoload :BlockRenderer
|
20
|
+
autoload :BlockPlaceholder
|
21
|
+
end
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
autoload_under 'builders' do
|
24
|
+
autoload :HookDefinition
|
25
|
+
autoload :BlockDefinition
|
26
|
+
autoload :Builder
|
27
|
+
end
|
28
|
+
|
29
|
+
autoload_under 'utilities' do
|
30
|
+
autoload :DynamicConfiguration
|
31
|
+
autoload :Configurator
|
32
|
+
autoload :OptionsSet
|
33
|
+
autoload :HashWithRenderStrategy
|
34
|
+
autoload :HashWithCaller
|
35
|
+
end
|
22
36
|
end
|
23
|
-
end
|
24
37
|
|
25
|
-
|
26
|
-
|
38
|
+
# WIP
|
39
|
+
# autoload_under 'experimental' do
|
40
|
+
# autoload :BuilderPermissions
|
41
|
+
# autoload :InvalidPermissionsHandler
|
42
|
+
# end
|
43
|
+
|
44
|
+
autoload :Version
|
45
|
+
|
46
|
+
include Configurator
|
47
|
+
end
|