appfuel 0.2.10 → 0.2.11

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: fb01f2af404a6c49b1f3d16b0da2a5a3b390ddba
4
- data.tar.gz: 793a7ea7d2116b085efebf3edd2a85ab650abeed
3
+ metadata.gz: 684209e19f1a18b1b855531cc3cfa8a3780add38
4
+ data.tar.gz: fa2a53437d5dc7c08dc8364bb83a4bd6bf2ee5d6
5
5
  SHA512:
6
- metadata.gz: b9b64371ae4dec6e1d64ba75932e9051216d3fdc4a94fbef43d11788b5f5ffac8490d6f39f3a9086a4d3f2cf23bba3a8153872e7b6c0501afca24b6c8d60e49a
7
- data.tar.gz: f2d8f9667d9d51eeb42d091ab752933a6043fee82f1d187d01ea2fa81c55f0b3cdbcf39da79c45b34f885d4d2d0ed42f0b833b534462603fd7d30c423521860a
6
+ metadata.gz: e16e8282f66922d69856c3c693ab007984a319898248392210de9412c4ace6e2b78d6798ecb2bcfea84f566fadf5dc0eaed10e71a6721e7dc1346f1f44c52a95
7
+ data.tar.gz: 51369a25b4359e1bd30dd8162a3303e9685a6e953a3e435dd5124d032d33fc6e0311bdbe2ca84239bdd7a368b6b254510166470e9f689977e25ab72f5e1bb6b7
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. (Pending ap
5
5
 
6
6
 
7
7
  # Releases
8
+ ## [[0.2.11]](https://github.com/rsb/appfuel/releases/tag/0.2.9) 2017-06-15
9
+ ### Changed
10
+ - Adding error handling to dispatching. Errors are converted to responses
11
+
8
12
  ## [[0.2.10]](https://github.com/rsb/appfuel/releases/tag/0.2.9) 2017-06-14
9
13
  ### Fixed
10
14
  - configuration delete was using string for the key, corrected to symbol
@@ -5,25 +5,14 @@ module Appfuel
5
5
  def dispatch(request, container)
6
6
  begin
7
7
  container[:feature_initializer].call(request.feature, container)
8
- action = container[:action_loader].call(request.namespace, container)
8
+ action = container[:action_loader].call(request.namespace, container)
9
9
  response = action.run(request.inputs)
10
10
  rescue => e
11
- handle_error(e, container)
11
+ handler = Appfuel::ResponseHandler.new
12
+ response = handler.error(e)
12
13
  end
13
14
 
14
- if response.failure?
15
- handle_error(contaier, :failed, error)
16
- end
17
- end
18
-
19
- private
20
- def handle_error(e, container)
21
- p e.message
22
- p e.backtrace
23
- end
24
-
25
- def default_error_handling(e, container)
26
-
15
+ response
27
16
  end
28
17
  end
29
18
  end
@@ -13,13 +13,20 @@ module Appfuel
13
13
  # @return [Boolean]
14
14
  def call(name, container)
15
15
  name = name.to_s.underscore
16
- feature_key = "features.#{name}"
16
+ feature_key = "features.#{name}"
17
+ return false if initialized?(container, feature_key)
18
+
17
19
  unless container.key?(feature_key)
18
20
  Appfuel.setup_container_dependencies(feature_key, container)
19
21
  end
20
22
 
21
23
  unless require_feature_disabled?(container, feature_key)
22
- require "#{container[:features_path]}/#{name}"
24
+ feature_path = "#{container[:features_path]}/#{name}"
25
+ begin
26
+ require feature_path
27
+ rescue LoadError => _e
28
+ raise "[#{feature_key} initialize] could not load #{feature_path}"
29
+ end
23
30
  end
24
31
 
25
32
  container[:auto_register_classes].each do |klass|
@@ -27,7 +34,6 @@ module Appfuel
27
34
  container.register(klass.container_class_path, klass)
28
35
  end
29
36
 
30
- return false if initialized?(container, feature_key)
31
37
 
32
38
  Appfuel.run_initializers(feature_key, container)
33
39
  true
@@ -1,3 +1,3 @@
1
1
  module Appfuel
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
data/lib/appfuel.rb CHANGED
@@ -142,10 +142,15 @@ module Appfuel
142
142
  end
143
143
 
144
144
  exclude.map! {|item| item.to_s}
145
- namespace = "#{key}.initializers"
146
- runlist_key = "#{namespace}.run"
147
- env = container['env']
148
- config = container['config']
145
+ namespace = "#{key}.initializers"
146
+ finished_key = "#{key}.initialized"
147
+ runlist_key = "#{namespace}.run"
148
+ env = container['env']
149
+ config = container['config']
150
+
151
+ if container.key?(finished_key) && container[finished_key] == true
152
+ return false
153
+ end
149
154
 
150
155
  runlist = []
151
156
  if container.key?(runlist_key)
@@ -173,7 +178,7 @@ module Appfuel
173
178
  raise error
174
179
  end
175
180
  end
176
- container.register("#{key}.initialized", true)
181
+ container.register(finished_key, true)
177
182
 
178
183
  container
179
184
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appfuel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Scott-Buccleuch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord