addons 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/addons.gemspec +1 -1
- data/lib/addons/config.rb +10 -13
- data/lib/addons/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b37f0db365cf94d2d92be898f5e8b4bac03a36
|
4
|
+
data.tar.gz: 5163d2afbcb9adcc199bf28697213fe792d0fd7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7326ded313128265cc34186fcfb20804c2626fc3bdf1fc59b72a33d541308232f26ca7c35c79a7a22ca235beff29c0dc59815a369637250f24db41029822fa2
|
7
|
+
data.tar.gz: 015635e5ced16c5923b520a5eac9cbb7faa15129558e2df532e481d61eac484392a7b4166305bc554a61cfeca89d253d97246c06f607f145a3398a222d0d19b0
|
data/README.md
CHANGED
data/addons.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Addonlist"]
|
10
10
|
spec.email = ["engineering@addonlist.com"]
|
11
11
|
spec.description = %q{Connect your app to Addons for all your service integrations in one place.}
|
12
|
-
spec.summary = %q{After configuring your app with addons
|
12
|
+
spec.summary = %q{After configuring your app with addons, set app_id and app_token variables (ENV['ADDONS_APP_ID'] and ENV['ADDONS_APP_TOKEN']), the gem will pull your services config and set them up for immediate use.}
|
13
13
|
spec.homepage = ""
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/lib/addons/config.rb
CHANGED
@@ -2,31 +2,28 @@ require 'net/http'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'json'
|
4
4
|
|
5
|
-
BASE_CONFIG_URL = "https://launchbox.herokuapp.com/api/v1/config"
|
5
|
+
BASE_CONFIG_URL = "https://launchbox.herokuapp.com/api/v1/apps/config"
|
6
6
|
|
7
7
|
module Addons
|
8
8
|
class Config
|
9
9
|
def self.init
|
10
10
|
puts "Initializing Addons::Config"
|
11
11
|
|
12
|
-
puts "checking ENV['
|
12
|
+
puts "checking ENV['ADDONS_APP_ID'] and ENV['ADDONS_APP_TOKEN']"
|
13
13
|
|
14
|
-
if ENV['
|
15
|
-
return false, "Error: ENV['
|
16
|
-
elsif ENV['
|
17
|
-
return false, "Error: ENV['
|
14
|
+
if ENV['ADDONS_APP_ID'] == nil
|
15
|
+
return false, "Error: ENV['ADDONS_APP_ID'] must be defined"
|
16
|
+
elsif ENV['ADDONS_APP_TOKEN'] == nil
|
17
|
+
return false, "Error: ENV['ADDONS_APP_TOKEN'] must be defined"
|
18
18
|
end
|
19
19
|
|
20
20
|
# contact server and look for config
|
21
|
-
configUrl = "#{BASE_CONFIG_URL}?
|
21
|
+
configUrl = "#{BASE_CONFIG_URL}?app_id=#{ENV['ADDONS_APP_ID']}&app_token=#{ENV['ADDONS_APP_TOKEN']}"
|
22
22
|
|
23
23
|
begin
|
24
24
|
response = URI.parse(configUrl).read
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
# FIXME: LAUNCHBOX_APP_ID -- json[0] is hardcoding the first app.
|
29
|
-
app = json[0]
|
26
|
+
services = JSON.parse(response)
|
30
27
|
|
31
28
|
# gitignore config/application.yml so we aren't storing sensitive info in .git
|
32
29
|
# TODO: replace figaro with figaro-addons and application.yml with addons.yml
|
@@ -51,7 +48,7 @@ module Addons
|
|
51
48
|
# NOTE: 'w' overwrites the previous file!
|
52
49
|
File.open(filename, 'w') do |file|
|
53
50
|
# set environment variables for each service
|
54
|
-
|
51
|
+
services.each do |service|
|
55
52
|
service['env_vars'].each do |key, value|
|
56
53
|
puts "setting environment variable #{key}"
|
57
54
|
|
@@ -66,7 +63,7 @@ module Addons
|
|
66
63
|
return true, "Success"
|
67
64
|
|
68
65
|
rescue OpenURI::HTTPError => ex
|
69
|
-
return false, "Error: Unauthorized use of Addons. Be sure to set ENV['
|
66
|
+
return false, "Error: Unauthorized use of Addons. Be sure to set ENV['ADDONS_APP_ID'] and ENV['ADDONS_APP_TOKEN']"
|
70
67
|
end
|
71
68
|
|
72
69
|
end
|
data/lib/addons/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: addons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Addonlist
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -122,8 +122,8 @@ rubyforge_project:
|
|
122
122
|
rubygems_version: 2.0.3
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
|
-
summary: After configuring your app with addons
|
126
|
-
(ENV['
|
127
|
-
|
125
|
+
summary: After configuring your app with addons, set app_id and app_token variables
|
126
|
+
(ENV['ADDONS_APP_ID'] and ENV['ADDONS_APP_TOKEN']), the gem will pull your services
|
127
|
+
config and set them up for immediate use.
|
128
128
|
test_files:
|
129
129
|
- spec/addons_spec.rb
|