leap_salesforce 0.2.16 → 0.2.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d503b98e728ba7dca4891f70e6c849ee77394e626ef167c46f4ffea65470b46e
4
- data.tar.gz: 241cfdf4533714e75546357e28bd35ddcb6d0fc6fed0bb7d8471341f28fdaec1
3
+ metadata.gz: 906a5f6573d0bf393082eadac1e9935fcda4e89c6886a8e2d5fffa15010db289
4
+ data.tar.gz: 8b8343640b11e301fc53f6c8c5ba6a7253b206a14caaf9f723d74ed4f834318c
5
5
  SHA512:
6
- metadata.gz: 03f8e91a6a8e24375abef2040b0e993255c1c0d860c9f34155aa2e5bf87b2a7cea9492285b26286230874d8ee6785f322ab922ca6c09ef7a11259883d2903873
7
- data.tar.gz: 482f87a06f2a094afc6d7eef495972a3927ba313b68fb1e5be35c61ddaefd367c937de5229258e0610b3b909471a56729be013516a9151115a6c12958c9d2725
6
+ metadata.gz: afecc4803505fb9599c49855d7105a9262e79e65f28156b3989508df973365d2f23a9525b306b845d2d30309561c39bcfc66bd092840a26ccf03a9df8de1675b
7
+ data.tar.gz: 1b4b06ee4497c02852afd97ee9bdfa9d80b88a2df9e9498d6795d0d5fc7a39cad2150f6e2f5138075890d72a6220bc03380c72a83dd2c01914e4e66e449ef021
@@ -24,7 +24,7 @@
24
24
  <orderEntry type="library" scope="PROVIDED" name="docile (v1.3.2, RVM: ruby-2.6.3) [gem]" level="application" />
25
25
  <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.6.3) [gem]" level="application" />
26
26
  <orderEntry type="library" scope="PROVIDED" name="factory_bot (v5.1.1, RVM: ruby-2.6.3) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="faker (v2.7.0, RVM: ruby-2.6.3) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="faker (v2.8.1, RVM: ruby-2.6.3) [gem]" level="application" />
28
28
  <orderEntry type="library" scope="PROVIDED" name="gyoku (v1.3.1, RVM: ruby-2.6.3) [gem]" level="application" />
29
29
  <orderEntry type="library" scope="PROVIDED" name="hashie (v4.0.0, RVM: ruby-2.6.3) [gem]" level="application" />
30
30
  <orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.6.3) [gem]" level="application" />
@@ -45,9 +45,9 @@
45
45
  <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.14.1, RVM: ruby-2.6.3) [gem]" level="application" />
46
46
  <orderEntry type="library" scope="PROVIDED" name="mustermann (v1.0.3, RVM: ruby-2.6.3) [gem]" level="application" />
47
47
  <orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.6.3) [gem]" level="application" />
48
- <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.5, RVM: ruby-2.6.3) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.7, RVM: ruby-2.6.3) [gem]" level="application" />
49
49
  <orderEntry type="library" scope="PROVIDED" name="nori (v2.6.0, RVM: ruby-2.6.3) [gem]" level="application" />
50
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.19.0, RVM: ruby-2.6.3) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.19.1, RVM: ruby-2.6.3) [gem]" level="application" />
51
51
  <orderEntry type="library" scope="PROVIDED" name="parser (v2.6.5.0, RVM: ruby-2.6.3) [gem]" level="application" />
52
52
  <orderEntry type="library" scope="PROVIDED" name="pry (v0.12.2, RVM: ruby-2.6.3) [gem]" level="application" />
53
53
  <orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.1, RVM: ruby-2.6.3) [gem]" level="application" />
@@ -72,7 +72,7 @@
72
72
  <orderEntry type="library" scope="PROVIDED" name="sinatra (v2.0.4, RVM: ruby-2.6.3) [gem]" level="application" />
73
73
  <orderEntry type="library" scope="PROVIDED" name="sinatra-basic-auth (v0.1.0, RVM: ruby-2.6.3) [gem]" level="application" />
74
74
  <orderEntry type="library" scope="PROVIDED" name="sinatra-docdsl (v0.8.6, RVM: ruby-2.6.3) [gem]" level="application" />
75
- <orderEntry type="library" scope="PROVIDED" name="soaspec (v0.3.7, RVM: ruby-2.6.3) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="soaspec (v0.3.8, RVM: ruby-2.6.3) [gem]" level="application" />
76
76
  <orderEntry type="library" scope="PROVIDED" name="socksify (v1.7.1, RVM: ruby-2.6.3) [gem]" level="application" />
77
77
  <orderEntry type="library" scope="PROVIDED" name="thor (v0.20.3, RVM: ruby-2.6.3) [gem]" level="application" />
78
78
  <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.6.3) [gem]" level="application" />
@@ -87,7 +87,7 @@
87
87
  <orderEntry type="library" scope="PROVIDED" name="xml-simple (v1.1.5, RVM: ruby-2.6.3) [gem]" level="application" />
88
88
  <orderEntry type="library" scope="PROVIDED" name="yard (v0.9.20, RVM: ruby-2.6.3) [gem]" level="application" />
89
89
  <orderEntry type="library" scope="PROVIDED" name="yard-doctest (v0.1.17, RVM: ruby-2.6.3) [gem]" level="application" />
90
- <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.2.1, RVM: ruby-2.6.3) [gem]" level="application" />
90
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.2.2, RVM: ruby-2.6.3) [gem]" level="application" />
91
91
  </component>
92
92
  <component name="RModuleSettingsStorage">
93
93
  <LOAD_PATH number="1" string0="$MODULE_DIR$/spec/support" />
data/.leap_salesforce.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  environment: prod # This is irrelevant for sfdx auth which uses user/alias
2
2
  lib_folder: spec/support
3
- sfdx: true
3
+ sfdx: false
4
4
  soql_objects:
5
5
  - Case
6
6
  - Contact
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.2.17
2
+ * Bug fix
3
+ * Do not fail SFDX if SFDX_ACCESS_TOKEN and SFDX_INSTANCE_URL are manually set
4
+
1
5
  Version 0.2.16
2
6
  * Bug fix
3
7
  * Fixed unset and added a test for it. Only works currently with explicit backend name
data/README.md CHANGED
@@ -158,8 +158,11 @@ The `LEAP_ENV` environment variable can be used to change environment in non sfd
158
158
  `.leap_salesforce.yml` environment key.
159
159
 
160
160
  In sfdx mode, setting env variable `SCRATCH_ORG` to `true`
161
- will tell leap salesforce to authenticate against a SCRATCH ORG. It will try using either the `SCRATCH_ORG_ALIAS`
162
- environment variable or a `SCRATCH_INSTANCE_URL` and `SCRATCH_ACCESS_TOKEN` if set.
161
+ will tell leap salesforce to authenticate against a SCRATCH ORG. It will attempt to use either the `SCRATCH_ORG_ALIAS`
162
+ environment variable.
163
+
164
+ Alternatively, set the environment variables `SCRATCH_INSTANCE_URL` and `SCRATCH_ACCESS_TOKEN` from `sfdx:org:display`
165
+ to enable tests to use that to authenticate to environment directly.
163
166
 
164
167
  #### Test Users
165
168
  Test users are defined using the `LeapSalesforce::Users` module. Following is an example of setting up a few test
@@ -59,19 +59,34 @@ module LeapSalesforce
59
59
  true
60
60
  end
61
61
 
62
+ # @return [Boolean] Whether SFDX Access token and instance url have been manually set
63
+ # If not they will be attempted to be retrieved via JWT, SF_USERNAME & SF_CONSUMER_KEY
64
+ def manually_set_auth?
65
+ ENV['SFDX_ACCESS_TOKEN'] ||= ENV['SCRATCH_ACCESS_TOKEN']
66
+ ENV['SFDX_INSTANCE_URL'] ||= ENV['SCRATCH_INSTANCE_URL']
67
+ return false unless ENV['SFDX_ACCESS_TOKEN'] && ENV['SFDX_INSTANCE_URL']
68
+
69
+ !ENV['SFDX_ACCESS_TOKEN'].empty? && !ENV['SFDX_INSTANCE_URL'].empty?
70
+ end
71
+
62
72
  # Extract sfdx variables and store them
63
73
  # Set ENV['SCRATCH_ORG'] to true to authenticate and run against sandbox
64
74
  def extract_sfdx_variables
75
+ return unless LeapSalesforce.sfdx
76
+
65
77
  LeapSalesforce.client_id = ENV['SF_CONSUMER_KEY']
66
- LeapSalesforce.password = :not_needed
67
- LeapSalesforce.client_secret = :not_needed
68
- if ENV['SCRATCH_ACCESS_TOKEN'] && ENV['SCRATCH_INSTANCE_URL']
69
- url_obtained = ENV['SCRATCH_INSTANCE_URL']
78
+ if manually_set_auth?
79
+ url_obtained = ENV['SFDX_INSTANCE_URL']
70
80
  self.instance_url = url_obtained[-1] == '/' ? url_obtained[0..-2] : url_obtained
71
- self.access_token = ENV['SCRATCH_ACCESS_TOKEN']
81
+ self.access_token = ENV['SFDX_ACCESS_TOKEN']
72
82
  return
73
83
  end
74
84
 
85
+ unless ENV['SF_USERNAME'] && ENV['SF_CONSUMER_KEY']
86
+ logger.error "No CREDENTIALS FILE found at #{CREDENTIAL_FILE}." unless File.exist? CREDENTIAL_FILE
87
+ raise SetupError,
88
+ 'Please set SF_USERNAME and SF_CONSUMER_KEY environment variables'
89
+ end
75
90
  script_name = if ENV['SCRATCH_ORG'] && !ENV['SCRATCH_ORG'].empty?
76
91
  raise "Please set SCRATCH_ORG_ALIAS when SCRATCH_ORG(#{ENV['SCRATCH_ORG']}) is set" unless ENV['SCRATCH_ORG_ALIAS']
77
92
 
@@ -65,7 +65,7 @@ module LeapSalesforce
65
65
  # logged
66
66
  # @return [Boolean] Whether sfdx is setup correctly
67
67
  def sfdx_auth_setup?
68
- Auth.jwt_file?
68
+ Auth.manually_set_auth? || Auth.jwt_file?
69
69
  return true if LeapSalesforce::Auth.sfdx_variables?
70
70
 
71
71
  raise LeapSalesforce::SetupError, 'LeapSalesforce::Auth.access_token and ' \
@@ -2,5 +2,5 @@
2
2
 
3
3
  module LeapSalesforce
4
4
  # @return [String] Version of leap salesforce
5
- VERSION = '0.2.16'
5
+ VERSION = '0.2.17'
6
6
  end
@@ -59,13 +59,7 @@ module LeapSalesforce
59
59
  require general_file if File.exist? "#{general_file}.rb"
60
60
 
61
61
  if sfdx
62
- # Assume authentication already made through 'sfdx force:auth:jwt:grant'
63
- unless ENV['SF_USERNAME'] && ENV['SF_CONSUMER_KEY']
64
- logger.error "No CREDENTIALS FILE found at #{CREDENTIAL_FILE}." unless File.exist? CREDENTIAL_FILE
65
- raise SetupError,
66
- 'Please set SF_USERNAME and SF_CONSUMER_KEY environment variables'
67
- end
68
- Auth.jwt_file?
62
+ sfdx_auth_setup?
69
63
  else
70
64
  %w[client_id client_secret password].each do |param|
71
65
  if send(param).nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leap_salesforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - IQA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-12-04 00:00:00.000000000 Z
12
+ date: 2019-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler