salesforce-deploy-tool 0.8.2 → 0.9.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: 999b8948c7bec86caa12cc3b4094ce127a2c845c
4
- data.tar.gz: 3aad5f771f486b1b804a30a7c8ef983af3e4df24
3
+ metadata.gz: d5db1eaa074135fc75a02de5c4f8361f397d6ee1
4
+ data.tar.gz: 5e55c7cec8d432a42fe6558296085cd8d021540f
5
5
  SHA512:
6
- metadata.gz: b9c4d24562d7a55054f8b6f6a46e476883e03ba997aeeeeb67edf689d589db8816f0dad61053cfee435f6b6c723b90f90c6dd0651ae3c09faa2b88ac1961ba1f
7
- data.tar.gz: 02f4229e6a3666e9068dd58143e507a27bd55c7bab4d817a18c9e588cfd3294faa1703b0458761199f3dccb0675978b8441baabdcf448f0ea5c749dceae3c90c
6
+ metadata.gz: 22819aa51eda3ad39e934e263ff9848ed6155ae689ea3228964e8c29f0f43b53738bde9fd77bc31a7d2aaca075e86a48fb09a9f26fc9615613e1d26fccd9867d
7
+ data.tar.gz: 6014ad593f7d21a88a80af8a7ed25fcd9f8d9223b41eae1b139b72c112d984cef95d2ca3888f64e73992abe20a128d03603c681b558a502348ebe81bd7948989
data/bin/sf CHANGED
@@ -1,13 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
- require 'yaml'
3
- require 'fileutils'
4
2
  require 'pp'
3
+ require 'yaml'
5
4
 
6
5
  CONFIG_DIR = '~/.sf'
7
6
  CONFIG_FILE = '~/.sf/credentials.yaml'
8
7
  GLOBAL_CONFIG_FILE = '~/.sf/salesforce.yaml'
9
8
  SANDBOX_CONFIG_FILE = '~/.sf/salesforce.sbox'
10
9
 
10
+ # Load configurations, if directories and files don't
11
+ # exists, create them empty
12
+
11
13
  FileUtils.mkdir File.expand_path CONFIG_DIR if not Dir.exists? File.expand_path CONFIG_DIR
12
14
 
13
15
  config = {}
@@ -21,6 +23,19 @@ config = {}
21
23
  end
22
24
  end
23
25
 
26
+ # Grab variables from env if not in the config files
27
+ config[:git_dir] = ENV["GIT_DIR"] || config[:git_dir]
28
+ config[:tmp_dir] = ENV["TMP_DIR"] || config[:tmp_dir]
29
+ config[:version_file] = ENV["VERSION_FILE"] || config[:version_file]
30
+ config[:build_number_pattern] = ENV["BUILD_NUMBER_PATTERN"] || config[:build_number_pattern]
31
+ config[:commit_hash_pattern] = ENV["COMMIT_HASH_PATTERN"] || config[:commit_hash_pattern]
32
+ config[:git_repo] = ENV["GIT_REPO"] || config[:git_repo]
33
+ config[:deploy_ignore_files] = ENV["DEPLOY_IGNORE_FILES"].split(',') || config[:deploy_ignore_files]
34
+ config[:username] = ENV["USERNAME"] || config[:username]
35
+ config[:password] = ENV["PASSWORD"] || config[:password]
36
+
37
+ # Read sandbox environment
38
+
24
39
  begin
25
40
  sandbox = File.open(File.expand_path(SANDBOX_CONFIG_FILE)).read
26
41
  rescue
@@ -120,9 +135,19 @@ command :push do |c|
120
135
  config[:debug] = options.debug.nil? ? false : true
121
136
  config[:test] = options.test.nil? ? false : true
122
137
 
138
+ # Parameter Normalization
139
+ config[:git_dir] = File.expand_path config[:git_dir]
140
+ config[:tmp_dir] = File.expand_path config[:tmp_dir]
141
+ config[:version_file] = File.expand_path config[:version_file]
142
+ config[:deploy_ignore_files].map! {|f| File.expand_path File.join(config[:git_dir],f)}
143
+
123
144
  # Initialize
124
145
  sfdt = SalesforceDeployTool::App.new config
125
146
 
147
+ # Remove destructive change if there is one
148
+ DESTRUCTIVE_CHANGE_FILE = File.join(config[:git_dir],'src','destructiveChanges.xml')
149
+ FileUtils.rm DESTRUCTIVE_CHANGE_FILE if File.exists? DESTRUCTIVE_CHANGE_FILE
150
+
126
151
  # Push the code without destructiveChanges.xml. This step is allways necessary
127
152
  # even when it is a destructive change. This is because if a class is referencing
128
153
  # a field to be deleted, then we first need to push the class to remove that
@@ -146,7 +171,7 @@ command :push do |c|
146
171
  dc_gen = Dcgen::App.new
147
172
  dc_gen.master = File.join(config[:git_dir],'src')
148
173
  dc_gen.destination = File.join(config[:tmp_dir],'src')
149
- dc_gen.output = File.join(config[:git_dir],'src','destructiveChanges.xml')
174
+ dc_gen.output = DESTRUCTIVE_CHANGE_FILE
150
175
  dc_gen.exclude = options.exclude.split(',') unless options.exclude.nil?
151
176
 
152
177
  # Capture stdout when running generate_destructive_Changes, TODO: fix dcgen
@@ -3,6 +3,7 @@ require "commander/import"
3
3
  require "git"
4
4
  require "pp"
5
5
  require "colorize"
6
+ require "fileutils"
6
7
  require "logger"
7
8
  require "open3"
8
9
  require "yaml"
@@ -25,8 +25,6 @@ module SalesforceDeployTool
25
25
  @username = @sandbox == 'prod' ? config[:username] : config[:username] + '.' + @sandbox
26
26
  @server_url = @sandbox == 'prod' ? 'https://login.salesforce.com' : 'https://test.salesforce.com'
27
27
 
28
- self.clone if ! Dir.exists? File.join(@git_dir,'.git')
29
-
30
28
  end
31
29
 
32
30
  def commit_hash
@@ -1,3 +1,3 @@
1
1
  module SalesforceDeployTool
2
- VERSION = "0.8.2"
2
+ VERSION = "0.9.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: 0.8.2
4
+ version: 0.9.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: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler