actionview-consistent_fallback 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 53d85afb4d8b77d8f5b12cbdc7c219a116000aa3
4
+ data.tar.gz: 8d4d1cb6f175e65cc13a0dc1574dfeae1cd36c52
5
+ SHA512:
6
+ metadata.gz: 4ce39cc4059ea14611cfb299c3f3c74333491fa879bbc9ac59eaf8391aad1d3a5627f79365328787d701ba705764a83773c423b5cec0d55ec09348abc9533956
7
+ data.tar.gz: dc9cdd0431535ec68f596410db619b408f53c9840f1087d31fd625b4b65e25b1624287253d1790981fe93c27dfa78bc70c4c13a7c76ff2f2845d7effd1d1efa4
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # CHANGELOG
2
+ ## [0.1.0](https://github.com/yasaichi/actionview-consistent_fallback/releases/tag/v0.1.0) (September 2, 2017)
3
+ * The initial release
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 yasaichi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # actionview-consistent\_fallback
2
+ This Action View plugin allows you to fallback to the default layout and partials when there is no variant template corresponding to each request variant.
3
+
4
+ ## Installation
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'actionview-consistent_fallback'
9
+ ```
10
+
11
+ And then execute:
12
+ ```bash
13
+ $ bundle
14
+ ```
15
+
16
+ Or install it yourself as:
17
+ ```bash
18
+ $ gem install actionview-consistent_fallback
19
+ ```
20
+
21
+ ## Usage
22
+ TODO: Write how to use the plugin
23
+
24
+ ## Contributing
25
+ You should follow the steps below.
26
+
27
+ 1. [Fork the repository](https://help.github.com/articles/fork-a-repo/)
28
+ 2. Create a feature branch: `git checkout -b add-new-feature`
29
+ 3. Commit your changes: `git commit -am 'Add new feature'`
30
+ 4. Push the branch: `git push origin add-new-feature`
31
+ 4. [Send us a pull request](https://help.github.com/articles/about-pull-requests/)
32
+
33
+ ## License
34
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "bundler/setup"
5
+ rescue LoadError
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
7
+ end
8
+
9
+ require "rdoc/task"
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = "rdoc"
13
+ rdoc.title = "ActionView::ConsistentFallback"
14
+ rdoc.options << "--line-numbers"
15
+ rdoc.rdoc_files.include("README.md")
16
+ rdoc.rdoc_files.include("lib/**/*.rb")
17
+ end
18
+
19
+ require "rspec/core/rake_task"
20
+ RSpec::Core::RakeTask.new(:spec)
21
+ task default: :spec
22
+
23
+ require "bundler/gem_tasks"
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "actionview/consistent_fallback/version"
4
+
5
+ if defined?(Rails)
6
+ require "actionview/consistent_fallback/railtie"
7
+ else
8
+ require "actionview/consistent_fallback/template_rendering"
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/lazy_load_hooks"
4
+ require "rails/railtie"
5
+
6
+ module ActionView
7
+ module ConsistentFallback
8
+ class Railtie < ::Rails::Railtie
9
+ initializer "action_view.consistent_fallback" do
10
+ ::ActiveSupport.on_load(:action_view) do
11
+ require "actionview/consistent_fallback/template_rendering"
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "action_view"
4
+
5
+ module ActionView
6
+ module ConsistentFallback
7
+ module TemplateRendering
8
+ def render_template(template, layout_name = nil, locals = nil)
9
+ if template.variants == [nil] && !@lookup_context.variants.empty?
10
+ @lookup_context.variants = []
11
+ end
12
+
13
+ super
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ ActionView::TemplateRenderer.prepend(ActionView::ConsistentFallback::TemplateRendering)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionView
4
+ module ConsistentFallback
5
+ VERSION = "0.1.0".freeze
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ # desc "Explaining what the task does"
3
+ # task :actionview_consistent_fallback do
4
+ # # Task goes here
5
+ # end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: actionview-consistent_fallback
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - yasaichi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionview
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '6'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 4.1.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '6'
33
+ - !ruby/object:Gem::Dependency
34
+ name: actionpack
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: appraisal
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: reek
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec-rails
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: simplecov
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ description: This Action View plugin allows you to fallback to the default layout
118
+ and partials when there is no variant template corresponding to each request variant.
119
+ email:
120
+ - yasaichi@users.noreply.github.com
121
+ executables: []
122
+ extensions: []
123
+ extra_rdoc_files: []
124
+ files:
125
+ - CHANGELOG.md
126
+ - MIT-LICENSE
127
+ - README.md
128
+ - Rakefile
129
+ - lib/actionview/consistent_fallback.rb
130
+ - lib/actionview/consistent_fallback/railtie.rb
131
+ - lib/actionview/consistent_fallback/template_rendering.rb
132
+ - lib/actionview/consistent_fallback/version.rb
133
+ - lib/tasks/actionview/consistent_fallback_tasks.rake
134
+ homepage: https://github.com/yasaichi/actionview-consistent_fallback
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.6.11
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Consistent fallback to the default layout and partials for Action View
158
+ test_files: []