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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 05ee3c22a3ba550a3b49e0211f09027266ba2b1d
4
- data.tar.gz: 2138fec9accdbe789f88899b84458e7c605c9992
2
+ SHA256:
3
+ metadata.gz: 260cc70d64299766c8bf4fb71c07842c2bd159d22fa0dac7f2f95c14bf508d5e
4
+ data.tar.gz: 5187ab95f256a3dde5da97008642f36653a54c81d93b36b0a6a92045a624c49e
5
5
  SHA512:
6
- metadata.gz: 09e7bd48a9fec96bff53f3243323412d655c7a5b9c5b2b23022c60e5926e4ec5da180badc27bf59e04335fa0de1b69b42336a4b76355e601608968e87a605bd1
7
- data.tar.gz: 46282c8f28d538c0984dd857ba67e8ba0f35a6153d275475077c85fe45d0af87b4fbf16fa11906878e2c02a3b05e7c2b7098ad45b2c904fb6d039e219977c3eb
6
+ metadata.gz: 6e178bdcd28798e3f1e613145e164dbe2f38edb606a9b376407357daca42ca000224c579d5af483206d4b7ee262a6132fb421ecd690fc9ed0494fbcd906d973d
7
+ data.tar.gz: 9895f1f7d41a2ce2408ca8f455db29ca418498b64e3232e631823b82d022bf9aae56927429869da6240b913aa917f90303581574498976bb10c2a41d284d1e1e
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- /.bundle/
1
+ .bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
4
  /_yardoc/
@@ -6,4 +6,9 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
- /tmp/
9
+ /log
10
+ tmp
11
+ .DS_Store
12
+ log/
13
+ *.iml
14
+ .idea
@@ -1,13 +1,19 @@
1
1
  language: ruby
2
2
  rvm:
3
- - ruby-head
4
- - 2.2
5
- - 2.1
6
- - 2.0.0
7
- - 1.9.3
8
- - jruby-19mode
9
- gemfile:
10
- - gemfiles/rails4.2.gemfile
11
- - gemfiles/rails4.1.gemfile
12
- - gemfiles/rails4.0.gemfile
13
- - gemfiles/rails3.2.gemfile
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
- # gem 'sass-rails', "~> 4.0.3"#, " ~> 3.1.0"
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['test/**/*_test.rb']
9
+ t.test_files = FileList["test/rails#{RAILS_VERSION}/**/*_test.rb"]
8
10
  end
9
11
 
10
12
  task :default => :test
@@ -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", ">= 3.0"
21
+ spec.add_dependency "actionpack", ">= 5.0"
22
22
 
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.10"
25
- spec.add_development_dependency "rake", "~> 10.0"
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
@@ -15,11 +15,13 @@ module Cell
15
15
  asset_path
16
16
  asset_url
17
17
  image_tag
18
+ video_tag
18
19
  audio_path
19
20
  audio_url
20
21
  compute_asset_extname
21
22
  compute_asset_host
22
23
  compute_asset_path
24
+ favicon_link_tag
23
25
  font_path
24
26
  font_url
25
27
  image_path
@@ -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, :protect_against_forgery?, :form_authenticity_token, :request_forgery_protection_token
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)
@@ -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
- if ::Rails.version.start_with?('5')
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
@@ -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 = -> (app) do
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
@@ -1 +1,2 @@
1
+ require "cells/rails/version"
1
2
  require "cells/rails"
@@ -1,9 +1,6 @@
1
- require "cells/rails/version"
2
1
  require "cells"
3
-
4
- require "cell/caching/notification"
5
- require "cell/rails"
6
2
  require "cell/railtie"
3
+ require "cell/caching/notification"
7
4
  require "cell/rails/testing"
8
5
 
9
6
  module Cell
@@ -1,5 +1,5 @@
1
1
  module Cells
2
2
  module Rails
3
- VERSION = "0.0.7"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
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.0.7
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: 2017-01-28 00:00:00.000000000 Z
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: '3.0'
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: '3.0'
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: '1.10'
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: '1.10'
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: '10.0'
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: '10.0'
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.6.3
192
+ rubygems_version: 2.7.3
179
193
  signing_key:
180
194
  specification_version: 4
181
195
  summary: Convenient Rails support for Cells.