trailblazer-compat 0.1.1 → 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
2
  SHA1:
3
- metadata.gz: 169d646a93a9381db03f539f7505dc3f517f95fe
4
- data.tar.gz: 8c8ea2e8acb1038192445c1d945c25404712884b
3
+ metadata.gz: a87137cd62ece252507795dc3827decf12a7af0a
4
+ data.tar.gz: f125592d8350be4c655f4eb86b9c4a1b4e6ef323
5
5
  SHA512:
6
- metadata.gz: 758de6c143c9f0d6627cb4c49217ec3fb31a86a3f960a63a52f3c6c7e767559213024185653dc083d99a6cd71f1a7c1cd6a93393263c60d2fa7043fad1f466ac
7
- data.tar.gz: 78be2811e719614ecf356eb5a78299a5b7450dc719a1fed0f5ca8e939623d824943b3c2e32cdaa2a2921b2369f5611f8d9fdad12e20ed5cc61d4fa94512104c4
6
+ metadata.gz: 1fe430099274c39dca277202863000c4613272f51db956ac48461c47d8683c627aa8ea2eae473f2b13ee42fd644378c109c5ffceb452844ca23acee856c15405
7
+ data.tar.gz: d6922d7858014f9ba381d056d19e85893ee5ee0877d994ea8a320e8a3f61ec329b4a5c3dfcebdd07e7cca4243358eb4d75a2550cae7c17ada439a4885d6a95e4
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.2
2
+
3
+ * Fix a circular dependency problem in some environments, when loading `ApplicationController`.
4
+
1
5
  # 0.1.1
2
6
 
3
7
  * Allow using `compat` without Rails.
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Trailblazer::Compat
2
+ [![Gem Version](https://badge.fury.io/rb/trailblazer-compat.svg)](https://badge.fury.io/rb/trailblazer-compat)
2
3
 
3
4
  This gem provides a seamless-er™ upgrade from TRB 1.1 to 2.x.
4
5
 
@@ -16,7 +17,7 @@ gem "trailblazer-compat"
16
17
  In a Rails application, you also need to pull the 1.x line of the `trailblazer-rails` gem.
17
18
 
18
19
  ```ruby
19
- gem "trailblazer-rails", ">= 1.0.0"
20
+ gem "trailblazer-rails", ">= 1.0.3"
20
21
  ```
21
22
 
22
23
  ## Upgrade Path / Overview
@@ -19,3 +19,4 @@ end
19
19
 
20
20
  require "trailblazer/1.1/autoloading"
21
21
  require "trailblazer/1.1/rails/autoloading"
22
+
@@ -2,26 +2,39 @@ begin
2
2
  require 'rails/railtie'
3
3
  rescue LoadError
4
4
  else
5
+
5
6
  module Trailblazer::V1_1
6
7
  class Railtie < ::Rails::Railtie
8
+ module ExtendApplicationController
9
+ def extend_application_controller!(app)
10
+ # this requires trailblazer-rails-1.0.3
11
+ application_controller = super
12
+
13
+ v2_Controller = Trailblazer::Rails::Controller
14
+
15
+ application_controller.class_eval do
16
+ include v2_Controller # if Trailblazer::Operation.const_defined?(:Controller) # from V2.
17
+ alias_method :run_v2, :run
18
+ include Trailblazer::V1_1::Operation::Controller
19
+ end
20
+ end
21
+ end
22
+
23
+
7
24
  # This is to autoload Operation::Dispatch, etc. I'm simply assuming people find this helpful in Rails.
8
25
  initializer "trailblazer.library_autoloading" do
9
26
  require "trailblazer/1.1/autoloading"
10
27
  end
11
28
 
12
- initializer "trailblazer.application_controller" do
13
- ActiveSupport.on_load(:action_controller) do
14
- require "trailblazer/rails/railtie"
15
- # this requires trailblazer-rails-1.0.0
16
- V2_Controller = Trailblazer::Rails::Controller
29
+ initializer "trailblazer.application_controller.compat", before: "trailblazer.application_controller" do |app|
30
+ require "trailblazer/rails/railtie"
17
31
 
18
- ActionController::Base.class_eval do
19
- include V2_Controller # if Trailblazer::Operation.const_defined?(:Controller) # from V2.
20
- alias run_v2 run
21
- include Trailblazer::V1_1::Operation::Controller
22
- end
32
+ if Gem::Version.new(Trailblazer::Rails::VERSION) < Gem::Version.new("1.0.4")
33
+ raise "[Trailblazer-compat] Please update to trailblazer-rails 1.0.4 or above."
23
34
  end
35
+
36
+ Trailblazer::Railtie.extend ExtendApplicationController
24
37
  end
25
- end
38
+ end # Railtie
26
39
  end
27
40
  end
@@ -43,8 +43,12 @@ Trailblazer::NotAuthorizedError = Trailblazer::V1_1::NotAuthorizedError
43
43
  Trailblazer::Operation.extend(Trailblazer::Compat::Version)
44
44
 
45
45
  Trailblazer::V2::Operation::Nested.module_eval do
46
- def self.nestable_object?(object)
46
+ def self.nestable_object?(object) # 2.0
47
47
  # interestingly, with < we get a weird nil exception. bug in Ruby?
48
48
  object.is_a?(Class) && object <= Trailblazer::V2::Operation
49
49
  end
50
+
51
+ def self.operation_class # 2.1
52
+ Trailblazer::V2::Operation
53
+ end
50
54
  end
@@ -1,5 +1,5 @@
1
1
  module Trailblazer
2
2
  module Compat
3
- VERSION = "0.1.1"
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: trailblazer-compat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trailblazer
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.6.3
128
+ rubygems_version: 2.6.12
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Use Trailblazer 1.1 and 2.x.