inertia_rails 1.3.1 → 1.4.0

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
2
  SHA256:
3
- metadata.gz: 29a0f3d180ca11e8e729969b8937c4b1192e23c777d79fc4e17ddc0516ba6587
4
- data.tar.gz: 72fbd3616dc37eae14f19af3bf6177b3a365f35c48148d3e70e4241aa8a0a8bc
3
+ metadata.gz: ef2ef33ca24036a92d67ec557bab99829468a7f9546422b68a703624bd52489d
4
+ data.tar.gz: 6beb16df6b7511813b62e42e91fbb7d0a251264b2e802e0e0345b04bd08700ac
5
5
  SHA512:
6
- metadata.gz: c850625eeadeb20ce4a8c46cc8c14f82c70c8df04abe28492b2bc23dee6c789c1756fbdc9c3c69e03d36d1f97a6ccf0486807b38844c217a4dd19f416d0e2db8
7
- data.tar.gz: 8cbeb85fcbf8d5ab2fb29a5fdded69d64e96700e69a8e8812f769d218de42752f2ff9488e411b12247c02343b4872971ee3ef4f55cccfcde54da192ea2e927b3
6
+ metadata.gz: 5e2d7527c48047f950207b163fa539b6b4735655d501a573035a782cb623f5973a74789574be6722bbf7bd4088835c5a486d9a8962df02d17473c4c2d42a0012
7
+ data.tar.gz: 96d8302e0fd851874d14ef2cee34c013278924c9e619d7302a2a66ae2a3c5dbd7c3a5e3a7ee2e01f8849adfbd0f54e65b1661cfeeb27320e8f94b415d8ca5567
@@ -1,21 +1,27 @@
1
1
  name: Testing
2
2
 
3
- on: [push]
3
+ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  test:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ ruby: [2.6, 2.7]
11
+
7
12
  runs-on: ubuntu-latest
13
+ name: Test against Ruby ${{ matrix.ruby }}
8
14
 
9
15
  steps:
10
- - uses: actions/checkout@v1
16
+ - uses: actions/checkout@v2
11
17
 
12
18
  - name: Setup System
13
19
  run: sudo apt-get install libsqlite3-dev
14
20
 
15
- - name: Set up Ruby 2.6
16
- uses: actions/setup-ruby@v1
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
17
23
  with:
18
- ruby-version: 2.6.x
24
+ ruby-version: ${{ matrix.ruby }}
19
25
 
20
26
  - name: Install gems
21
27
  run: |
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.4.0] - 2020-07-09
8
+
9
+ * Fixed Ruby 2.7 deprecation warnings
10
+ * Added `inertia_partial?` method
11
+ * Fixed homepage in the gemspec
12
+ * Make the InertiaRails module data threadsafe
13
+
7
14
  ## [1.3.1] - 2020-02-20
8
15
 
9
16
  * Fix a typo in the README (inertia only has 1 t!)
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["brain@bellawatt.com", "brandon@bellawatt.com", "eugene@bellawatt.com"]
10
10
 
11
11
  spec.summary = %q{Inertia adapter for Rails}
12
- spec.homepage = "https://github.com/inertiajs/inertia-rails/"
12
+ spec.homepage = "https://github.com/inertiajs/inertia-rails"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rspec-rails", "~> 3.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
30
+ spec.add_development_dependency "rspec-rails", "~> 4.0"
31
31
  spec.add_development_dependency "rails"
32
32
  spec.add_development_dependency "rails-controller-testing"
33
33
  spec.add_development_dependency "sqlite3"
@@ -7,7 +7,7 @@ module InertiaRails
7
7
  module ClassMethods
8
8
  def inertia_share(**args, &block)
9
9
  before_action do
10
- InertiaRails.share(args) if args
10
+ InertiaRails.share(**args) if args
11
11
  InertiaRails.share_block(block) if block
12
12
  end
13
13
  end
@@ -1,6 +1,6 @@
1
1
  module InertiaRails
2
- mattr_accessor(:shared_plain_data) { Hash.new }
3
- mattr_accessor(:shared_blocks) { [] }
2
+ thread_mattr_accessor :threadsafe_shared_plain_data
3
+ thread_mattr_accessor :threadsafe_shared_blocks
4
4
 
5
5
  def self.configure
6
6
  yield(Configuration)
@@ -21,11 +21,11 @@ module InertiaRails
21
21
 
22
22
  # "Setters"
23
23
  def self.share(**args)
24
- shared_plain_data.merge!(args)
24
+ self.shared_plain_data = self.shared_plain_data.merge(args)
25
25
  end
26
26
 
27
27
  def self.share_block(block)
28
- shared_blocks.push(block)
28
+ self.shared_blocks = self.shared_blocks + [block]
29
29
  end
30
30
 
31
31
  def self.reset!
@@ -36,12 +36,45 @@ module InertiaRails
36
36
  private
37
37
 
38
38
  module Configuration
39
- mattr_accessor(:layout) { 'application' }
40
- mattr_accessor(:version) { nil }
39
+ thread_mattr_accessor :threadsafe_layout
40
+ thread_mattr_accessor :threadsafe_version
41
41
 
42
42
  def self.evaluated_version
43
43
  self.version.respond_to?(:call) ? self.version.call : self.version
44
44
  end
45
+
46
+ def self.layout
47
+ self.threadsafe_layout || 'application'
48
+ end
49
+
50
+ def self.layout=(val)
51
+ self.threadsafe_layout = val
52
+ end
53
+
54
+ def self.version
55
+ self.threadsafe_version
56
+ end
57
+
58
+ def self.version=(val)
59
+ self.threadsafe_version = val
60
+ end
61
+ end
62
+
63
+ # Getters and setters to provide default values for the threadsafe attributes
64
+ def self.shared_plain_data
65
+ self.threadsafe_shared_plain_data || {}
66
+ end
67
+
68
+ def self.shared_plain_data=(val)
69
+ self.threadsafe_shared_plain_data = val
70
+ end
71
+
72
+ def self.shared_blocks
73
+ self.threadsafe_shared_blocks || []
74
+ end
75
+
76
+ def self.shared_blocks=(val)
77
+ self.threadsafe_shared_blocks = val
45
78
  end
46
79
 
47
80
  def self.evaluated_blocks(controller, blocks)
@@ -61,7 +61,7 @@ RSpec.configure do |config|
61
61
  config.before(:each, inertia: true) do
62
62
  new_renderer = InertiaRails::Renderer.method(:new)
63
63
  allow(InertiaRails::Renderer).to receive(:new) do |component, controller, request, response, render, named_args|
64
- new_renderer.call(component, controller, request, response, inertia_wrap_render(render), named_args)
64
+ new_renderer.call(component, controller, request, response, inertia_wrap_render(render), **named_args)
65
65
  end
66
66
  end
67
67
  end
@@ -1,3 +1,3 @@
1
1
  module InertiaRails
2
- VERSION = "1.3.1"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -2,4 +2,8 @@ ActionDispatch::Request.class_eval do
2
2
  def inertia?
3
3
  key? 'HTTP_X_INERTIA'
4
4
  end
5
+
6
+ def inertia_partial?
7
+ key? 'HTTP_X_INERTIA_PARTIAL_DATA'
8
+ end
5
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inertia_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Knoles
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-02-20 00:00:00.000000000 Z
13
+ date: 2020-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -32,28 +32,28 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '10.0'
35
+ version: '13.0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '10.0'
42
+ version: '13.0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec-rails
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '3.0'
49
+ version: '4.0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '3.0'
56
+ version: '4.0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rails
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -133,13 +133,13 @@ files:
133
133
  - lib/patches/debug_exceptions/patch-5-0.rb
134
134
  - lib/patches/debug_exceptions/patch-5-1.rb
135
135
  - lib/patches/request.rb
136
- homepage: https://github.com/inertiajs/inertia-rails/
136
+ homepage: https://github.com/inertiajs/inertia-rails
137
137
  licenses:
138
138
  - MIT
139
139
  metadata:
140
- homepage_uri: https://github.com/inertiajs/inertia-rails/
141
- source_code_uri: https://github.com/inertiajs/inertia-rails/
142
- changelog_uri: https://github.com/inertiajs/inertia-rails//CHANGELOG.md
140
+ homepage_uri: https://github.com/inertiajs/inertia-rails
141
+ source_code_uri: https://github.com/inertiajs/inertia-rails
142
+ changelog_uri: https://github.com/inertiajs/inertia-rails/CHANGELOG.md
143
143
  post_install_message:
144
144
  rdoc_options: []
145
145
  require_paths: