cells-rails 0.0.7 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +7 -2
- data/.travis.yml +17 -11
- data/CHANGES.md +20 -0
- data/Gemfile +7 -1
- data/README.md +2 -1
- data/Rakefile +3 -1
- data/cells-rails.gemspec +4 -3
- data/lib/cell/helper/asset_helper.rb +2 -0
- data/lib/cell/rails.rb +17 -2
- data/lib/cell/rails/testing.rb +11 -3
- data/lib/cell/railtie.rb +11 -1
- data/lib/cells-rails.rb +1 -0
- data/lib/cells/rails.rb +1 -4
- data/lib/cells/rails/version.rb +1 -1
- metadata +27 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 260cc70d64299766c8bf4fb71c07842c2bd159d22fa0dac7f2f95c14bf508d5e
|
4
|
+
data.tar.gz: 5187ab95f256a3dde5da97008642f36653a54c81d93b36b0a6a92045a624c49e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e178bdcd28798e3f1e613145e164dbe2f38edb606a9b376407357daca42ca000224c579d5af483206d4b7ee262a6132fb421ecd690fc9ed0494fbcd906d973d
|
7
|
+
data.tar.gz: 9895f1f7d41a2ce2408ca8f455db29ca418498b64e3232e631823b82d022bf9aae56927429869da6240b913aa917f90303581574498976bb10c2a41d284d1e1e
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
- 2.4.7
|
4
|
+
- 2.5.6
|
5
|
+
- 2.6.4
|
6
|
+
env:
|
7
|
+
- "RAILS_VERSION=5.0"
|
8
|
+
- "RAILS_VERSION=5.1"
|
9
|
+
- "RAILS_VERSION=5.2"
|
10
|
+
- "RAILS_VERSION=6.0"
|
11
|
+
matrix:
|
12
|
+
fast_finish: true
|
13
|
+
exclude:
|
14
|
+
- rvm: 2.3.8
|
15
|
+
env: RAILS_VERSION=6.0
|
16
|
+
- rvm: 2.4.7
|
17
|
+
env: RAILS_VERSION=6.0
|
18
|
+
|
19
|
+
cache: bundler
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## 0.1.2
|
2
|
+
|
3
|
+
* Fix `LocalJumpError` from our Railtie.
|
4
|
+
|
5
|
+
## 0.1.1
|
6
|
+
|
7
|
+
* The `Cell.view_paths` are now set automatically for `Trailblazer::Cell`s, too, if the gem is present. This allows starting Rails in daemon mode `rails s -d` and cells finding its views.
|
8
|
+
|
9
|
+
## 0.1.0
|
10
|
+
|
11
|
+
* Support for Rails 6.0 Thank to @Szeliga
|
12
|
+
|
13
|
+
## 0.0.9
|
14
|
+
|
15
|
+
* Prevent Forwardable from printing warnings in Ruby 2.4+
|
16
|
+
|
17
|
+
## 0.0.8
|
18
|
+
|
19
|
+
* Fix testing for `rspec-cells` in combination with Rails 5.1. Thanks @tiagoamaro.
|
20
|
+
|
1
21
|
## 0.0.7
|
2
22
|
|
3
23
|
* Add `config.cells.include_template_engine = false` to turn off automatic
|
data/Gemfile
CHANGED
@@ -5,9 +5,15 @@ gemspec
|
|
5
5
|
|
6
6
|
# gem "my_engine", path: "engines/my_engine"
|
7
7
|
|
8
|
-
|
8
|
+
gem 'sass-rails', "~> 6.0.0"
|
9
9
|
# gem "sprockets", "~> 2.12.3"
|
10
10
|
|
11
|
+
rails_version = ENV.fetch('RAILS_VERSION','5.0')
|
12
|
+
gem "railties", "~> #{rails_version}"
|
13
|
+
gem "activerecord", "~> #{rails_version}"
|
14
|
+
|
15
|
+
gem "my_engine", path: "test/rails#{rails_version}/engines/my_engine"
|
16
|
+
|
11
17
|
group :development, :test do
|
12
18
|
gem "minitest-spec-rails"
|
13
19
|
gem "capybara_minitest_spec"
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Cells::Rails
|
2
|
+
[![Build Status](https://travis-ci.org/trailblazer/cells-rails.svg?branch=master)](https://travis-ci.org/trailblazer/cells-rails)
|
2
3
|
|
3
4
|
[Cells](https://github.com/apotonick/cells) is a generic view model implementation for Ruby. Cells-rails brings Rails-specific bindings.
|
4
5
|
|
@@ -21,4 +22,4 @@ gem 'cells-rails'
|
|
21
22
|
|
22
23
|
## License
|
23
24
|
|
24
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
25
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
3
|
|
4
|
+
RAILS_VERSION = ENV.fetch('RAILS_VERSION','5.0')
|
5
|
+
|
4
6
|
Rake::TestTask.new(:test) do |t|
|
5
7
|
t.libs << "test"
|
6
8
|
t.libs << "lib"
|
7
|
-
t.test_files = FileList[
|
9
|
+
t.test_files = FileList["test/rails#{RAILS_VERSION}/**/*_test.rb"]
|
8
10
|
end
|
9
11
|
|
10
12
|
task :default => :test
|
data/cells-rails.gemspec
CHANGED
@@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "cells", ">= 4.1.6", "< 5.0.0"
|
21
|
-
spec.add_dependency "actionpack", ">=
|
21
|
+
spec.add_dependency "actionpack", ">= 5.0"
|
22
22
|
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "minitest"
|
27
27
|
spec.add_development_dependency "rails"
|
28
28
|
spec.add_development_dependency "cells-erb"
|
29
|
+
spec.add_development_dependency "sass-rails"
|
29
30
|
end
|
data/lib/cell/rails.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'active_support/concern'
|
1
2
|
module Cell
|
2
3
|
def self.rails_version
|
3
4
|
Gem::Version.new(ActionPack::VERSION::STRING)
|
@@ -45,9 +46,9 @@ module Cell
|
|
45
46
|
# include ActionController::RequestForgeryProtection
|
46
47
|
included do
|
47
48
|
extend Uber::Delegates
|
48
|
-
delegates :parent_controller, :session, :params, :request, :config, :env, :url_options
|
49
|
+
delegates :parent_controller, :session, :params, :request, :config, :env, :url_options, :default_url_options
|
49
50
|
# forgery protection.
|
50
|
-
delegates :parent_controller, :
|
51
|
+
delegates :parent_controller, :request_forgery_protection_token
|
51
52
|
end
|
52
53
|
|
53
54
|
def call(*)
|
@@ -67,6 +68,20 @@ module Cell
|
|
67
68
|
::ActionController::Base.cache_store
|
68
69
|
end
|
69
70
|
|
71
|
+
# In Ruby 2.4.0+, Forwardable prints a warning when you delegate
|
72
|
+
# to a private or protected method - so `delegates :protect_against_forgery?`
|
73
|
+
# or `delegates :form_authenticity_token` will print warnings all
|
74
|
+
# over the place
|
75
|
+
#
|
76
|
+
# This workaround prevents warnings being printed
|
77
|
+
def protect_against_forgery?
|
78
|
+
controller.send(:protect_against_forgery?)
|
79
|
+
end
|
80
|
+
|
81
|
+
def form_authenticity_token(*args)
|
82
|
+
controller.send(:form_authenticity_token, *args)
|
83
|
+
end
|
84
|
+
|
70
85
|
module ClassMethods
|
71
86
|
def expand_cache_key(key)
|
72
87
|
::ActiveSupport::Cache.expand_cache_key(key, :cells)
|
data/lib/cell/rails/testing.rb
CHANGED
@@ -2,17 +2,25 @@ module Cell
|
|
2
2
|
module RailsExtensions
|
3
3
|
# This modules overrides Cell::Testing#controller_for and provides Rails-specific logic.
|
4
4
|
module Testing
|
5
|
+
RAILS_7_0 = Gem::Version.new("7.0.0")
|
6
|
+
RAILS_5_1 = Gem::Version.new("5.1.0")
|
7
|
+
RAILS_5_0 = Gem::Version.new("5.0.0")
|
8
|
+
|
5
9
|
def controller_for(controller_class)
|
6
10
|
return unless controller_class
|
7
11
|
|
8
12
|
controller_class.new.tap do |ctl|
|
9
|
-
ctl.request = action_controller_test_request
|
13
|
+
ctl.request = action_controller_test_request(controller_class)
|
10
14
|
ctl.instance_variable_set :@routes, ::Rails.application.routes.url_helpers
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
14
|
-
def action_controller_test_request
|
15
|
-
|
18
|
+
def action_controller_test_request(controller_class)
|
19
|
+
version = ::Rails.gem_version
|
20
|
+
|
21
|
+
if version >= RAILS_5_1 && version < RAILS_7_0
|
22
|
+
::ActionController::TestRequest.create(controller_class)
|
23
|
+
elsif version >= RAILS_5_0 && version < RAILS_5_1
|
16
24
|
::ActionController::TestRequest.create
|
17
25
|
else
|
18
26
|
::ActionController::TestRequest.new
|
data/lib/cell/railtie.rb
CHANGED
@@ -14,6 +14,9 @@ module Cell
|
|
14
14
|
|
15
15
|
# ruthlessly stolen from the zurb-foundation gem.
|
16
16
|
initializer "cells.update_asset_paths" do |app|
|
17
|
+
# Add Rails.root to view_paths
|
18
|
+
Cell::ViewModel.view_paths = [Rails.root.join("app", "cells")]
|
19
|
+
|
17
20
|
Array(app.config.cells.with_assets).each do |cell_class|
|
18
21
|
# puts "@@@@@ #{cell_class.camelize.constantize.prefixes}"
|
19
22
|
app.config.assets.paths += cell_class.camelize.constantize.prefixes # Song::Cell.prefixes
|
@@ -54,7 +57,7 @@ module Cell
|
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
57
|
-
IncludeTemplateModules = ->
|
60
|
+
IncludeTemplateModules = ->(app) do
|
58
61
|
return if app.config.cells.include_template_engine == false
|
59
62
|
|
60
63
|
# yepp, this is happening. saves me a lot of coding in each extension.
|
@@ -73,6 +76,13 @@ module Cell
|
|
73
76
|
end
|
74
77
|
end
|
75
78
|
|
79
|
+
initializer "trailblazer.cells.update_view_paths" do |app|
|
80
|
+
if Object.const_defined?(:Trailblazer) && Trailblazer.const_defined?(:Cell)
|
81
|
+
# Add Rails.root to view_paths
|
82
|
+
Trailblazer::Cell.view_paths = [Rails.root.join("app", "concepts")]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
76
86
|
rake_tasks do
|
77
87
|
load "tasks/cells.rake"
|
78
88
|
end
|
data/lib/cells-rails.rb
CHANGED
data/lib/cells/rails.rb
CHANGED
data/lib/cells/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cells
|
@@ -36,42 +36,42 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '5.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '5.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: minitest
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +114,20 @@ dependencies:
|
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: sass-rails
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
117
131
|
description:
|
118
132
|
email:
|
119
133
|
- apotonick@gmail.com
|
@@ -175,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
189
|
version: '0'
|
176
190
|
requirements: []
|
177
191
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
192
|
+
rubygems_version: 2.7.3
|
179
193
|
signing_key:
|
180
194
|
specification_version: 4
|
181
195
|
summary: Convenient Rails support for Cells.
|