metaforce 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ module Metaforce
16
16
  method_option :username, :aliases => '-u', :desc => 'Username.'
17
17
  method_option :password, :aliases => '-p', :desc => 'Password.'
18
18
  method_option :security_token, :aliases => '-t', :desc => 'Security Token.'
19
- method_option :environment, :aliases => '-e', :default => 'production', :desc => 'Environment to use from config file (if present).'
19
+ method_option :environment, :aliases => '-e', :default => 'default', :desc => 'Environment to use from config file (if present).'
20
20
  method_option :host, :aliases => '-h', :desc => 'Salesforce host to connect to.'
21
21
  end
22
22
 
@@ -37,7 +37,7 @@ module Metaforce
37
37
  def deploy(path)
38
38
  say "Deploying: #{path} ", :cyan
39
39
  say "#{options[:deploy_options].inspect}"
40
- client(options).deploy(path, options[:deploy_options].symbolize_keys!)
40
+ client.deploy(path, options[:deploy_options].symbolize_keys!)
41
41
  .on_complete { |job| report job.result, :deploy }
42
42
  .on_error(&error)
43
43
  .on_poll(&polling)
@@ -56,7 +56,7 @@ module Metaforce
56
56
  end
57
57
  say "Retrieving: #{manifest} ", :cyan
58
58
  say "#{options[:retrieve_options].inspect}"
59
- client(options).retrieve_unpackaged(manifest, options[:retrieve_options].symbolize_keys!)
59
+ client.retrieve_unpackaged(manifest, options[:retrieve_options].symbolize_keys!)
60
60
  .extract_to(path)
61
61
  .on_complete { |job| report(job.result, :retrieve) }
62
62
  .on_complete { |job| say "Extracted: #{path}", :green }
@@ -100,8 +100,8 @@ module Metaforce
100
100
  proc { |job| say 'Polling ...', :cyan }
101
101
  end
102
102
 
103
- def client(options)
104
- credentials = Thor::CoreExt::HashWithIndifferentAccess.new(config ? config[options[:environment]] : {})
103
+ def client
104
+ credentials = Thor::CoreExt::HashWithIndifferentAccess.new(environment_config)
105
105
  credentials.merge!(options.slice(:username, :password, :security_token, :host))
106
106
  credentials.tap do |credentials|
107
107
  credentials[:username] ||= ask('username:')
@@ -112,6 +112,10 @@ module Metaforce
112
112
  Metaforce.new credentials
113
113
  end
114
114
 
115
+ def environment_config
116
+ (config && config[options[:environment]]) ? config[options[:environment]] : {}
117
+ end
118
+
115
119
  def config
116
120
  YAML.load(File.open(config_file)) if File.exists?(config_file)
117
121
  end
@@ -1,3 +1,3 @@
1
1
  module Metaforce
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metaforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: