mime_actor 0.6.3.alpha → 0.6.4.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5221de8b1d1149a88de730ab8e6c6c764a22e7067b9e57b6265ce801c671ce3f
4
- data.tar.gz: e98f9d6f3e5a8aa04f16cf77921edad0b4a61893ddb3c019157885079462fcde
3
+ metadata.gz: 42ba1c04632b3b7ec4c1f1d9c1ab60571eac9e4c44272601d28dccbb45b535d0
4
+ data.tar.gz: 4d0ccbdba192617231ae0405580921e337412d3de9f63106ff772d33ab0d4208
5
5
  SHA512:
6
- metadata.gz: 9f6ce7e70ab30a4be726f346beb517c8036c95a1d516c3012d9ed62723a14c130d4af05cdf3695244f5fcb56d33f83cf719369ead9d05eabeba89e5335de1f3a
7
- data.tar.gz: 90e8ca69ac9ff99e9813c1dac19bc0826893f106968bb6c6684201a84523b13ab9df225fd597daf96379825080f9164ecfb19a6f7b48c8eabf217e5411654530
6
+ metadata.gz: e8fa8dc7c8d8438a1dff0a7bed147f0603000e7491b2e3e8a70173acd9d71f65628390cc7778d50de084940aaafd56684a347b59da5a872ce485361398d0743d
7
+ data.tar.gz: 3c87a2ce45ec35aa56786e4fd625a3b689a27aba728d7207c5b3c0cf893afb936c5f944d0408d5ca0149267f46902c7c27ff65845397c9ddccfff12d55233a48
data/COMPARE.md CHANGED
@@ -1,6 +1,57 @@
1
1
  ## Comparison in Rails
2
2
 
3
- ### MIME Rendering
3
+ When some actions render more than a single MIME type with error handling sfor different MIME type.
4
+ ```rb
5
+ class EventsController < ActionController::Base
6
+ def show
7
+ respond_to do |format|
8
+ format.html { render "show" }
9
+ format.json { render_event_json }
10
+ format.pdf { render_event_pdf }
11
+ end
12
+ end
13
+
14
+ def create
15
+ respond_to do |format|
16
+ format.html do
17
+ create_event ? redirect_to "/events/#{@event.id}" : render "create"
18
+ end
19
+ format.json do
20
+ create_event!
21
+ render_event_json
22
+ rescue StandardError => error
23
+ render status: :bad_request, json: { error: error.message }
24
+ end
25
+ end
26
+ end
27
+
28
+ def update
29
+ # this will be executed regardless of the requested format.
30
+ # e.g. requesting for xml will execute #update_event but responded with :not_acceptable http status
31
+ success = update_event
32
+
33
+ respond_to do |format|
34
+ format.html { success ? redirect_to "/events/#{@event.id}" : render "update" }
35
+ format.json { render_event_json }
36
+ end
37
+ end
38
+
39
+ def render_event_json
40
+ render json: @event
41
+ rescue StandardError => e
42
+ render json: { error: e.message }
43
+ end
44
+
45
+ def render_event_pdf
46
+ # ...
47
+ # render pdf view or call pdf library with options
48
+ rescue StandardError
49
+ # render error page / redirect to 404 page
50
+ end
51
+ end
52
+ ```
53
+
54
+ ### With MIME Action
4
55
 
5
56
  #### before
6
57
  ```rb
@@ -22,103 +73,104 @@ end
22
73
  #### after
23
74
  ```rb
24
75
  class EventsController < ActionController::Base
25
- include MimeActor::Action
76
+ include MimeActor::Action
26
77
 
27
- before_action only: :index { @events = Event.all }
78
+ before_act -> { @events = Event.all }, action: :index
28
79
 
29
- # dynamically defines the action method according to on: argument
30
- respond_act_to :html, :json, on: :index
80
+ # dynamically defines the action method according to on: argument
81
+ respond_act_to :html, :json, on: :index
31
82
 
32
- def index_html
33
- @event_categories = EventCategory.all
34
-
35
- # render html using @events and @event_categories
36
- render :index
37
- end
83
+ def index_html
84
+ @event_categories = EventCategory.all
85
+
86
+ # render html using @events and @event_categories
87
+ render :index
88
+ end
38
89
 
39
- def index_json
40
- # render json using #as_json
41
- render json: @events
42
- end
90
+ def index_json
91
+ # render json using #as_json
92
+ render json: @events
93
+ end
43
94
  end
44
95
  ```
45
96
 
46
- ### MIME Rescuing
97
+ ### With MIME Rescue
47
98
 
48
99
  #### before
49
100
  ```rb
50
101
  class EventsController < ActionController::Base
51
- # AbstractController::Callbacks here to load model with params
52
- before_action only: [:show, :update] { @event = Event.find(params.require(:event_id)) }
53
-
54
- rescue_from ActiveRecord::RecordNotFound do |ex|
55
- case action_name.to_s
56
- when "show"
57
- respond_to do |format|
58
- format.html { redirect_to events_path } # redirect to index
59
- format.json { render status: :bad_request, json: { error: ex.message } }
60
- end
61
- when "update"
62
- respond_to do |format|
63
- format.html { render :edit }
64
- format.json { render status: :bad_request, json: { error: ex.message } }
65
- end
66
- else
67
- raise ex # re-raise since we are not handling it
68
- end
102
+ before_action :load_event, action: %i[show update]
103
+
104
+ rescue_from ActiveRecord::RecordNotFound do |ex|
105
+ case action_name.to_s
106
+ when "show"
107
+ respond_to do |format|
108
+ format.html { redirect_to events_path } # redirect to index
109
+ format.json { render status: :bad_request, json: { error: ex.message } }
110
+ end
111
+ when "update"
112
+ respond_to do |format|
113
+ format.html { render :edit }
114
+ format.json { render status: :bad_request, json: { error: ex.message } }
115
+ end
116
+ else
117
+ raise ex # re-raise since we are not handling it
69
118
  end
119
+ end
70
120
 
71
- def show
72
- respond_to do |format|
73
- format.html { render :show } # render html using @event
74
- format.json { render json: @event } # render json using #as_json
75
- end
121
+ def show
122
+ respond_to do |format|
123
+ format.html { render :show } # render html using @event
124
+ format.json { render json: @event } # render json using #as_json
76
125
  end
126
+ end
77
127
 
78
- def update
79
- # ...
80
- respond_to do |format|
81
- format.html { redirect_to event_path(@event.id) } # redirect to show upon sucessful update
82
- format.json { render json: @event } # render json using #as_json
83
- end
128
+ def update
129
+ # ...
130
+ respond_to do |format|
131
+ format.html { redirect_to event_path(@event.id) } # redirect to show upon sucessful update
132
+ format.json { render json: @event } # render json using #as_json
84
133
  end
134
+ end
135
+
136
+ private
137
+
138
+ def load_event
139
+ @event = Event.find(params.require(:event_id))
140
+ end
85
141
  end
86
142
  ```
87
143
  #### after
88
144
  ```rb
89
145
  class EventsController < ActionController::Base
90
- include MimeActor::Action
146
+ include MimeActor::Action
91
147
 
92
- # AbstractController::Callbacks here to load model with params
93
- before_action only: [:show, :update] { @event = Event.find(params.require(:event_id)) }
148
+ before_act :load_event, action: %i[show update]
94
149
 
95
- respond_act_to :html, :json, on: [:show, :update]
150
+ respond_act_to :html, on: %i[show update]
151
+ respond_act_to :json, on: %i[show update], with: -> { render json: @event } # render json using #as_json
96
152
 
97
- rescue_act_from ActiveRecord::RecordNotFound, format: :json do |ex|
98
- render status: :bad_request, json: { error: ex.message }
99
- end
153
+ rescue_act_from ActiveRecord::RecordNotFound, format: :json, with: :handle_json_error
100
154
 
101
- rescue_act_from ActiveRecord::RecordNotFound, format: :html, action: :show do |ex|
102
- redirect_to events_path
103
- end
155
+ rescue_act_from ActiveRecord::RecordNotFound, format: :html, action: :show do
156
+ redirect_to events_path
157
+ end
104
158
 
105
- def show_html
106
- render :show # render html using @event
107
- end
159
+ private
160
+
161
+ def show_html
162
+ render :show # render html using @event
163
+ end
108
164
 
109
- def update_html
110
- redirect_to event_path(@event.id) # redirect to show upon sucessful update
111
- rescue ActiveRecord::RecordNotFound
112
- render :edit
113
- end
165
+ def update_html
166
+ # ...
167
+ redirect_to event_path(@event.id) # redirect to show upon sucessful update
168
+ rescue ActiveRecord::RecordNotFound
169
+ render :edit
170
+ end
114
171
 
115
- def show_json
116
- render json: @event # render json using #as_json
117
- end
118
-
119
- def update_json
120
- # ...
121
- render json: @event # render json using #as_json
122
- end
172
+ def handle_json_error(error)
173
+ render status: :bad_request, json: { error: error.message }
174
+ end
123
175
  end
124
176
  ```
data/README.md CHANGED
@@ -1,64 +1,77 @@
1
- # mime_actor
1
+ # Mime Actor
2
2
 
3
3
  [![Version][rubygems_badge]][rubygems]
4
4
  [![CI][ci_badge]][ci_workflows]
5
5
  [![Coverage][coverage_badge]][coverage]
6
6
  [![Maintainability][maintainability_badge]][maintainability]
7
7
 
8
- Action Render + Rescue handlers for different MIME types in Rails
8
+ Action processing with Callback + Rescue handlers for different MIME types in Rails.
9
+
10
+ In most of the Rails apps, a single `ActionController` is only responsible for rendering a single MIME type. That is usually done by calling `ActionController#respond_to` for each action in the controller.
11
+
12
+ ```rb
13
+ class EventsController < ActionController::Base
14
+ def index
15
+ @events = Event.all
16
+ respond_to :json
17
+ end
18
+
19
+ def show
20
+ respond_to do |format|
21
+ format.json { render json: @event }
22
+ end
23
+ end
24
+ end
25
+ ```
26
+
27
+ However, it can be a litte bit messy when some actions render more than a single MIME type with error handling for different MIME type. See [comparison][doc_comparison] to understand more.
9
28
 
10
29
  ## Usage
11
30
 
12
- MimeActor allows you to do something like below:
31
+ **Mime Actor** allows you to do something like:
13
32
  ```rb
14
33
  class EventsController < ActionController::Base
15
- # AbstractController::Callbacks here to load model with params
16
- before_action only: :index { @events = Event.all }
17
- before_action only: [:show, :update] { @event = Event.find(params.require(:event_id)) }
34
+ include MimeActor::Action
18
35
 
19
- respond_act_to :html, :json, on: :index
20
- respond_act_to :html, :json, on: [:show, :update]
36
+ before_act -> { @events = Event.all }, action: :index
37
+ before_act :load_event, action: %i[show update]
38
+ before_act -> { @event_categories = EventCategory.all }, action: :show, format: :html
21
39
 
22
- rescue_act_from ActiveRecord::RecordNotFound, format: :json do |ex|
23
- render status: :bad_request, json: { error: "Resouce not found" }
24
- end
40
+ respond_act_to :html, :json, on: :update
41
+ respond_act_to :html, on: %i[index show], with: :render_html
42
+ respond_act_to :json, on: %i[index show], with: -> { render json: { action: action_name } }
25
43
 
26
- rescue_act_from ActiveRecord::RecordNotFound, format: :html, action: :show do |ex|
27
- redirect_to events_path
28
- end
44
+ rescue_act_from ActiveRecord::RecordNotFound, format: :json, with: :handle_json_error
45
+ rescue_act_from ActiveRecord::RecordNotFound, format: :html, action: :show, with: -> { redirect_to "/events" }
29
46
 
30
- def index_html
31
- @event_categories = EventCategory.all
32
- render :index # render html using @events and @event_categories
33
- end
47
+ private
34
48
 
35
- def index_json
36
- render json: @events # render json using #as_json
37
- end
49
+ def update_html
50
+ # ...
51
+ redirect_to "/events/#{@event.id}" # redirect to show upon sucessful update
52
+ rescue ActiveRecord::RecordNotFound
53
+ render html: :edit
54
+ end
38
55
 
39
- def show_html
40
- render :show # render html using @event
41
- end
56
+ def update_json
57
+ # ...
58
+ render json: @event # render with #to_json
59
+ end
42
60
 
43
- def update_html
44
- redirect_to event_path(@event.id) # redirect to show upon sucessful update
45
- rescue ActiveRecord::RecordNotFound
46
- render :edit
47
- end
61
+ def render_html
62
+ render html: action_name
63
+ end
48
64
 
49
- def show_json
50
- render json: @event # render json using #as_json
51
- end
65
+ def load_event
66
+ @event = Event.find(params.require(:event_id))
67
+ end
52
68
 
53
- def update_json
54
- # ...
55
- render json: @event # render json using #as_json
56
- end
69
+ def handle_json_error(error)
70
+ render status: :bad_request, json: { error: error.message }
71
+ end
57
72
  end
58
73
  ```
59
74
 
60
- Seems useful? See the [Comparison][doc_comparison] on how it can improve your existing code
61
-
62
75
  ## Features
63
76
 
64
77
  - Action customisation for [ActionController][doc_action_controller] per MIME type
@@ -2,12 +2,12 @@
2
2
 
3
3
  # :markup: markdown
4
4
 
5
- require "mime_actor/callbacks"
6
5
  require "mime_actor/logging"
7
6
  require "mime_actor/scene"
8
7
  require "mime_actor/stage"
9
8
 
10
9
  require "active_support/concern"
10
+ require "active_support/core_ext/module/attribute_accessors"
11
11
  require "active_support/core_ext/object/blank"
12
12
  require "active_support/lazy_load_hooks"
13
13
  require "abstract_controller/rendering"
@@ -18,7 +18,7 @@ module MimeActor
18
18
  #
19
19
  # `Action` is the recommended `Module` to be included in the `ActionController`.
20
20
  #
21
- # Provides intuitive way of `action` rendering for a specific MIME type with rescue handlers.
21
+ # Provides intuitive way of `action` processing for a specific MIME type with callback + rescue handlers.
22
22
  #
23
23
  module Action
24
24
  extend ActiveSupport::Concern
@@ -26,17 +26,19 @@ module MimeActor
26
26
  include AbstractController::Rendering # required by MimeResponds
27
27
  include ActionController::MimeResponds
28
28
 
29
- include Callbacks
30
29
  include Scene
31
30
  include Stage
32
31
  include Logging
33
32
 
33
+ included do
34
+ mattr_accessor :actor_delegator, instance_writer: false, default: ->(action, format) { "#{action}_#{format}" }
35
+ end
36
+
34
37
  # The core logic where rendering logics are collected as `Proc` and passed over to `ActionController::MimeResponds`
35
38
  #
36
- # @param action the `action` of the controller
37
- #
38
39
  # @example process `create` action
39
- # start_scene(:create)
40
+ # # it uses AbstractController#action_name to process
41
+ # start_scene
40
42
  #
41
43
  # # it is equivalent to the following if `create` action is configured with `html` and `json` formats
42
44
  # def create
@@ -46,21 +48,19 @@ module MimeActor
46
48
  # end
47
49
  # end
48
50
  #
49
- def start_scene(action)
51
+ def start_scene
52
+ action = action_name.to_sym
50
53
  formats = acting_scenes.fetch(action, {})
51
54
 
52
55
  if formats.empty?
53
- logger.warn { "format is empty for action: #{action.inspect}" }
56
+ logger.warn { "format is empty for action: #{action_name.inspect}" }
54
57
  return
55
58
  end
56
59
 
57
60
  respond_to do |collector|
58
61
  formats.each do |format, actor|
59
- dispatch = lambda do
60
- run_act_callbacks(format) do
61
- cue_actor(actor.presence || "#{action}_#{format}", action:, format:)
62
- end
63
- end
62
+ callable = actor.presence || actor_delegator.call(action, format)
63
+ dispatch = -> { cue_actor(callable, format:) }
64
64
  collector.public_send(format, &dispatch)
65
65
  end
66
66
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :markup: markdown
4
+
5
+ require "active_support/deprecation"
6
+
7
+ module MimeActor
8
+ def self.deprecator
9
+ @deprecator ||= ActiveSupport::Deprecation.new("0.7.0", "MimeActor")
10
+ end
11
+ end
12
+
13
+ [
14
+ [MimeActor::Rescue::ClassMethods, { rescue_actor: "use #rescue_actor instance method" }],
15
+ [MimeActor::Scene::ClassMethods, { act_on_format: :respond_act_to }],
16
+ [MimeActor::Stage::ClassMethods, { actor?: "no longer supported, use Object#respond_to?" }],
17
+ [MimeActor::Stage::ClassMethods, { dispatch_cue: "no longer support anonymous proc with rescue" }],
18
+ [MimeActor::Stage::ClassMethods, { dispatch_act: "no longer support anonymous proc with rescue" }]
19
+ ].each do |klazz, *args|
20
+ MimeActor.deprecator.deprecate_methods(klazz, *args)
21
+ end
@@ -16,7 +16,7 @@ module MimeActor
16
16
  end
17
17
 
18
18
  def call(target)
19
- raise MimeActor::ActorNotFound, method_name unless target.respond_to?(method_name)
19
+ raise MimeActor::ActorNotFound, method_name unless target.respond_to?(method_name, true)
20
20
 
21
21
  method_call = target.method(method_name)
22
22
  filtered_args = method_call.arity.negative? ? args : args.take(method_call.arity)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :markup: markdown
4
+
5
+ module MimeActor
6
+ class Railtie < Rails::Railtie
7
+ initializer "mime_actor.deprecator", before: :load_environment_config do |app|
8
+ app.deprecators[:mime_actor] = MimeActor.deprecator
9
+ end
10
+ end
11
+ end
@@ -47,9 +47,9 @@ module MimeActor
47
47
  #
48
48
  def rescue_act_from(*klazzes, action: nil, format: nil, with: nil, &block)
49
49
  raise ArgumentError, "error filter is required" if klazzes.empty?
50
- raise ArgumentError, "provide either the with: argument or a block" unless with.present? ^ block_given?
50
+ raise ArgumentError, "provide either with: or a block" unless with.present? ^ block_given?
51
51
 
52
- validate!(:with, with) if with.present?
52
+ validate!(:callable, with) if with.present?
53
53
  with = block if block_given?
54
54
 
55
55
  validate!(:action_or_actions, action) if action.present?
@@ -84,9 +84,9 @@ module MimeActor
84
84
  def respond_act_to(*formats, on: nil, with: nil, &block)
85
85
  validate!(:formats, formats)
86
86
 
87
- raise ArgumentError, "provide either the with: argument or a block" if with.present? && block_given?
87
+ raise ArgumentError, "provide either with: or a block" if with.present? && block_given?
88
88
 
89
- validate!(:with, with) if with.present?
89
+ validate!(:callable, with) if with.present?
90
90
  with = block if block_given?
91
91
 
92
92
  raise ArgumentError, "action is required" unless (actions = on).present?
@@ -116,11 +116,11 @@ module MimeActor
116
116
  def define_scene(action)
117
117
  module_eval(
118
118
  # def index
119
- # self.respond_to?(:start_scene) && self.start_scene(:index)
119
+ # self.respond_to?(:start_scene) && self.start_scene
120
120
  # end
121
121
  <<-RUBY, __FILE__, __LINE__ + 1
122
122
  def #{action}
123
- self.respond_to?(:start_scene) && self.start_scene(:#{action})
123
+ self.respond_to?(:start_scene) && self.start_scene
124
124
  end
125
125
  RUBY
126
126
  )
@@ -2,6 +2,7 @@
2
2
 
3
3
  # :markup: markdown
4
4
 
5
+ require "mime_actor/callbacks"
5
6
  require "mime_actor/dispatcher"
6
7
  require "mime_actor/logging"
7
8
  require "mime_actor/rescue"
@@ -17,6 +18,7 @@ module MimeActor
17
18
  module Stage
18
19
  extend ActiveSupport::Concern
19
20
 
21
+ include Callbacks
20
22
  include Rescue
21
23
  include Logging
22
24
 
@@ -76,21 +78,21 @@ module MimeActor
76
78
  # @param actor either a method name or a Proc to evaluate
77
79
  # @param args arguments to be passed when calling the actor
78
80
  #
79
- def cue_actor(actor, *args, action:, format:)
81
+ def cue_actor(actor, *args, format:)
80
82
  dispatcher = MimeActor::Dispatcher.build(actor, *args)
81
83
  raise TypeError, "invalid actor, got: #{actor.inspect}" unless dispatcher
82
84
 
83
- result = dispatcher.call(self)
84
- if block_given?
85
- yield result
86
- else
87
- result
85
+ self.class.validate!(:format, format)
86
+
87
+ run_act_callbacks(format) do
88
+ result = dispatcher.call(self)
89
+ block_given? ? yield(result) : result
88
90
  end
89
91
  rescue MimeActor::ActorNotFound => e
90
92
  logger.error { "actor error, cause: #{e.inspect}" } unless raise_on_actor_error
91
93
  raise e if raise_on_actor_error
92
94
  rescue StandardError => e
93
- rescued = rescue_actor(e, action:, format:)
95
+ rescued = rescue_actor(e, action: action_name.to_sym, format: format)
94
96
  rescued || raise
95
97
  end
96
98
  end
@@ -96,13 +96,13 @@ module MimeActor
96
96
  TypeError.new("#{unchecked.inspect} must be a Class/Module or a String referencing a Class/Module")
97
97
  end
98
98
 
99
- # Validate `with` must be a Symbol or Proc
99
+ # Validate `callable` must be a Symbol or Proc
100
100
  #
101
- # @param unchecked the `with` to be validated
102
- def validate_with(unchecked)
101
+ # @param unchecked the `callable` to be validated
102
+ def validate_callable(unchecked)
103
103
  return if unchecked.is_a?(Proc) || unchecked.is_a?(Symbol)
104
104
 
105
- TypeError.new("with handler must be a Symbol or Proc, got: #{unchecked.inspect}")
105
+ TypeError.new("#{unchecked.inspect} must be a Symbol or Proc")
106
106
  end
107
107
  end
108
108
  end
@@ -14,7 +14,7 @@ module MimeActor
14
14
  module VERSION
15
15
  MAJOR = 0
16
16
  MINOR = 6
17
- BUILD = 3
17
+ BUILD = 4
18
18
  PRE = "alpha"
19
19
 
20
20
  STRING = [MAJOR, MINOR, BUILD, PRE].compact.join(".")
data/lib/mime_actor.rb CHANGED
@@ -6,30 +6,21 @@
6
6
  require "mime_actor/version"
7
7
  require "mime_actor/errors"
8
8
 
9
- require "active_support/dependencies/autoload"
10
- require "active_support/deprecation"
9
+ # load mime_actor components
10
+ require "mime_actor/action"
11
+ require "mime_actor/callbacks"
12
+ require "mime_actor/logging"
13
+ require "mime_actor/rescue"
14
+ require "mime_actor/scene"
15
+ require "mime_actor/stage"
16
+ require "mime_actor/validator"
11
17
 
12
- module MimeActor
13
- extend ActiveSupport::Autoload
18
+ require "mime_actor/deprecator"
14
19
 
15
- autoload :Action
16
- autoload :Scene
17
- autoload :Stage
18
- autoload :Rescue
19
- autoload :Validator
20
- autoload :Logging
21
-
22
- def self.deprecator
23
- @deprecator ||= ActiveSupport::Deprecation.new("0.7.0", "MimeActor")
24
- end
25
-
26
- [
27
- [MimeActor::Rescue::ClassMethods, { rescue_actor: "use #rescue_actor instance method" }],
28
- [MimeActor::Scene::ClassMethods, { act_on_format: :respond_act_to }],
29
- [MimeActor::Stage::ClassMethods, { actor?: "no longer supported, use Object#respond_to?" }],
30
- [MimeActor::Stage::ClassMethods, { dispatch_cue: "no longer support anonymous proc with rescue" }],
31
- [MimeActor::Stage::ClassMethods, { dispatch_act: "no longer support anonymous proc with rescue" }]
32
- ].each do |klazz, *args|
33
- deprecator.deprecate_methods(klazz, *args)
34
- end
20
+ begin
21
+ require "rails"
22
+ rescue LoadError
23
+ # noop
35
24
  end
25
+
26
+ require "mime_actor/railtie" if defined?(Rails::Railtie)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mime_actor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3.alpha
4
+ version: 0.6.4.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Chang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-23 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -59,22 +59,17 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".hound.yml"
63
- - ".rspec"
64
- - ".rubocop.yml"
65
- - ".ruby-version"
66
- - ".yardopts"
67
62
  - COMPARE.md
68
63
  - LICENSE
69
64
  - README.md
70
- - Rakefile
71
- - codecov.yml
72
65
  - lib/mime_actor.rb
73
66
  - lib/mime_actor/action.rb
74
67
  - lib/mime_actor/callbacks.rb
68
+ - lib/mime_actor/deprecator.rb
75
69
  - lib/mime_actor/dispatcher.rb
76
70
  - lib/mime_actor/errors.rb
77
71
  - lib/mime_actor/logging.rb
72
+ - lib/mime_actor/railtie.rb
78
73
  - lib/mime_actor/rescue.rb
79
74
  - lib/mime_actor/scene.rb
80
75
  - lib/mime_actor/stage.rb
@@ -108,5 +103,6 @@ requirements: []
108
103
  rubygems_version: 3.5.9
109
104
  signing_key:
110
105
  specification_version: 4
111
- summary: Action Render + Rescue handlers for different MIME types in Rails
106
+ summary: Action processing with Callback + Rescue handlers for different MIME types
107
+ in Rails
112
108
  test_files: []
data/.hound.yml DELETED
@@ -1,2 +0,0 @@
1
- rubocop:
2
- enabled: false
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,66 +0,0 @@
1
- require:
2
- - rubocop-rake
3
- - rubocop-rspec
4
-
5
- AllCops:
6
- TargetRubyVersion: 3.1
7
- NewCops: enable
8
- Exclude:
9
- - bin/*
10
- - vendor/**/*
11
-
12
- Style/Documentation:
13
- Enabled: false
14
-
15
- Style/BlockComments:
16
- Exclude:
17
- - spec/*_helper.rb
18
-
19
- Style/RegexpLiteral:
20
- EnforcedStyle: percent_r
21
-
22
- Metrics/AbcSize:
23
- Enabled: false
24
-
25
- Metrics/BlockLength:
26
- AllowedMethods:
27
- - class_methods
28
-
29
- Metrics/CyclomaticComplexity:
30
- Enabled: false
31
-
32
- Metrics/PerceivedComplexity:
33
- Enabled: false
34
-
35
- Metrics/MethodLength:
36
- CountAsOne: ['array', 'heredoc', 'method_call']
37
- Max: 15
38
-
39
- Style/StringLiterals:
40
- EnforcedStyle: double_quotes
41
-
42
- Style/StringLiteralsInInterpolation:
43
- EnforcedStyle: double_quotes
44
-
45
- Style/HashSyntax:
46
- EnforcedShorthandSyntax: consistent
47
-
48
- Layout/FirstHashElementIndentation:
49
- EnforcedStyle: consistent
50
-
51
- Layout/HashAlignment:
52
- EnforcedHashRocketStyle: table
53
- EnforcedColonStyle: table
54
-
55
- RSpec/MultipleExpectations:
56
- Max: 6
57
-
58
- RSpec/ExampleLength:
59
- CountAsOne: ['array', 'heredoc', 'method_call']
60
- Max: 10
61
-
62
- RSpec/MultipleMemoizedHelpers:
63
- Max: 10
64
-
65
- RSpec/NestedGroups:
66
- Max: 5
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.3.1
data/.yardopts DELETED
@@ -1,2 +0,0 @@
1
- --markup markdown
2
- lib/**/*.rb
data/Rakefile DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
-
5
- require "rubocop/rake_task"
6
- RuboCop::RakeTask.new
7
-
8
- require "rspec/core/rake_task"
9
- RSpec::Core::RakeTask.new(:spec)
data/codecov.yml DELETED
@@ -1,18 +0,0 @@
1
- codecov:
2
- notify:
3
- wait_for_ci: false
4
- require_ci_to_pass: false
5
-
6
- coverage:
7
- status:
8
- project:
9
- default:
10
- target: 99%
11
- threshold: 1%
12
- patch:
13
- default:
14
- target: 99%
15
- threshold: 1%
16
-
17
- comment:
18
- require_changes: true