addons 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c118692550919048d67af86cb78cf3c8825e1206
4
- data.tar.gz: e2601cab1fc450c983c9ef8cb9175b711699a0b8
3
+ metadata.gz: 71b37f0db365cf94d2d92be898f5e8b4bac03a36
4
+ data.tar.gz: 5163d2afbcb9adcc199bf28697213fe792d0fd7d
5
5
  SHA512:
6
- metadata.gz: 0970425003c415253f784cfc6522e1c252e634d75becff752bc0616b823cae4dd969d1d06348be76a85d88b99d6bcadaca424f6cdbe03cd92f40c101fdcb5692
7
- data.tar.gz: a3f0a2691783553dec8069ef0903c4eb9c1a55a80b3c433da61f3d465f25c14dd5b8e22f9f4e97e4bdf33c29035b20e7bb4514a325767e9394d3e5b92ea67ee7
6
+ metadata.gz: f7326ded313128265cc34186fcfb20804c2626fc3bdf1fc59b72a33d541308232f26ca7c35c79a7a22ca235beff29c0dc59815a369637250f24db41029822fa2
7
+ data.tar.gz: 015635e5ced16c5923b520a5eac9cbb7faa15129558e2df532e481d61eac484392a7b4166305bc554a61cfeca89d253d97246c06f607f145a3398a222d0d19b0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Addons
1
+ # Addons Gem
2
2
 
3
3
  TODO: Write a gem description
4
4
 
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 email and token environment variables (ENV['LAUNCHBOX_USER_EMAIL'] and ENV['LAUNCHBOX_USER_TOKEN']), the gem will pull your services config and set them up for immediate use.}
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['LAUNCHBOX_USER_EMAIL'] and ENV['LAUNCHBOX_USER_TOKEN']"
12
+ puts "checking ENV['ADDONS_APP_ID'] and ENV['ADDONS_APP_TOKEN']"
13
13
 
14
- if ENV['LAUNCHBOX_USER_EMAIL'] == nil
15
- return false, "Error: ENV['LAUNCHBOX_USER_EMAIL'] must be defined"
16
- elsif ENV['LAUNCHBOX_USER_TOKEN'] == nil
17
- return false, "Error: ENV['LAUNCHBOX_USER_TOKEN'] must be defined"
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}?user_email=#{ENV['LAUNCHBOX_USER_EMAIL']}&user_token=#{ENV['LAUNCHBOX_USER_TOKEN']}"
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
- json = JSON.parse(response)
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
- app.each do |service|
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['LAUNCHBOX_USER_EMAIL'] and ENV['LAUNCHBOX_USER_TOKEN']"
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
@@ -1,3 +1,3 @@
1
1
  module Addons
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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-23 00:00:00.000000000 Z
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 email and token environment variables
126
- (ENV['LAUNCHBOX_USER_EMAIL'] and ENV['LAUNCHBOX_USER_TOKEN']), the gem will pull
127
- your services config and set them up for immediate use.
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