rails-render_hooks 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +13 -6
- data/README.md +8 -7
- data/gemfiles/{rails_4_1_x.gemfile → rails_4_2_x.gemfile} +1 -1
- data/gemfiles/{rails_3_2_x.gemfile → rails_5_0_x.gemfile} +1 -1
- data/gemfiles/{rails_4_0_x.gemfile → rails_5_1_x.gemfile} +2 -1
- data/gemfiles/rails_5_2_x.gemfile +6 -0
- data/lib/rails/render_hooks.rb +8 -12
- data/lib/rails/render_hooks/version.rb +1 -1
- data/rails-render_hooks.gemspec +3 -2
- data/test/render_hooks_test.rb +4 -4
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 514c97a942242f1a3d3f8b50e1d4701e6c00648281c2d218316ed1c4fcc3101f
|
4
|
+
data.tar.gz: 473b70e7200f9365f04bfa7282ab602975419ba9b968f2388aa122f53c94af4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08753094d6c487a892975d894a20b9ef7b9e4b519b79c1748aaa01602da03104960d0cda09e8b8f7c157460bd2ef714960029d4bff5dabc3395e42d70b03626a'
|
7
|
+
data.tar.gz: '09e99fe748303ff450b7289cf957208edf51f42c32c5ba82966a2a90567556a100b2dd13c3f6850313e3d917ad1884f154b36485ae9eaad787adcce5c882df0e'
|
data/.travis.yml
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
2
3
|
rvm:
|
3
|
-
-
|
4
|
-
- 2.
|
5
|
-
- 2.
|
4
|
+
- 2.3
|
5
|
+
- 2.4
|
6
|
+
- 2.5
|
7
|
+
- 2.6
|
6
8
|
gemfile:
|
7
|
-
- gemfiles/
|
8
|
-
- gemfiles/
|
9
|
-
- gemfiles/
|
9
|
+
- gemfiles/rails_4_2_x.gemfile
|
10
|
+
- gemfiles/rails_5_0_x.gemfile
|
11
|
+
- gemfiles/rails_5_1_x.gemfile
|
12
|
+
- gemfiles/rails_5_2_x.gemfile
|
13
|
+
matrix:
|
14
|
+
exclude:
|
15
|
+
- gemfile: gemfiles/rails_4_2_x.gemfile
|
16
|
+
rvm: 2.6
|
data/README.md
CHANGED
@@ -33,8 +33,8 @@ Or install it yourself as:
|
|
33
33
|
|
34
34
|
## Ordering of hooks
|
35
35
|
|
36
|
-
1. before_action
|
37
|
-
1. around_action
|
36
|
+
1. before_action
|
37
|
+
1. around_action
|
38
38
|
1. prepend_around_render
|
39
39
|
1. prepend_before_render
|
40
40
|
1. before_render
|
@@ -44,17 +44,17 @@ Or install it yourself as:
|
|
44
44
|
1. after_render
|
45
45
|
1. prepend_after_render
|
46
46
|
1. prepend_around_render
|
47
|
-
1. around_action
|
48
|
-
1. after_action
|
47
|
+
1. around_action
|
48
|
+
1. after_action
|
49
49
|
|
50
50
|
## Supported versions
|
51
51
|
|
52
|
-
* Ruby:
|
53
|
-
* Rails:
|
52
|
+
* Ruby: 2.3.x, 2.4.x, 2.5.x, 2.6.x
|
53
|
+
* Rails: 4.2.x, 5.0.x, 5.1.x, 5.2.x
|
54
54
|
|
55
55
|
## Contributing
|
56
56
|
|
57
|
-
1. Fork it ( https://github.com/
|
57
|
+
1. Fork it ( https://github.com/pinzolo/rails-render_hooks/fork )
|
58
58
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
59
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
60
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -63,3 +63,4 @@ Or install it yourself as:
|
|
63
63
|
## Changelog
|
64
64
|
|
65
65
|
* v1.0.0 (2014-06-10 JST): First release
|
66
|
+
* v2.0.0 (2019-04-20 JST): Compatible to recent ruby and rails versions
|
data/lib/rails/render_hooks.rb
CHANGED
@@ -5,23 +5,19 @@ require "action_controller"
|
|
5
5
|
module RenderHooks
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
alias_method_chain :render, :render_hooks
|
11
|
-
end
|
12
|
-
|
13
|
-
def render_with_render_hooks(*options, &block)
|
14
|
-
if ActiveSupport::VERSION::STRING >= '4.0.0'
|
8
|
+
module Renderer
|
9
|
+
def render(*options, &block)
|
15
10
|
run_callbacks(:process_render) do
|
16
|
-
|
17
|
-
end
|
18
|
-
else
|
19
|
-
run_callbacks(:process_render, action_name) do
|
20
|
-
render_without_render_hooks(*options, &block)
|
11
|
+
super(*options, &block)
|
21
12
|
end
|
22
13
|
end
|
23
14
|
end
|
24
15
|
|
16
|
+
included do
|
17
|
+
define_callbacks :process_render
|
18
|
+
prepend Renderer
|
19
|
+
end
|
20
|
+
|
25
21
|
module ClassMethods
|
26
22
|
[:before, :after, :around].each do |callback|
|
27
23
|
define_method "#{callback}_render" do |*names, &block|
|
data/rails-render_hooks.gemspec
CHANGED
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "actionpack", ">=
|
21
|
+
spec.add_dependency "actionpack", ">= 4.2.0"
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
spec.add_development_dependency "coveralls"
|
26
|
+
spec.add_development_dependency "test-unit"
|
26
27
|
end
|
data/test/render_hooks_test.rb
CHANGED
@@ -3,9 +3,9 @@ require 'test_helper'
|
|
3
3
|
class SampleController < ActionController::Base
|
4
4
|
include RenderHooks
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
before_action :exec_before_action
|
7
|
+
after_action :exec_after_action
|
8
|
+
around_action :exec_around_action
|
9
9
|
prepend_before_render :exec_prepend_before_render
|
10
10
|
before_render :exec_before_render, except: [:new]
|
11
11
|
skip_before_render :exec_before_render, only: [:show]
|
@@ -19,7 +19,7 @@ class SampleController < ActionController::Base
|
|
19
19
|
attr_accessor :footmarks
|
20
20
|
|
21
21
|
[:index, :new, :show].each do |action|
|
22
|
-
define_method(action) { render
|
22
|
+
define_method(action) { render inline: '' }
|
23
23
|
end
|
24
24
|
|
25
25
|
def reset
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-render_hooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pinzolo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
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: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-unit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Add callbacks for render method
|
70
84
|
email:
|
71
85
|
- pinzolo@gmail.com
|
@@ -80,9 +94,10 @@ files:
|
|
80
94
|
- LICENSE.txt
|
81
95
|
- README.md
|
82
96
|
- Rakefile
|
83
|
-
- gemfiles/
|
84
|
-
- gemfiles/
|
85
|
-
- gemfiles/
|
97
|
+
- gemfiles/rails_4_2_x.gemfile
|
98
|
+
- gemfiles/rails_5_0_x.gemfile
|
99
|
+
- gemfiles/rails_5_1_x.gemfile
|
100
|
+
- gemfiles/rails_5_2_x.gemfile
|
86
101
|
- lib/rails/render_hooks.rb
|
87
102
|
- lib/rails/render_hooks/version.rb
|
88
103
|
- rails-render_hooks.gemspec
|
@@ -108,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
123
|
version: '0'
|
109
124
|
requirements: []
|
110
125
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.7.6
|
112
127
|
signing_key:
|
113
128
|
specification_version: 4
|
114
129
|
summary: Add callbacks for render method
|