addons 0.1.2 → 0.1.3

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: 7fab157f7c200d0c369a7a3bfe156e1fa089b08f
4
- data.tar.gz: 022024974b0e8b74d1338bbebfd66cee53499d74
3
+ metadata.gz: 206557efcf5704dce2feceae56db79a2096ae973
4
+ data.tar.gz: 45aafece16a4c2e6dac65a6042518b0874a4804a
5
5
  SHA512:
6
- metadata.gz: 84ef26e4b806b0e9650bccf1df033a018c36d8ea5268f6e91fd5620ba9e1c9f530531caa8cae64a36bb24430db75f68b4bf505ac55882a6a4df231728d83672b
7
- data.tar.gz: ee9a870981099af1fdc8172c96c3d29a6f1df2515c7b498d06db4ca3338972eca51a198b9887d38f03134be680ef514f096b4113a2351ce0da58a71ac0cb87a4
6
+ metadata.gz: 7c0f4dbe2f9f1c6e3fd77fd30b331c1943209045c89bd1745fccda67d009199a2f9f35513eb47adf792430018546b293c4c4657f0a98e78c4acb4d0bf239b692
7
+ data.tar.gz: 20fbe75007571b7c8c810812b2d268a9dae91d6e59c68003d97e71ad609c6eb8a9a283a2e1a383ce24b39d6b9f3e6f408f6b291843b7b4b91d72a2ad3d350437
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, set app_id and app_token variables (ENV['ADDONS_API_ID'] and ENV['ADDONS_APP_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 auth_token variables (ENV['ADDONS_API_ID'] and ENV['ADDONS_AUTH_TOKEN']), the gem will pull your services config and set them up for immediate use.}
13
13
  spec.homepage = "https://github.com/addonlist/addons-gem"
14
14
  spec.license = "MIT"
15
15
 
data/lib/addons/config.rb CHANGED
@@ -14,7 +14,7 @@ module Addons
14
14
 
15
15
  if File.exists?(filename)
16
16
  File.open(filename, 'r') do |file|
17
- # NOTE: read the ADDONS_API_ID and ADDONS_APP_TOKEN from application.yml and set ENV vars.
17
+ # NOTE: read the ADDONS_API_ID and ADDONS_AUTH_TOKEN from application.yml and set ENV vars.
18
18
 
19
19
  file.each_line do |line|
20
20
  matches = line.match(/(.*): (.*)/)
@@ -26,14 +26,14 @@ module Addons
26
26
  end
27
27
  end
28
28
 
29
- puts "checking ENV['ADDONS_API_ID'] and ENV['ADDONS_APP_TOKEN']"
29
+ puts "checking ENV['ADDONS_API_ID'] and ENV['ADDONS_AUTH_TOKEN']"
30
30
 
31
31
  if ENV['ADDONS_API_ID'] == nil
32
32
  puts "Error: ENV['ADDONS_API_ID'] must be defined"
33
33
  return false, "Error: ENV['ADDONS_API_ID'] must be defined"
34
- elsif ENV['ADDONS_APP_TOKEN'] == nil
35
- puts "Error: ENV['ADDONS_APP_TOKEN'] must be defined"
36
- return false, "Error: ENV['ADDONS_APP_TOKEN'] must be defined"
34
+ elsif ENV['ADDONS_AUTH_TOKEN'] == nil
35
+ puts "Error: ENV['ADDONS_AUTH_TOKEN'] must be defined"
36
+ return false, "Error: ENV['ADDONS_AUTH_TOKEN'] must be defined"
37
37
  end
38
38
 
39
39
  # contact server and look for config
@@ -46,7 +46,7 @@ module Addons
46
46
  http = Net::HTTP.new(uri.host, uri.port)
47
47
  http.use_ssl = true
48
48
  request = Net::HTTP::Get.new(uri.request_uri)
49
- request.basic_auth(ENV['ADDONS_API_ID'], ENV['ADDONS_APP_TOKEN'])
49
+ request.basic_auth(ENV['ADDONS_API_ID'], ENV['ADDONS_AUTH_TOKEN'])
50
50
  response = http.request(request).body
51
51
 
52
52
  services = JSON.parse(response)
@@ -72,7 +72,7 @@ module Addons
72
72
  return true, "Success"
73
73
 
74
74
  rescue OpenURI::HTTPError => ex
75
- return false, "Error: Unauthorized use of Addons. Be sure to set ENV['ADDONS_API_ID'] and ENV['ADDONS_APP_TOKEN']"
75
+ return false, "Error: Unauthorized use of Addons. Be sure to set ENV['ADDONS_API_ID'] and ENV['ADDONS_AUTH_TOKEN']"
76
76
  end
77
77
 
78
78
  end
@@ -1,3 +1,3 @@
1
1
  module Addons
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -8,16 +8,16 @@ module Addons
8
8
  class InstallGenerator < Rails::Generators::Base
9
9
 
10
10
  class_option :apiid, type: :string, required: true, :desc => "ADDONS_API_ID"
11
- class_option :apptoken, type: :string, required: true, :desc => "ADDONS_APP_TOKEN"
11
+ class_option :authtoken, type: :string, required: true, :desc => "ADDONS_AUTH_TOKEN"
12
12
 
13
13
  def initialize(*args, &block)
14
14
  super
15
15
 
16
16
  @ADDONS_API_ID = options[:apiid]
17
- @addons_app_token = options[:apptoken]
17
+ @ADDONS_AUTH_TOKEN = options[:authtoken]
18
18
 
19
19
  puts "ADDONS_API_ID: #{@ADDONS_API_ID}"
20
- puts "ADDONS_APP_TOKEN: #{@addons_app_token}"
20
+ puts "ADDONS_AUTH_TOKEN: #{@ADDONS_AUTH_TOKEN}"
21
21
  end
22
22
 
23
23
  desc "Addons install generator"
@@ -50,7 +50,7 @@ module Addons
50
50
  result = `bundle install`
51
51
  end
52
52
 
53
- def bootstrap_app_id_and_token
53
+ def bootstrap_api_id_and_token
54
54
  # write config/application.yml to load env vars on startup
55
55
  filename = Rails.root.join('config', 'application.yml')
56
56
 
@@ -58,7 +58,7 @@ module Addons
58
58
  File.open(filename, 'w') do |file|
59
59
  # add new vars to application.yml for the restart
60
60
  file.puts "ADDONS_API_ID: #{@ADDONS_API_ID}"
61
- file.puts "ADDONS_APP_TOKEN: #{@addons_app_token}"
61
+ file.puts "ADDONS_AUTH_TOKEN: #{@ADDONS_AUTH_TOKEN}"
62
62
  end
63
63
 
64
64
  puts "created application.yml"
@@ -19,7 +19,7 @@ namespace :addons do
19
19
  http = Net::HTTP.new(uri.host, uri.port)
20
20
  http.use_ssl = true
21
21
  request = Net::HTTP::Get.new(uri.request_uri)
22
- request.basic_auth(ENV['ADDONS_API_ID'], ENV['ADDONS_APP_TOKEN'])
22
+ request.basic_auth(ENV['ADDONS_API_ID'], ENV['ADDONS_AUTH_TOKEN'])
23
23
  response = http.request(request).body
24
24
 
25
25
  recipes = JSON.parse response
data/spec/addons_spec.rb CHANGED
@@ -6,8 +6,8 @@ describe Addons::Config do
6
6
  end
7
7
 
8
8
  # it "initializes without errors with valid environment variables" do
9
- # ENV['ADDONS_API_ID'] = 'app_id'
10
- # ENV['ADDONS_APP_TOKEN'] = 'app_token'
9
+ # ENV['ADDONS_API_ID'] = 'api_id'
10
+ # ENV['ADDONS_AUTH_TOKEN'] = 'auth_token'
11
11
 
12
12
  # Addons::Config.init()[0].should eql(true)
13
13
  # 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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Addonlist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-29 00:00:00.000000000 Z
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -142,8 +142,8 @@ rubyforge_project:
142
142
  rubygems_version: 2.2.2
143
143
  signing_key:
144
144
  specification_version: 4
145
- summary: After configuring your app with addons, set app_id and app_token variables
146
- (ENV['ADDONS_API_ID'] and ENV['ADDONS_APP_TOKEN']), the gem will pull your services
145
+ summary: After configuring your app with addons, set app_id and auth_token variables
146
+ (ENV['ADDONS_API_ID'] and ENV['ADDONS_AUTH_TOKEN']), the gem will pull your services
147
147
  config and set them up for immediate use.
148
148
  test_files:
149
149
  - spec/addons_spec.rb