salesforce-deploy-tool 2.1.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sf +1 -1
  3. data/build.xml +1 -0
  4. data/features/config.feature +7 -7
  5. data/features/pull.feature +7 -7
  6. data/features/push.feature +124 -69
  7. data/features/resources/mock/ant +201 -0
  8. data/features/resources/repo/COMMIT_EDITMSG +1 -0
  9. data/features/resources/repo/HEAD +1 -0
  10. data/features/resources/repo/config +5 -0
  11. data/features/resources/repo/description +1 -0
  12. data/features/resources/repo/hooks/applypatch-msg.sample +15 -0
  13. data/features/resources/repo/hooks/commit-msg.sample +24 -0
  14. data/features/resources/repo/hooks/post-update.sample +8 -0
  15. data/features/resources/repo/hooks/pre-applypatch.sample +14 -0
  16. data/features/resources/repo/hooks/pre-commit.sample +49 -0
  17. data/features/resources/repo/hooks/pre-push.sample +54 -0
  18. data/features/resources/repo/hooks/pre-rebase.sample +169 -0
  19. data/features/resources/repo/hooks/prepare-commit-msg.sample +36 -0
  20. data/features/resources/repo/hooks/update.sample +128 -0
  21. data/features/resources/repo/index +0 -0
  22. data/features/resources/repo/info/exclude +6 -0
  23. data/features/resources/repo/logs/HEAD +10 -0
  24. data/features/resources/repo/logs/refs/heads/master +10 -0
  25. data/features/resources/repo/objects/08/d159fb570535461d73a45322c66495b5025c20 +3 -0
  26. data/features/resources/repo/objects/0a/ce763c3b6bc010c2a9a193f7d7c7bc03172800 +0 -0
  27. data/features/resources/repo/objects/18/75bbbe3a395a8d38c1097bfeda33da7995d8ba +0 -0
  28. data/features/resources/repo/objects/1b/f3c07d11fce01d255838eebd41a066e20e09f0 +0 -0
  29. data/features/resources/repo/objects/1d/300e3c8d30b80bb88cfce2b16c3070488f0440 +2 -0
  30. data/features/resources/repo/objects/1d/b81d6385e52f1ac897d8c119a01537b1624c05 +2 -0
  31. data/features/resources/repo/objects/1f/eb7a27c44c4b82a4e0551752e3aec20d39e867 +0 -0
  32. data/features/resources/repo/objects/21/a8635d944fb9d9c1779a5ce7a0e0e3ae0b560f +0 -0
  33. data/features/resources/repo/objects/21/f12831957736ffc4b5cb11beaf61020badb5ba +0 -0
  34. data/features/resources/repo/objects/24/f97074eaba38f18c29b4d89781a20bacd65bed +2 -0
  35. data/features/resources/repo/objects/25/8a8c1f2d788fa12fa87f994e96b3efbf2d0415 +0 -0
  36. data/features/resources/repo/objects/26/d3f397fe0eda1d7639542edf47982e408b856a +0 -0
  37. data/features/resources/repo/objects/2c/0414f10c4cb61f2ae352d54f36e84b877d49b8 +3 -0
  38. data/features/resources/repo/objects/3c/94ea5d2b74886cefeb5ecf7f7380bc8223e05b +0 -0
  39. data/features/resources/repo/objects/3d/0be981f941d665b9ffc59d0d734ceb18e1c551 +0 -0
  40. data/features/resources/repo/objects/3f/260c2394be8a70772376832c561d33365dc74c +0 -0
  41. data/features/resources/repo/objects/41/341113250717ca1d4e280cac7413074e110ceb +1 -0
  42. data/features/resources/repo/objects/44/b93fe01a1dfc0639577dd16969715bd9e6fe0c +0 -0
  43. data/features/resources/repo/objects/47/913885995720fb59e94d5766314a4728ea1944 +0 -0
  44. data/features/resources/repo/objects/48/587cabf050866f63b8743da1dbe0ebae23b348 +2 -0
  45. data/features/resources/repo/objects/51/394a26665e0ad7708091db12aff4510384fb2f +2 -0
  46. data/features/resources/repo/objects/51/f1b7da07050f62cd00f24774856a9d06d4fc47 +4 -0
  47. data/features/resources/repo/objects/54/5a9377aeb6a9d4e143c95e398c8968b35944cb +1 -0
  48. data/features/resources/repo/objects/58/acc8fd3f0888c0d4c735dbf945b8adc982723f +0 -0
  49. data/features/resources/repo/objects/59/c81a96f4e0b1ed588190e2c097c325556ab0df +2 -0
  50. data/features/resources/repo/objects/60/192eb56263416d0221556f33ffd4220aa536d4 +0 -0
  51. data/features/resources/repo/objects/6a/eb5e2a8bda5b4f04cbd2d942ae7940bf796c25 +4 -0
  52. data/features/resources/repo/objects/72/4a3c7678b7274af8806d0395594f3b0a059fcc +0 -0
  53. data/features/resources/repo/objects/76/8d5ed4528f6043dee289c7da0001c8a3ce45e4 +0 -0
  54. data/features/resources/repo/objects/79/e1ba418010d81ca3472ee271ce83abbea5104f +0 -0
  55. data/features/resources/repo/objects/7f/ee222d7d4008f9d6a6c6e5f10ef4923299c93d +2 -0
  56. data/features/resources/repo/objects/80/1416a319f26aac530d3663d8cd214cf7b7ef65 +0 -0
  57. data/features/resources/repo/objects/83/bbfc790b9974134c1591192634fa771075b535 +0 -0
  58. data/features/resources/repo/objects/87/09c1bfb261dedf83ab5793054940782c48b54f +2 -0
  59. data/features/resources/repo/objects/89/3df81588c577cfbae991baa7211062faacd4a0 +0 -0
  60. data/features/resources/repo/objects/8c/15363be6659c514f5e2cafd817efc656106027 +0 -0
  61. data/features/resources/repo/objects/90/0dd02ce96c29b918d4f38c0721ac61a62e2c75 +0 -0
  62. data/features/resources/repo/objects/91/54141b78af68bdeb8e9b79629012a720b6e8e5 +4 -0
  63. data/features/resources/repo/objects/93/50c5598f6bafd3aa1a6a6ceecec7f02a0b0203 +2 -0
  64. data/features/resources/repo/objects/96/b1ab4d31f29b149ff0b7eb60cb3a38dbaef37d +0 -0
  65. data/features/resources/repo/objects/99/9db58eef630156ab2fc4aa4a9451fb77c0137f +2 -0
  66. data/features/resources/repo/objects/9b/c11cdc1094120c76a59f222671d754297d3ea5 +0 -0
  67. data/features/resources/repo/objects/9f/2d034a0b311fc3ea68d920d100f8e3143cc664 +0 -0
  68. data/features/resources/repo/objects/a3/9d3fe0c289c12308749b73da61076bb4e1689d +2 -0
  69. data/features/resources/repo/objects/a5/ab41fa374d2682939feb0f8fcbf9b243544f5c +0 -0
  70. data/features/resources/repo/objects/aa/c66ee0d404c124fbcafd32a054664de4fdd3da +3 -0
  71. data/features/resources/repo/objects/ae/5379d68c15b3fc95efa7e6a640972865ef6d3d +0 -0
  72. data/features/resources/repo/objects/b8/580fa58bf91133b28d162bf2572667ae54c18d +0 -0
  73. data/features/resources/repo/objects/b9/4c5cf17b7e3baca053deb44fa0f6306eb7b890 +0 -0
  74. data/features/resources/repo/objects/bf/ae3371a43e95ebfbb1dd0643810a52cd958f14 +1 -0
  75. data/features/resources/repo/objects/cb/db0117efc4c6709ae5069a1dcefe841666a704 +0 -0
  76. data/features/resources/repo/objects/cf/235b88b53b5cf3031e67bfd6ab5a7b3ca25c52 +0 -0
  77. data/features/resources/repo/objects/d3/48f3b026e759f584548729a04f3b91ceb2e8d3 +0 -0
  78. data/features/resources/repo/objects/d3/7b8a2c894dbe1839d9428a336806ee151c2e4d +0 -0
  79. data/features/resources/repo/objects/d3/b508d876f1639a96afed4ca1d22c38583ea2d6 +0 -0
  80. data/features/resources/repo/objects/d5/cb74bf363ffbb0c7a1c69ee8b0bcf1e6093774 +0 -0
  81. data/features/resources/repo/objects/db/3cff2d90ba3bbcee7dd1113db69ac2b7b5e3a0 +0 -0
  82. data/features/resources/repo/objects/de/7978b6e388de73ddc31dbfc6a9afa030449cb1 +0 -0
  83. data/features/resources/repo/objects/e0/72bdd8a68660581d612b509ea7dc5d1dd1cfa1 +0 -0
  84. data/features/resources/repo/objects/e1/39fc1a7d4eca5e8b483cafa3af47d983a99e1b +0 -0
  85. data/features/resources/repo/objects/e7/4644c031e1cf36a268ae5041fb8dc7104bd357 +0 -0
  86. data/features/resources/repo/objects/ef/bfccdbb185bc64cb49d9942a53b7ab97e21b21 +0 -0
  87. data/features/resources/repo/objects/f5/bcc39104bda892895e9f338b45bad76b333d80 +0 -0
  88. data/features/resources/repo/objects/fb/4f268988e268cbf3bcc50ff338f98054e803cb +2 -0
  89. data/features/resources/repo/objects/fd/6723ee7c9a7acea74ab84f4af159952279d51f +0 -0
  90. data/features/resources/repo/objects/ff/8c6fa78f879d98393ca470a4ea07cae7221d38 +4 -0
  91. data/features/resources/repo/refs/heads/master +1 -0
  92. data/features/support/env.rb +19 -9
  93. data/features/support/hooks.rb +2 -34
  94. data/lib/salesforcedeploytool/app.rb +9 -3
  95. data/lib/salesforcedeploytool/cli.rb +9 -1
  96. data/lib/salesforcedeploytool/version.rb +1 -1
  97. data/salesforce-deploy-tool.gemspec +1 -1
  98. data/tpl/build.xml.erb +15 -2
  99. metadata +175 -5
  100. data/cucumber-config.yaml-tpl +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cf3f674c5005f685106a8fdcd03adc509c9d3e6
4
- data.tar.gz: d0ef0378245f1fe41f505a06cff35a27347753a4
3
+ metadata.gz: 585dac2205744a81b1864062cddab4fa113c468a
4
+ data.tar.gz: 47b53f0925188b68dcc7dd7a513114408ff95b42
5
5
  SHA512:
6
- metadata.gz: 24287cd66eb623f09cb8c3e0c76f360c50718274fec02a06b54653998cb2a10f4254072392fd294e22137b8932db8b024b54626cbccadb7e6ee3877288ca4ef4
7
- data.tar.gz: bf29790ebd96221afe61d870f3b4f940ab8f99c09baa1f0ad3f4384b768c31afdeeebd701a2e99f4205af913e500c403ab6259b4fb4b0eddaeb7522bd1eb363b
6
+ metadata.gz: 0b5fa61af545b693f545a561efc13d02917152c5424bc325b4f5e31b9ea206f118f4ef90f7964b263929c0d3ff486a7219749ded616425a74366722e04ad8d49
7
+ data.tar.gz: 452142bee6a902cd78a4db0ca39effd9663e1188e621b921cea2b5a2bceff2f2bc9eec916eee86e3a8cfe05d3d9e329aea47b3816fe6695c4c3bc558533cac25
data/bin/sf CHANGED
@@ -29,7 +29,6 @@ end
29
29
  begin
30
30
  config[:sandbox] = File.open(File.expand_path(SANDBOX_CONFIG_FILE)).read
31
31
  rescue
32
- config[:sandbox] = nil
33
32
  end
34
33
 
35
34
  # Configuration variables firrst from ENV , if not config file
@@ -43,6 +42,7 @@ config[:src_dir] = ENV["SFDT_SRC_DIR"] || config[:
43
42
  config[:username] = ENV["SFDT_USERNAME"] || config[:username]
44
43
  config[:password] = ENV["SFDT_PASSWORD"] || config[:password]
45
44
  config[:salesforce_url] = ENV["SFDT_SALESFORCE_URL"] || config[:salesforce_url]
45
+ config[:sandbox] = ENV['SFDT_SANDBOX'] || config[:sandbox]
46
46
 
47
47
  # Project configs
48
48
  config[:version_file] = ENV["SFDT_VERSION_FILE"] || config[:version_file]
@@ -0,0 +1 @@
1
+ deployCode
@@ -7,12 +7,12 @@ Feature: Configure the user credentials interactively
7
7
 
8
8
  Scenario: Running sf config it has to interactively setup my environment
9
9
  When I run `sf config` interactively
10
- And I type my salesforce production_username
11
- And I type my salesforce production_password
12
- And I type my salesforce git_full_name
13
- And I type my salesforce git_email_address
14
- And I type my salesforce sandbox
10
+ And I type "john.doe@example.com"
11
+ And I type "SecurePassword"
12
+ And I type "John Doe"
13
+ And I type "john.doe@example.com"
14
+ And I type "testEnv"
15
15
  Then the exit status should be 0
16
- And the file "~/.sf/credentials.yaml" should contain "username"
17
- And the file "~/.sf/credentials.yaml" should contain "password"
16
+ And the file "~/.sf/credentials.yaml" should match /username.*john.doe@example.com/
17
+ And the file "~/.sf/credentials.yaml" should match /password.*SecurePassword/
18
18
  And the file "~/.sf/salesforce.sbox" should match /.+/
@@ -9,15 +9,15 @@ Feature: Pull code from salesforce
9
9
  Then the exit status should be 0
10
10
  And the output should match:
11
11
  """
12
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com.*OK
12
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com.*OK
13
13
  """
14
14
 
15
15
  Scenario: Retrieve code from a specific sandbox
16
- When I run `sf pull -s env_b`
16
+ When I run `sf pull -s testEnvAlt`
17
17
  Then the exit status should be 0
18
18
  And the output should match:
19
19
  """
20
- ^INFO: Pulling changes from env_b using url https://test.salesforce.com.*OK
20
+ ^INFO: Pulling changes from testEnvAlt using url https://test.salesforce.com.*OK
21
21
  """
22
22
 
23
23
  Scenario: Retrieve code from a sandbox using a specific URL
@@ -28,7 +28,7 @@ Feature: Pull code from salesforce
28
28
  Then the exit status should be 1
29
29
  And the output should match:
30
30
  """
31
- ^INFO: Pulling changes from env_a using url https://invalid_url.*
31
+ ^INFO: Pulling changes from testEnv using url https://invalid_url.*
32
32
  """
33
33
 
34
34
  Scenario: Retrieve code from a production
@@ -45,15 +45,15 @@ Feature: Pull code from salesforce
45
45
  And the output should contain "BUILD SUCCESSFUL"
46
46
  And the output should match:
47
47
  """
48
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com.*
48
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com.*
49
49
  """
50
50
 
51
51
  Scenario: Retrieve code from a specific sandbox with debug output
52
- When I run `sf pull -s env_a -d`
52
+ When I run `sf pull -s testEnv -d`
53
53
  Then the exit status should be 0
54
54
  And the output should contain "BUILD SUCCESSFUL"
55
55
  And the output should match:
56
56
  """
57
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com.*$
57
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com.*$
58
58
  """
59
59
 
@@ -7,131 +7,135 @@ Feature: Push code to salesforce
7
7
  Scenario: Push code to a sandbox
8
8
  When I run `sf push`
9
9
  Then the exit status should be 0
10
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
10
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
11
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
11
12
  And the output should match:
12
13
  """
13
- ^INFO: Pulling changes from env_a using url https:\/\/test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
14
+ ^INFO: Pulling changes from testEnv using url https:\/\/test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
14
15
  ^INFO: Creating destructive changes xml$
15
- ^INFO: Deploying code to env_a:.*OK$
16
+ ^INFO: Deploying code to testEnv:.*OK$
16
17
  """
17
18
 
18
19
  Scenario: Push code to a different sandbox
19
- When I run `sf push -s env_b`
20
+ When I run `sf push -s testEnvAlt`
20
21
  Then the exit status should be 0
21
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
22
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
23
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
22
24
  And the output should match:
23
25
  """
24
- ^INFO: Pulling changes from env_b using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
26
+ ^INFO: Pulling changes from testEnvAlt using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
25
27
  ^INFO: Creating destructive changes xml$
26
- ^INFO: Deploying code to env_b:.*OK$
28
+ ^INFO: Deploying code to testEnvAlt:.*OK$
27
29
  """
28
30
 
29
31
  Scenario: Push code to production should use the url login.salesorce.com
30
- Given I set the environment variables to:
31
- | variable | value |
32
- | SFDT_USERNAME | invalid_user |
33
- | SFDT_PASSWORD | invalid_pass |
34
32
  When I run `sf push -s prod`
35
- Then the exit status should be 1
33
+ Then the exit status should be 0
34
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
36
35
  And the output should match:
37
36
  """
38
37
  ^INFO: Pulling changes from prod using url https://login.salesforce.com to temporary directory to generate destructiveChanges.xml.*$
39
38
  """
40
-
41
39
  Scenario: Push code to a sandbox with debug information
42
40
  When I run `sf push -d`
43
41
  Then the exit status should be 0
44
- And the output should match /^.* env_a .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*BUILD SUCCESSFUL.*$/
45
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
42
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
43
+ And the output should match /^.* testEnv .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*deployCode.*BUILD SUCCESSFUL.*$/
44
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
46
45
 
47
46
  Scenario: Push code to a sandbox with debug information to a different sandbox
48
- When I run `sf push -d -s env_b`
47
+ When I run `sf push -d -s testEnvAlt`
49
48
  Then the exit status should be 0
50
- And the output should match /^.* env_b .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*BUILD SUCCESSFUL.*$/
51
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
49
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
50
+ And the output should match /^.* testEnvAlt .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*BUILD SUCCESSFUL.*$/
51
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
52
52
 
53
53
  Scenario: Push code to a sandbox and trigger all the tests
54
54
  When I run `sf push -T`
55
55
  Then the exit status should be 0
56
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
56
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
57
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
57
58
  And the output should match:
58
59
  """
59
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
60
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
60
61
  ^INFO: Creating destructive changes xml$
61
- ^INFO: Deploying and Testing code to env_a:.*OK$
62
+ ^INFO: Deploying and Testing code to testEnv:.*OK$
62
63
  """
63
-
64
64
  Scenario: Push code to a sandbox and trigger all the tests in debug mode
65
65
  When I run `sf push -T -d`
66
66
  Then the exit status should be 0
67
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
68
- And the output should match /^.* env_a .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*Running Test:.*DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL.*$/
67
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
68
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
69
+ And the output should match /^.* testEnv .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*Running Test:.*DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL.*$/
69
70
 
70
71
  Scenario: Push code to a sandbox in append mode
71
72
  When I run `sf push -a`
72
73
  Then the exit status should be 0
73
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should not exist
74
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should not exist
74
75
  And the output should match:
75
76
  """
76
- ^INFO: Deploying code to env_a:.*OK$
77
+ ^INFO: Deploying code to testEnv:.*OK$
77
78
  """
78
79
 
79
80
  Scenario: Push code to a sandbox in append mode and run all tests
80
81
  When I run `sf push -a -T`
81
82
  Then the exit status should be 0
82
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should not exist
83
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should not exist
83
84
  And the output should match:
84
85
  """
85
- ^INFO: Deploying and Testing code to env_a:.*OK$
86
+ ^INFO: Deploying and Testing code to testEnv:.*OK$
86
87
  """
87
88
 
88
89
  Scenario: Push code to a sandbox in append mode and run all tests and output debug information
89
90
  When I run `sf push -a -T -d`
90
91
  Then the exit status should be 0
91
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should not exist
92
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should not exist
92
93
  And the output should match:
93
94
  """
94
- ^INFO: Deploying and Testing code to env_a: $
95
+ ^INFO: Deploying and Testing code to testEnv: $
95
96
  ^$
96
97
  ^Buildfile: .*$
97
98
  ^$
98
- ^deployAndTestAllCode:$
99
+ ^deployAndTestCode:$
99
100
  """
100
101
  And the output should match /Running Test/
101
102
  And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
102
103
 
103
104
  Scenario: Push code to a sandbox with a build number
104
105
  Given I set the environment variables to:
105
- | variable | value |
106
- | SFDT_VERSION_FILE | version_file |
107
- | SFDT_BUILD_NUMBER_PATTERN | build_number_pattern |
108
- When I watch "sfdt_git_dir/sfdt_src_dir/version_file" for changes and copy to "test_file"
106
+ | variable | value |
107
+ | SFDT_VERSION_FILE | classes/VersionTest.cls |
108
+ | SFDT_BUILD_NUMBER_PATTERN | %%BUILD_NUMBER%% |
109
+ When I watch "repo/salesforce/src/classes/VersionTest.cls" for changes and copy to "test_file"
109
110
  And I run `sf push --build_number 123456789`
110
111
  Then the exit status should be 0
111
112
  And the file "test_file" should contain "123456789"
112
- And the file "sfdt_git_dir/sfdt_src_dir/version_file" should contain "build_number_pattern"
113
+ And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%BUILD_NUMBER%%"
114
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
113
115
  And the output should match:
114
116
  """
115
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
117
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
116
118
  ^INFO: Creating destructive changes xml$
117
- ^INFO: Deploying code to env_a:.*OK$
119
+ ^INFO: Deploying code to testEnv:.*OK$
118
120
  """
119
121
 
122
+ @test
120
123
  Scenario: Push code to a sandbox with the commit hash stamped into a version file
121
124
  Given I set the environment variables to:
122
- | variable | value |
123
- | SFDT_VERSION_FILE | version_file |
124
- | SFDT_COMMIT_HASH_PATTERN | commit_hash_pattern |
125
- When I watch "sfdt_git_dir/sfdt_src_dir/version_file" for changes and copy to "test_file"
125
+ | variable | value |
126
+ | SFDT_VERSION_FILE | classes/VersionTest.cls |
127
+ | SFDT_COMMIT_HASH_PATTERN | %%COMMIT_HASH%% |
128
+ When I watch "repo/salesforce/src/classes/VersionTest.cls" for changes and copy to "test_file"
126
129
  And I run `sf push`
127
130
  Then the exit status should be 0
128
- And the file "test_file" should not contain "commit_hash_pattern"
129
- And the file "sfdt_git_dir/sfdt_src_dir/version_file" should contain "commit_hash_pattern"
131
+ And the file "test_file" should contain "aac66ee0d404c124fbcafd32a054664de4fdd3da"
132
+ And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%COMMIT_HASH%%"
133
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
130
134
  And the output should match:
131
135
  """
132
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
136
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
133
137
  ^INFO: Creating destructive changes xml$
134
- ^INFO: Deploying code to env_a:.*OK$
138
+ ^INFO: Deploying code to testEnv:.*OK$
135
139
  """
136
140
 
137
141
  Scenario: Push code to a sandbox with the repo not being cloned it should point the user to run sf config
@@ -157,50 +161,53 @@ Feature: Push code to salesforce
157
161
  Scenario: Push code to a sandbox and trigger individual tests in debug mode
158
162
  When I run `sf push -r individual_test -d`
159
163
  Then the exit status should be 0
160
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
164
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
165
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
161
166
  And the output should match:
162
167
  """
163
- ^INFO: Deploying and Testing code to env_a: $
168
+ ^INFO: Deploying and Testing code to testEnv: $
164
169
  ^$
165
170
  ^Buildfile: .*$
166
171
  ^$
167
- ^deployAndTestAllCode:$
172
+ ^deployAndRunSpecifiedTests:$
168
173
  """
169
174
  And the output should match /Running Test/
170
175
  And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
171
176
 
172
177
  Scenario: Push code to a sandbox with a build number
173
178
  Given I set the environment variables to:
174
- | variable | value |
175
- | SFDT_VERSION_FILE | version_file |
176
- | SFDT_BUILD_NUMBER_PATTERN | build_number_pattern |
177
- When I watch "sfdt_git_dir/sfdt_src_dir/version_file" for changes and copy to "test_file"
179
+ | variable | value |
180
+ | SFDT_VERSION_FILE | classes/VersionTest.cls |
181
+ | SFDT_BUILD_NUMBER_PATTERN | %%BUILD_NUMBER%% |
182
+ When I watch "repo/salesforce/src/classes/VersionTest.cls" for changes and copy to "test_file"
178
183
  And I run `sf push --build_number 123456789`
179
184
  Then the exit status should be 0
180
185
  And the file "test_file" should contain "123456789"
181
- And the file "sfdt_git_dir/sfdt_src_dir/version_file" should contain "build_number_pattern"
186
+ And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%BUILD_NUMBER%%"
187
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
182
188
  And the output should match:
183
189
  """
184
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
190
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
185
191
  ^INFO: Creating destructive changes xml$
186
- ^INFO: Deploying code to env_a:.*OK$
192
+ ^INFO: Deploying code to testEnv:.*OK$
187
193
  """
188
194
 
189
195
  Scenario: Push code to a sandbox with the commit hash stamped into a version file
190
196
  Given I set the environment variables to:
191
- | variable | value |
192
- | SFDT_VERSION_FILE | version_file |
193
- | SFDT_COMMIT_HASH_PATTERN | commit_hash_pattern |
194
- When I watch "sfdt_git_dir/sfdt_src_dir/version_file" for changes and copy to "test_file"
197
+ | variable | value |
198
+ | SFDT_VERSION_FILE | classes/VersionTest.cls |
199
+ | SFDT_COMMIT_HASH_PATTERN | %%COMMIT_HASH%% |
200
+ When I watch "repo/salesforce/src/classes/VersionTest.cls" for changes and copy to "test_file"
195
201
  And I run `sf push`
196
202
  Then the exit status should be 0
197
- And the file "test_file" should not contain "commit_hash_pattern"
198
- And the file "sfdt_git_dir/sfdt_src_dir/version_file" should contain "commit_hash_pattern"
203
+ And the file "test_file" should contain "aac66ee0d404c124fbcafd32a054664de4fdd3da"
204
+ And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%COMMIT_HASH%%"
205
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
199
206
  And the output should match:
200
207
  """
201
- ^INFO: Pulling changes from env_a using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
208
+ ^INFO: Pulling changes from testEnv using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
202
209
  ^INFO: Creating destructive changes xml$
203
- ^INFO: Deploying code to env_a:.*OK$
210
+ ^INFO: Deploying code to testEnv:.*OK$
204
211
  """
205
212
 
206
213
  Scenario: Push code to a sandbox with the repo not being cloned it should point the user to run sf config
@@ -222,18 +229,66 @@ Feature: Push code to salesforce
222
229
  """
223
230
  .*Failed to login: Failed to send request to https://invalid_url.salesforce.com.*
224
231
  """
225
- @new
226
232
  Scenario: Push code to a sandbox and trigger individual tests in debug mode
227
233
  When I run `sf push -r individual_test -d`
228
234
  Then the exit status should be 0
229
- And a file named "sfdt_git_dir/sfdt_src_dir/destructiveChanges.xml" should exist
235
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
236
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
230
237
  And the output should match:
231
238
  """
232
- ^INFO: Deploying and Testing code to env_a: $
239
+ ^INFO: Deploying and Testing code to testEnv: $
233
240
  ^$
234
241
  ^Buildfile: .*$
235
242
  ^$
236
- ^deployAndTestCode:$
243
+ ^deployAndRunSpecifiedTests:$
237
244
  """
238
- And the output should match /Running Test: individual_test/
245
+ And the output should match /Running Test: .*/
246
+ And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
247
+
248
+ Scenario: Push code to a sandbox in check only mode using debug
249
+ When I run `sf push -c -d`
250
+ Then the exit status should be 0
251
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
252
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
253
+ And the output should match:
254
+ """
255
+ ^INFO: Deploying code to testEnv:.*$
256
+ ^$
257
+ ^Buildfile: .*$
258
+ ^$
259
+ ^checkOnlyCode:$
260
+ """
261
+ And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
262
+
263
+ Scenario: Push code to a sandbox in debug mode and exclude specific metadata objects to exclude
264
+ When I run `sf push -e Account.Sort__c -d`
265
+ Then the exit status should be 0
266
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
267
+ And the output should match /Pulling.*testEnv.*https:..test.salesforce.com.*destructiveChanges.xml/
268
+ And the output should match /excluded: Account.Sort__c/
269
+ And the output should match /INFO: Deploying code to testEnv/
270
+ And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
271
+
272
+ Scenario: Push code to a sandbox in debug mode and specifieng specific metadata to destroy
273
+ When I run `sf push -i apexclass -d`
274
+ Then the exit status should be 0
275
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
276
+ And the file "repo/salesforce/src/destructiveChanges.xml" should contain "ApexClass"
277
+ And the file "repo/salesforce/src/destructiveChanges.xml" should not contain "ApexPage"
278
+ And the output should match /Pulling.*testEnv.*https:..test.salesforce.com.*destructiveChanges.xml/
279
+ And the output should match /included: apexclass/
280
+ And the output should match /INFO: Deploying code to testEnv/
281
+ And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
282
+
283
+ @new
284
+ Scenario: Push code to a sandbox in debug mode and specifieng specific metadata exclude from destructive change
285
+ When I run `sf push -e NewVersionTest -d`
286
+ Then the exit status should be 0
287
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
288
+ And the file "repo/salesforce/src/destructiveChanges.xml" should not contain "ApexClass"
289
+ And the file "repo/salesforce/src/destructiveChanges.xml" should not contain "NewVersionTest"
290
+ And the file "repo/salesforce/src/destructiveChanges.xml" should contain "ApexPage"
291
+ And the output should match /Pulling.*testEnv.*https:..test.salesforce.com.*destructiveChanges.xml/
292
+ And the output should match /excluded: NewVersionTest/
293
+ And the output should match /INFO: Deploying code to testEnv/
239
294
  And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
@@ -0,0 +1,201 @@
1
+ #!/bin/bash
2
+
3
+ COMMAND=$1
4
+
5
+ if [[ -z $SF_SRC_DIR ]]; then
6
+ echo "ERROR: SF_SRC_DIR Not defined"
7
+ exit 1
8
+ fi
9
+
10
+ if [[ -z $SF_USERNAME ]]; then
11
+ echo "ERROR: SF_USERNAME Not defined"
12
+ exit 1
13
+ fi
14
+
15
+ if [[ -z $SF_PASSWORD ]]; then
16
+ echo "ERROR: SF_PASSWORD Not defined"
17
+ exit 1
18
+ fi
19
+
20
+ if [[ -z $SF_SERVERURL ]]; then
21
+ echo "ERROR: SF_PASSWORD Not defined"
22
+ exit 1
23
+ fi
24
+
25
+ if [[ $SF_USERNAME == 'invalid_user' ]]; then
26
+ cat << EOF
27
+ Buildfile: ${PWD}/build.xml
28
+
29
+ ${COMMAND}:
30
+
31
+ BUILD FAILED
32
+ ${PWD}/build.xml:53: Invalid username, password, security token; or user locked out.
33
+
34
+ Total time: 10 seconds
35
+
36
+ EOF
37
+ exit 1
38
+ fi
39
+
40
+ if ! echo $SF_SERVERURL|grep -E 'https:\/\/(test|login).salesforce.com' > /dev/null 2>&1 ; then
41
+ cat << EOF
42
+ Buildfile: ${PWD}/build.xml
43
+
44
+ retrieveCode:
45
+ [sf:retrieve] Note: use ant -verbose to get more information on the failure
46
+
47
+ BUILD FAILED
48
+ ${PWD}/build.xml:53: Failed to login: Failed to send request to ${SF_SERVERURL}/services/Soap/u/31.0
49
+
50
+ Total time: 6 seconds
51
+
52
+ EOF
53
+
54
+ exit 1
55
+ fi
56
+
57
+ if [[ ! -f build.xml ]]; then
58
+ echo "ERROR: build.xml not found"
59
+ exit 1
60
+ fi
61
+
62
+ if [[ ! -f $SF_SRC_DIR/package.xml ]]; then
63
+ echo "ERROR: package.xml not found"
64
+ exit 1
65
+ fi
66
+
67
+ if ! grep $COMMAND build.xml > /dev/null 2>&1 ; then
68
+ echo "ERROR: $COMMAND not found on build.xml"
69
+ exit 1
70
+ fi
71
+
72
+ case $COMMAND in
73
+ "retrieveCode")
74
+
75
+ # Add two more classes and two more pages so to simulate
76
+ # Destructive changes
77
+ cd $SF_SRC_DIR
78
+ git reset --hard
79
+ old_dir=`pwd`
80
+ cd $SF_SRC_DIR/classes
81
+ ls|tail -2|while read class;do cp $class New$class;done
82
+ cd $SF_SRC_DIR/pages
83
+ ls|tail -2|while read page;do cp $page New$page;done
84
+ cd $old_dir
85
+
86
+ cat << EOF
87
+ Buildfile: ${PWD}/build.xml
88
+
89
+ retrieveCode:
90
+ [sf:retrieve] Request for a retrieve submitted successfully.
91
+ [sf:retrieve] Request ID for the current retrieve task: 09S11000002rKP5EAM
92
+ [sf:retrieve] Waiting for server to finish processing the request...
93
+ [sf:retrieve] Request Status: Pending
94
+ [sf:retrieve] Request Status: InProgress
95
+ [sf:retrieve] Request Status: Succeeded
96
+ [sf:retrieve] Finished request 09S11000002rKP5EAM successfully.
97
+
98
+ BUILD SUCCESSFUL
99
+ Total time: 1 minute 38 seconds
100
+
101
+ EOF
102
+ ;;
103
+ "deployCode")
104
+ if echo $SF_SERVERURL |grep login > /dev/null 2>&1 ;then
105
+ cat << EOF
106
+ Buildfile: ${PWD}/build.xml
107
+
108
+ deployCode:
109
+ [sf:deploy] Request for a deploy submitted successfully.
110
+ [sf:deploy] Request ID for the current deploy task: 0Af2400000a0FeVCAU
111
+ [sf:deploy] Waiting for server to finish processing the request...
112
+ [sf:deploy] Request Status: Pending
113
+ [sf:deploy] Request Status: InProgress (94/1473) -- Processing Type: CustomObject
114
+ [sf:deploy] Request Status: InProgress
115
+ [sf:deploy] Request Status: InProgress (1204/1473) -- Processing Type: ApprovalProcess
116
+ [sf:deploy] Request Status: InProgress (1212/1473) -- Processing Type: ApexClass
117
+ [sf:deploy] Request Status: InProgress (1442/1473) -- Processing Type: PermissionSet
118
+ [sf:deploy] Request Status: InProgress (7/227) -- Running Test: FooClassTest
119
+ [sf:deploy] Request Status: InProgress (26/227) -- Running Test: BarClassTest
120
+ [sf:deploy] Request Status: Succeeded
121
+ [sf:deploy] *********** DEPLOYMENT SUCCEEDED ***********
122
+ [sf:deploy] Finished request 0Af2400000a0FeVCAU successfully.
123
+
124
+ BUILD SUCCESSFUL
125
+ EOF
126
+ else
127
+ cat << EOF
128
+ Buildfile: ${PWD}/build.xml
129
+
130
+ deployCode:
131
+ [sf:deploy] Request for a deploy submitted successfully.
132
+ [sf:deploy] Request ID for the current deploy task: 0Af2400000a0FeVCAU
133
+ [sf:deploy] Waiting for server to finish processing the request...
134
+ [sf:deploy] Request Status: Pending
135
+ [sf:deploy] Request Status: InProgress (94/1473) -- Processing Type: CustomObject
136
+ [sf:deploy] Request Status: InProgress
137
+ [sf:deploy] Request Status: InProgress (1204/1473) -- Processing Type: ApprovalProcess
138
+ [sf:deploy] Request Status: InProgress (1212/1473) -- Processing Type: ApexClass
139
+ [sf:deploy] Request Status: InProgress (1442/1473) -- Processing Type: PermissionSet
140
+ [sf:deploy] Request Status: Succeeded
141
+ [sf:deploy] *********** DEPLOYMENT SUCCEEDED ***********
142
+ [sf:deploy] Finished request 0Af2400000a0FeVCAU successfully.
143
+
144
+ BUILD SUCCESSFUL
145
+
146
+ EOF
147
+ fi
148
+ ;;
149
+ "deployAndTestCode"|"deployAndRunSpecifiedTests")
150
+ cat << EOF
151
+ Buildfile: ${PWD}/build.xml
152
+
153
+ ${COMMAND}:
154
+ [sf:deploy] Request for a deploy submitted successfully.
155
+ [sf:deploy] Request ID for the current deploy task: 0Af2400000a0FeVCAU
156
+ [sf:deploy] Waiting for server to finish processing the request...
157
+ [sf:deploy] Request Status: Pending
158
+ [sf:deploy] Request Status: InProgress (94/1473) -- Processing Type: CustomObject
159
+ [sf:deploy] Request Status: InProgress
160
+ [sf:deploy] Request Status: InProgress (1204/1473) -- Processing Type: ApprovalProcess
161
+ [sf:deploy] Request Status: InProgress (1212/1473) -- Processing Type: ApexClass
162
+ [sf:deploy] Request Status: InProgress (1212/1473) -- Processing Type: ApexClass
163
+ [sf:deploy] Request Status: InProgress (1442/1473) -- Processing Type: PermissionSet
164
+ [sf:deploy] Request Status: InProgress (7/227) -- Running Test: FooClassTest
165
+ [sf:deploy] Request Status: InProgress (26/227) -- Running Test: BarClassTest
166
+ [sf:deploy] Request Status: Succeeded
167
+ [sf:deploy] *********** DEPLOYMENT SUCCEEDED ***********
168
+ [sf:deploy] Finished request 0Af2400000a0FeVCAU successfully.
169
+
170
+ BUILD SUCCESSFUL
171
+ EOF
172
+ ;;
173
+ "checkOnlyCode")
174
+ cat << EOF
175
+ Buildfile: /home/vagrant/salesforce/build.xml
176
+
177
+ checkOnlyCode:
178
+ [sf:deploy] Request for a deploy submitted successfully.
179
+ [sf:deploy] Request ID for the current deploy task: 0Afg000000Dwn66CAB
180
+ [sf:deploy] Waiting for server to finish processing the request...
181
+ [sf:deploy] Request Status: Pending
182
+ [sf:deploy] Request Status: InProgress
183
+ [sf:deploy] Request Status: InProgress (49/1115) -- Processing Type: ApexPage
184
+ [sf:deploy] Request Status: InProgress (49/1115) -- Processing Type: ApexPage
185
+ [sf:deploy] Request Status: InProgress (125/1115) -- Processing Type: CustomObject
186
+ [sf:deploy] Request Status: InProgress (912/1115) -- Processing Type: Workflow
187
+ [sf:deploy] Request Status: InProgress (926/1115) -- Processing Type: ApexClass
188
+ [sf:deploy] Request Status: InProgress (1101/1115) -- Processing Type: ApexTrigger
189
+ [sf:deploy] Request Status: InProgress (1108/1115) -- Processing Type: Profile
190
+ [sf:deploy] Request Status: InProgress
191
+ [sf:deploy] Request Status: Succeeded
192
+ [sf:deploy] *********** DEPLOYMENT SUCCEEDED ***********
193
+ [sf:deploy] Finished request 0Afg000000Dwn66CAB successfully.
194
+
195
+ BUILD SUCCESSFUL
196
+ Total time: 5 minutes 2 seconds
197
+ EOF
198
+
199
+ esac
200
+
201
+ sleep 0.4