appfuel 0.6.15 → 0.6.16

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: 9e83cd4ab48fd907d24835e074b60a465de1baca
4
- data.tar.gz: a18ac59dc099260df0f28693333fc46016a833d9
3
+ metadata.gz: 46d6099158e6bd37b5c2b5874bb7cfc1e971e892
4
+ data.tar.gz: 82990a895704f9a3eb8691f7d393419e1c2dc776
5
5
  SHA512:
6
- metadata.gz: 2bee1ca2cd41b1ff54e27cb888ea742ad1de1d4df8993d4ca9006532ee83bb7510cc1bf9a2403db49013017920c8d8e195ddd25c99b54cb6d718b5c487a02b2e
7
- data.tar.gz: 5a66604fcd3ffb618da8e290e22d67f720363c4e1dee44c85936f3606ffd5b7599ceb6486bcdc05666f6da007ddec92768618aa3ed68dc8d80c16ea2480e4443
6
+ metadata.gz: da762dcd0e5b1ac71e6560b4fe9ec0d25893e78aeed04c40679487f711ace955d66cc118b5f3702dfccd859b0c0100d19ccec34fcb751a3b6e35ddc3da8636aa
7
+ data.tar.gz: ecf26cf0fe91ec6de8b5f3dbaf93c0c972e5c4d4fa70d7a156bdc49f1695e92de4dba19ec5897dfaf08ef72bdddf146fb7ed20e8fff086c57eb821e74f94c63e
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. (Pending ap
5
5
 
6
6
 
7
7
  # Releases
8
+ ## [[0.6.16]](https://github.com/rsb/appfuel/releases/tag/0.6.16) 2017-10-02
9
+ ### Fixed
10
+ - bootstrapping allow testing to disable initializers, swap out config data
11
+ and pass in params to Initialize.run directly from the root module
12
+
8
13
  ## [[0.6.15]](https://github.com/rsb/appfuel/releases/tag/0.6.15) 2017-09-28
9
14
  ### Fixed
10
15
  - initializer failing when key exists in the feature
data/lib/appfuel.rb CHANGED
@@ -98,7 +98,6 @@ module Appfuel
98
98
  di.resolve(key)
99
99
  end
100
100
 
101
-
102
101
  # Register an item in the application container
103
102
  #
104
103
  # @raises RuntimeError when container does not implement :register
@@ -128,6 +127,14 @@ module Appfuel
128
127
  container
129
128
  end
130
129
 
130
+ # This will tell you if the application container has been setup and ready
131
+ # for bootstrapping
132
+ #
133
+ # @return [Boolean]
134
+ def setup?
135
+ framework_container.key?(:setup) && framework_container[:setup] == true
136
+ end
137
+
131
138
  # Run all initializers registered in the app container
132
139
  #
133
140
  # @param container [Dry::Container] application container
@@ -31,6 +31,7 @@ module Appfuel
31
31
  handle_after_setup(params[:on_after_setup], app_container)
32
32
  end
33
33
 
34
+ framework_container.register(:setup, true)
34
35
  app_container
35
36
  end
36
37
 
@@ -131,8 +132,8 @@ module Appfuel
131
132
  container
132
133
  end
133
134
 
134
- def bootstrap(overrides: {}, env: ENV)
135
- Initialize.run(overrides: overrides, env: env)
135
+ def bootstrap(params = {})
136
+ Initialize.run(params)
136
137
  end
137
138
 
138
139
  def call(route, inputs = {})
@@ -52,12 +52,22 @@ module Appfuel
52
52
  # @option env [ENV] used to collect environment variables
53
53
  # @return [Dry::Container] that was passed in
54
54
  def handle_configuration(container, params = {})
55
- overrides = params[:overrides] || {}
56
- env = params[:env] || ENV
57
- definition = container['config_definition']
58
55
 
59
- config = definition.populate(env: env, overrides: overrides)
60
- env = config.fetch(:env) { fail "key (:env) is missing from config" }
56
+ config = if params.key?(:config)
57
+ params[:config]
58
+ else
59
+ definition = container['config_definition']
60
+ system_env = params[:env] || ENV
61
+ overrides = params[:overrides] || {}
62
+ definition.populate(env: system_env, overrides: overrides)
63
+ end
64
+
65
+
66
+ env = if params.key?(:app_env)
67
+ params[:app_env]
68
+ else
69
+ config.fetch(:env) { fail "key (:env) is missing from config" }
70
+ end
61
71
 
62
72
  container.register(:config, config)
63
73
  container.register(:env, env)
@@ -79,6 +89,12 @@ module Appfuel
79
89
  # @option app_name [String] name of the app to initialize, (optional)
80
90
  # @return [Dry::Container]
81
91
  def run(params = {})
92
+ unless Appfuel.setup?
93
+ fail "Appfuel can not be initialized unit it is setup. " +
94
+ "Please use setup_appfuel(params) dsl in your root " +
95
+ "before bootstrapping"
96
+ end
97
+
82
98
  app_name = params.fetch(:app_name) { Appfuel.default_app_name }
83
99
  container = Appfuel.app_container(app_name)
84
100
  if container.key?(:initialized) && container[:initialized] == true
@@ -58,7 +58,14 @@ module Appfuel
58
58
  response = adapter::Request.execute(data)
59
59
  response = handle_response(response, options[:headers])
60
60
  rescue RestClient::ExceptionWithResponse => err
61
- handle_http_error(err.http_code, err.http_body, http_url, err.message)
61
+
62
+ handle_method = "handle_#{err.http_code}"
63
+
64
+ if respond_to?(handle_method)
65
+ return send(handle_method, err)
66
+ else
67
+ handle_http_error(err.http_code, {}, http_url, err.message)
68
+ end
62
69
  end
63
70
 
64
71
  response
@@ -1,3 +1,3 @@
1
1
  module Appfuel
2
- VERSION = "0.6.15"
2
+ VERSION = "0.6.16"
3
3
  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.6.15
4
+ version: 0.6.16
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-09-28 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord