launchbox 0.0.1 → 0.0.2
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 +4 -4
- data/lib/launchbox/config.rb +9 -10
- data/lib/launchbox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2abfea5840f853aa48a90aeac8266161586bb288
|
4
|
+
data.tar.gz: fcb37f6e7dabb9dc1b81cd7ee9b812b3ac9474e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1909571380957ee25da7f6e33888cdd0b0a2bb0030e276e04f667fc73c16c18da0b690da78e70fbc6e47cf0cc644f9681e31baa653bc21c3932c065b3ac5b8a
|
7
|
+
data.tar.gz: 3d5fa5ff27aba50c25fc17395727680927c1e27b181425e9458a1c040d33d3ed2ebf7f5dfa75bef184defc70442cf7e7bb174f7bae215c3f71fba9659989f879
|
data/lib/launchbox/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'open-uri'
|
2
3
|
require 'json'
|
3
4
|
|
4
5
|
BASE_CONFIG_URL = "https://launchbox.herokuapp.com/api/v1/config"
|
@@ -19,28 +20,26 @@ module Launchbox
|
|
19
20
|
# contact server and look for config
|
20
21
|
configUrl = "#{BASE_CONFIG_URL}?user_email=#{ENV['LAUNCHBOX_USER_EMAIL']}&user_token=#{ENV['LAUNCHBOX_USER_TOKEN']}"
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
27
|
-
if response.code == "200"
|
28
|
-
json = JSON.parse(response.body)
|
23
|
+
begin
|
24
|
+
response = URI.parse(configUrl).read
|
25
|
+
|
26
|
+
json = JSON.parse(response)
|
29
27
|
|
30
28
|
# FIXME: LAUNCHBOX_APP_ID -- json[0] is hardcoding the first app.
|
31
29
|
app = json[0]
|
32
30
|
# set environment variables for each service
|
33
31
|
app.each do |service|
|
34
32
|
service['env_vars'].each do |key, value|
|
33
|
+
puts "setting environment variable #{key}"
|
35
34
|
ENV[key] = value
|
36
35
|
end
|
37
36
|
end
|
38
37
|
return true, "Success"
|
39
|
-
|
38
|
+
|
39
|
+
rescue OpenURI::HTTPError => ex
|
40
40
|
return false, "Error: Unauthorized use of Launchbox. Be sure to set ENV['LAUNCHBOX_USER_EMAIL'] and ENV['LAUNCHBOX_USER_TOKEN']"
|
41
|
-
else
|
42
|
-
return false, "Error: Error getting Launchbox config"
|
43
41
|
end
|
42
|
+
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
data/lib/launchbox/version.rb
CHANGED