motorhead 0.3.9 → 0.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
  SHA1:
3
- metadata.gz: 4781c996444d1a9ca337aa5d1bf6fb69d94cd08e
4
- data.tar.gz: faa1a2f4e4c4a7f7b9f24f26e177b135a3a82ee4
3
+ metadata.gz: 5da96ff9de01b6bd45257a2b9a42777a925f3acb
4
+ data.tar.gz: 3f2377fb39dba6442dae76751d4c2ed39363e61f
5
5
  SHA512:
6
- metadata.gz: 2ee77af9cd14c25d10e17dce2f4071c3417cb88bca51b660c5b65bfe0cbc69cb7ecaf48d2feb01ae718e31235a35b01fa8ca9d912f2868fe0706a4d5d7b6736e
7
- data.tar.gz: 4497e16918b8c31a7ccbead08d188955a0330aee71f6883bfc7c6565ad7151e5df5e404ad66c354f5463efc8538190fbee7306850797b75c189409c5988c9598
6
+ metadata.gz: 60516910dc8605c810355189928dacf857faf8998f0a51b69fa10ac90de1483e346dd3b3cd55f3cec9aa389b94d0e038695acbe390013b6ec802636c616b3b90
7
+ data.tar.gz: 180cf4a084f3c9106e01428c21f64ad95610b3bcd8087c3b802a91e6290388d83ba2087f47f493c89b96c07ed1703b60dc89850ed7abffd81642766a6760ba46
@@ -1,4 +1,11 @@
1
1
  language: ruby
2
+ sudo: false
3
+
2
4
  rvm:
3
5
  - 2.3.0
4
- before_install: gem install bundler -v 1.10.6
6
+
7
+ before_install: gem install bundler -v 1.11.2
8
+
9
+ gemfile:
10
+ - gemfiles/Gemfile-rails.4.2.x
11
+ - gemfiles/Gemfile-rails.5.0.x
data/README.md CHANGED
@@ -16,7 +16,7 @@ Bundle into your Rails app.
16
16
  ### Isolated Engine
17
17
 
18
18
  Motorhead helps you mounting specially creafted Isolated Engines onto the main Rails app.
19
- An engine can contain whole MVC conponents, which means that you can encapsulate everything that are needed for your new feature under one single directory.
19
+ An engine can contain whole MVC components, which means that you can encapsulate everything that are needed for your new feature under one single directory.
20
20
  This helps your team creating multiple new features simultaneously without causing code conflict.
21
21
 
22
22
  ### Conditional Execution
data/Rakefile CHANGED
@@ -4,6 +4,8 @@ require "rake/testtask"
4
4
  Rake::TestTask.new(:test) do |t|
5
5
  t.libs << "test"
6
6
  t.libs << "lib"
7
+ t.warning = true
8
+ t.verbose = true
7
9
  t.test_files = FileList['test/**/*_test.rb']
8
10
  end
9
11
 
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :path => '../'
4
+
5
+ gem 'rails', '~> 5.0.0'
6
+ gem 'controller_extension', path: '../test/dummy_app/app/engines/controller_extension'
7
+ gem 'controller_fallback', path: '../test/dummy_app/app/engines/controller_fallback'
8
+ gem 'view_render_fallback', path: '../test/dummy_app/app/engines/view_render_fallback'
9
+ gem 'routes_fallback', path: '../test/dummy_app/app/engines/routes_fallback'
10
+ gem 'italian', path: '../test/dummy_app/app/engines/italian'
11
+ gem 'spanish', path: '../test/dummy_app/app/engines/spanish'
12
+ gem 'simple_controller', path: '../test/dummy_app/app/engines/simple_controller'
13
+ gem 'mount_at_capricorn', path: '../test/dummy_app/app/engines/mount_at_capricorn'
14
+ gem 'redirector', path: '../test/dummy_app/app/engines/redirector'
@@ -27,13 +27,13 @@ module Motorhead
27
27
  begin
28
28
  super
29
29
  @_motorhead_action_successfully_finished = true
30
- env['motorhead_view_assigns'] = view_assigns
30
+ request.env['motorhead_view_assigns'] = view_assigns
31
31
  rescue => e
32
32
  (self.class.parent::Engine.on_error || Motorhead.config.on_error).call(e)
33
33
  end
34
34
  when ::ActionController::Base
35
- if env.key? 'motorhead_render_result'
36
- self.response = env.delete 'motorhead_render_result'
35
+ if request.env.key? 'motorhead_render_result'
36
+ self.response = request.env.delete 'motorhead_render_result'
37
37
  headers.delete 'X-Cascade'
38
38
  self.response_body = response.body
39
39
  else
@@ -58,8 +58,8 @@ module Motorhead
58
58
  end
59
59
 
60
60
  def view_assigns
61
- if env.key? 'motorhead_view_assigns'
62
- super.merge env['motorhead_view_assigns']
61
+ if request.env.key? 'motorhead_view_assigns'
62
+ super.merge request.env['motorhead_view_assigns']
63
63
  else
64
64
  super
65
65
  end
@@ -68,13 +68,13 @@ module Motorhead
68
68
  def render_to_body(options = {})
69
69
  return if (headers['X-Cascade'] == 'pass') && !defined?(@_motorhead_action_successfully_finished)
70
70
  ret = super
71
- env['motorhead_render_result'] = response
71
+ request.env['motorhead_render_result'] = response
72
72
  ret
73
73
  end
74
74
 
75
75
  def redirect_to(options = {}, response_status = {}) #:doc:
76
76
  ret = super
77
- env['motorhead_render_result'] = response
77
+ request.env['motorhead_render_result'] = response
78
78
  ret
79
79
  end
80
80
  end
@@ -13,7 +13,8 @@ ActionView::Base.class_eval do
13
13
  end
14
14
  end
15
15
 
16
- alias_method_chain :render, :motorhead
16
+ alias_method :render_without_motorhead, :render
17
+ alias_method :render, :render_with_motorhead
17
18
  end
18
19
 
19
20
  module Motorhead
@@ -6,7 +6,6 @@ module Motorhead
6
6
 
7
7
  module ClassMethods
8
8
  attr_accessor :on_error
9
- attr_reader :mount_at
10
9
 
11
10
  def active_if(&block)
12
11
  @active_if = block
@@ -17,7 +16,11 @@ module Motorhead
17
16
  end
18
17
 
19
18
  def mount_at(path = nil)
20
- path ? @mount_at = path : @mount_at
19
+ if path
20
+ @mount_at = path
21
+ else
22
+ defined?(@mount_at) && @mount_at
23
+ end
21
24
  end
22
25
  end
23
26
 
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
15
15
 
16
- s.add_dependency "rails", "~> 4.2.4"
16
+ s.add_dependency 'rails'
17
17
 
18
18
  s.add_development_dependency "sqlite3"
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module Motorhead
2
- VERSION = '0.3.9'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motorhead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - README.md
124
124
  - Rakefile
125
125
  - gemfiles/Gemfile-rails.4.2.x
126
+ - gemfiles/Gemfile-rails.5.0.x
126
127
  - lib/generators/motorhead/controller_generator.rb
127
128
  - lib/generators/motorhead/templates/controller.rb
128
129
  - lib/generators/motorhead/templates/lib/%name%/engine.rb
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  version: '0'
166
167
  requirements: []
167
168
  rubyforge_project:
168
- rubygems_version: 2.4.5.1
169
+ rubygems_version: 2.5.1
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: A safe and rapid prototyping framework for Rails