factor 0.6.0 → 0.6.1

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: 5b3d20f8470d86ea79e6ad2646d2b7dac6695a9b
4
- data.tar.gz: d8ef8ec97799a1f481581706c78e1631a0a4600c
3
+ metadata.gz: e9b26a00f37b7806ed314cb0c1b5facb3e62ae96
4
+ data.tar.gz: 842281a638e5b05a856d30d465ac06b15df906fb
5
5
  SHA512:
6
- metadata.gz: e540f40fd32b06cee12fcee1ae7e2a9a80d01cf878837b052eddb10e3af906b24460b697fb842a95e8244287ebe2a8bc6684ad0a0accbe992bbc504540de6956
7
- data.tar.gz: 8234653325650c2a16ad5a2f92c7d99f8cc6230eb8e12efe2496e070bbbbb0af7246670805751ffd75d9597d1b04b4b7af7d236c4c94ee9a56e908c9641d2420
6
+ metadata.gz: ad7b2c27f8afe87f0a5c90634a54cbf51d6a9c0b1a5c4caaaed08538fe702af54e077eaf1d83bac864274252620df0283528f551f6d2be1ec43bedcfadc64403
7
+ data.tar.gz: 9344a5f686527bc413bdbf0cc9e81333813a7a0a11a07dddf31098dd1e2ade0f63a39d39a6180be63dbd4c693fb674f328dd66f49bd21b080487a7667a1736ab
@@ -30,6 +30,7 @@ module Factor
30
30
  account_id = args[0]
31
31
  workflow_id = args[1]
32
32
  api_key = args[2]
33
+ host = (options.host || "https://factor.io").sub(/(\/)+$/,'')
33
34
 
34
35
  if !api_key || !workflow_id || !account_id
35
36
  error "API Key, Worklfow ID and Acount ID are all required"
@@ -38,7 +39,7 @@ module Factor
38
39
 
39
40
  info "Getting workflow (#{workflow_id}) from Factor.io Cloud"
40
41
  begin
41
- workflow_url = "https://factor.io/#{account_id}/workflows/#{workflow_id}.json?auth_token=#{api_key}"
42
+ workflow_url = "#{host}/#{account_id}/workflows/#{workflow_id}.json?auth_token=#{api_key}"
42
43
  raw_content = RestClient.get(workflow_url)
43
44
  workflow_info = JSON.parse(raw_content)
44
45
  rescue => ex
@@ -50,36 +51,29 @@ module Factor
50
51
 
51
52
  info "Getting credentials from Factor.io Cloud"
52
53
  begin
53
- credential_url = "https://factor.io/#{account_id}/credentials.json?auth_token=#{api_key}"
54
+ credential_url = "#{host}/#{account_id}/credentials.json?auth_token=#{api_key}"
54
55
  raw_content = RestClient.get(credential_url)
55
- credential_info = JSON.parse(raw_content)
56
+ credentials = JSON.parse(raw_content)
56
57
  rescue => ex
57
58
  error "Couldn't retreive workflow: #{ex.message}"
58
59
  exit
59
60
  end
60
61
 
61
- credentials = {}
62
- credential_info.each do |credential|
63
- credentials[credential['service']] ||= {}
64
- credentials[credential['service']][credential['name']] = credential['value']
65
- end
66
-
67
62
  configatron[:credentials].configure_from_hash(credentials)
68
63
 
69
- info "Getting connector settings from Factor.io Index Server"
64
+ info "Getting connectors from Factor.io Cloud"
65
+ connectors = {}
70
66
  begin
71
- connectors_url = options.index
72
- connectors_url ||= 'https://raw.githubusercontent.com/factor-io/index/master/connectors.yml'
67
+ connectors_url = "#{host}/#{account_id}/connectors.json?auth_token=#{api_key}"
73
68
  raw_content = RestClient.get(connectors_url)
74
- connectors_info = YAML.parse(raw_content).to_ruby
75
- rescue
76
- error "Couldn't retreive connectors info"
77
- exit
78
- end
69
+ raw_connectors = JSON.parse(raw_content)
79
70
 
80
- connectors = {}
81
- connectors_info.each do |connector_id, connector_info|
82
- connectors[connector_id] = connector_info['connectors']
71
+ raw_connectors.each do |connector_id,connector_info|
72
+ connectors[connector_id] = connector_info['connectors'].values.first
73
+ end
74
+ rescue => ex
75
+ error "Couldn't retreive workflow: #{ex.message}"
76
+ exit
83
77
  end
84
78
 
85
79
  configatron[:connectors].configure_from_hash(connectors)
@@ -23,7 +23,7 @@ end
23
23
  command 'cloud' do |c|
24
24
  c.syntax = 'factor host <account id> <workflow id> <api key>'
25
25
  c.description = 'Start the Factor.io Server using your workflows and credentials from Factor.io Cloud'
26
- c.option '--index URL', String, 'Use non-default Index server to get list of available credentials'
26
+ c.option '--host URL', String, 'Use non-default Cloud service provider (e.g. pro server)'
27
27
  c.when_called Factor::Commands::Workflow, :cloud
28
28
  end
29
29
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Primary Factor.io module
4
4
  module Factor
5
- VERSION = '0.6.0'
5
+ VERSION = '0.6.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Skierkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 4.2.0
61
+ version: 4.2.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 4.2.0
68
+ version: 4.2.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rest-client
71
71
  requirement: !ruby/object:Gem::Requirement