salesforce-deploy-tool 1.0.3 → 1.1.0

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: ebac6689830eab2da274c6389bb65580fba92876
4
- data.tar.gz: 9a949b5e006ced376b50aff46bf5a2af155c1d4f
3
+ metadata.gz: 43f650e68a92b0066ae663ec5d6057821912527a
4
+ data.tar.gz: 1a77815ff97ee041e48d58e9b8124797553dd0f2
5
5
  SHA512:
6
- metadata.gz: a9aeb58de065efad092a41df237bd25419e3e37541faa7814213e2f077e04f3d11263f2fbafac86e1722233cdfa494054f767ff2470bce59690ac7c40fba8f4a
7
- data.tar.gz: 266b7539af2136799f8bda73a4ef6a69f4114cec359a1a1343bceec87cb4dd386c50a7b586e68659a16bb210dc9f3930de1e72777a8b0bf349abf7c6dacc4cda
6
+ metadata.gz: 891d10f43d639f2f16fbded39c1a5de7a529b90490fbcae678a89ad415317c7df1c812e68753ef88d9e2fe1402337fbeb3e87d2f76a88f6a4c6413393ece75bd
7
+ data.tar.gz: 6f1a2a89ec8fc250f319a90869476c7fd164c19e1b1e66f4bfe399f58615cbce8473591712532d00ec7bccc9ad9eb28e08503e6ddeb7683bcd4ca8181001adee
data/bin/sf CHANGED
@@ -38,19 +38,28 @@ config[:username] = ENV["SFDT_USERNAME"] || config[:
38
38
  config[:password] = ENV["SFDT_PASSWORD"] || config[:password]
39
39
  config[:deploy_ignore_files] = ENV["SFDT_DEPLOY_IGNORE_FILES"].nil? ? config[:deploy_ignore_files] : ENV["SFDT_DEPLOY_IGNORE_FILES"].split(',')
40
40
 
41
+ # The salesforce URL, first from environment varialbes, second from config file , thierd defaults:
42
+ config[:salesforce_url] = ENV["SFDT_SALESFORCE_URL"] || config[:salesforce_url] ||( @sandbox == 'prod' ? 'https://login.salesforce.com' : 'https://test.salesforce.com' )
43
+
41
44
  # Default values
42
45
  config[:buildxml_dir] = ENV["SFDT_BUILDXML_DIR"] || config[:buildxml_dir] || ''
43
46
 
44
47
  # Minimal config validation
45
48
  abort "Config error: git_dir not found in #{GLOBAL_CONFIG_FILE} or through SFDT_GIT_DIR" if config[:git_dir].nil?
46
49
  abort "Config error: tmp_dir not found in #{GLOBAL_CONFIG_FILE} or through SFDT_TMP_DIR" if config[:tmp_dir].nil?
50
+ abort "Config error: username not found in #{GLOBAL_CONFIG_FILE} or through SFDT_USERNAME" if config[:username].nil?
51
+ abort "Config error: password not found in #{GLOBAL_CONFIG_FILE} or through SFDT_PASSWORD" if config[:password].nil?
52
+
53
+ # If the repository is not cloned then fail:
54
+ if !File.exists?(config[:git_dir]) && ARGV[0] != 'config'
55
+ abort "ERROR: The environment is not properly configured, please run sf config to clone the repo and setup the credentials"
56
+ end
47
57
 
48
58
  # Normalize file paths:
49
59
  config[:git_dir] = File.expand_path config[:git_dir]
50
60
  config[:tmp_dir] = File.expand_path config[:tmp_dir]
51
61
 
52
62
  # Read sandbox environment
53
-
54
63
  begin
55
64
  sandbox = File.open(File.expand_path(SANDBOX_CONFIG_FILE)).read
56
65
  rescue
@@ -122,18 +122,37 @@ Feature: Push code to salesforce
122
122
  ^INFO: Deploying code to env_a:.*OK$
123
123
  """
124
124
 
125
+ Scenario: Push code to a sandbox with the repo not being cloned it should point the user to run sf config
126
+ When I delete the repository directory
127
+ And I run `sf push -d`
128
+ Then the exit status should be 1
129
+ And the output should match:
130
+ """
131
+ ^ERROR: The environment is not properly configured, please run sf config to clone the repo and setup the credentials$
132
+ """
133
+
125
134
  @new
126
- Scenario: Push code to a sandbox excluding files
135
+ Scenario: Push code to a sandbox specifying a different URL
127
136
  Given I set the environment variables to:
128
- | variable | value |
129
- | SFDT_DEPLOY_IGNORE_FILES | src/layouts/test.layout,src/layouts/another_test.layout |
130
- When I run `sf push`
131
- #TODO: Then the files listed in SFDT_DEPLOY_IGNORE_FILES should be ignored by sf when deploying
132
- Then the exit status should be 0
137
+ | variable | value |
138
+ | SFDT_SALESFORCE_URL | https://invalid_url.salesforce.com |
139
+ When I run `sf push -d`
140
+ Then the exit status should be 1
133
141
  And the output should match:
134
142
  """
135
- ^INFO: Pulling changes from env_a to temporary directory .*tmp_repo.* to generate destructiveChanges.xml.*OK$
136
- ^INFO: Creating destructive changes xml$
137
- ^INFO: Deploying code to env_a:.*OK$
143
+ .*Failed to login: Failed to send request to https://invalid_url.salesforce.com.*
138
144
  """
139
145
 
146
+ # Scenario: Push code to a sandbox excluding files
147
+ # Given I set the environment variables to:
148
+ # | variable | value |
149
+ # | SFDT_DEPLOY_IGNORE_FILES | src/layouts/test.layout,src/layouts/another_test.layout |
150
+ # When I run `sf push`
151
+ # #TODO: Then the files listed in SFDT_DEPLOY_IGNORE_FILES should be ignored by sf when deploying
152
+ # Then the exit status should be 0
153
+ # And the output should match:
154
+ # """
155
+ # ^INFO: Pulling changes from env_a to temporary directory .*tmp_repo.* to generate destructiveChanges.xml.*OK$
156
+ # ^INFO: Creating destructive changes xml$
157
+ # ^INFO: Deploying code to env_a:.*OK$
158
+ # """
@@ -5,6 +5,10 @@ When /^I type my salesforce (.*)$/ do |input|
5
5
  type(config[input.to_sym])
6
6
  end
7
7
 
8
+ When /^I delete the repository directory/ do
9
+ FileUtils.rm_rf File.join 'tmp', 'aruba', ENV['SFDT_GIT_DIR']
10
+ end
11
+
8
12
  When /^I watch "(.+)" for changes and copy to "(.+)"$/ do |file,dest|
9
13
  file = File.join('tmp','aruba',file)
10
14
  dest = File.join('tmp','aruba',dest)
@@ -24,7 +24,7 @@ module SalesforceDeployTool
24
24
  @commit_hash_pattern = config[:commit_hash_pattern]
25
25
  @buildxml_dir = config[:buildxml_dir]
26
26
  @username = @sandbox == 'prod' ? @username : @username + '.' + @sandbox
27
- @server_url = @sandbox == 'prod' ? 'https://login.salesforce.com' : 'https://test.salesforce.com'
27
+ @server_url = config[:salesforce_url]
28
28
 
29
29
  # Defaults
30
30
  @debug ||= config[:debug]
@@ -1,3 +1,3 @@
1
1
  module SalesforceDeployTool
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce-deploy-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-21 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler