sf_cli 0.0.4 → 0.0.5
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 +4 -4
- data/CHANGELOG.md +18 -2
- data/README.rdoc +8 -32
- data/lib/sf_cli/sf/data/bulk_result_v2.rb +77 -0
- data/lib/sf_cli/sf/data/core.rb +22 -162
- data/lib/sf_cli/sf/data/create_record.rb +30 -0
- data/lib/sf_cli/sf/data/delete_bulk.rb +47 -0
- data/lib/sf_cli/sf/data/delete_record.rb +33 -0
- data/lib/sf_cli/sf/data/delete_resume.rb +47 -0
- data/lib/sf_cli/sf/data/get_record.rb +42 -0
- data/lib/sf_cli/sf/data/helper_methods.rb +12 -0
- data/lib/sf_cli/sf/data/query.rb +120 -0
- data/lib/sf_cli/sf/data/query_helper.rb +57 -0
- data/lib/sf_cli/sf/data/resume.rb +87 -0
- data/lib/sf_cli/sf/data/search.rb +50 -0
- data/lib/sf_cli/sf/data/update_record.rb +38 -0
- data/lib/sf_cli/sf/data/upsert_bulk.rb +50 -0
- data/lib/sf_cli/sf/data/upsert_resume.rb +47 -0
- data/lib/sf_cli/sf/org/core.rb +6 -44
- data/lib/sf_cli/sf/org/display.rb +41 -0
- data/lib/sf_cli/sf/org/list.rb +67 -0
- data/lib/sf_cli/sf/org/login.rb +64 -0
- data/lib/sf_cli/sf/project/core.rb +10 -3
- data/lib/sf_cli/sf/sobject/core.rb +6 -4
- data/lib/sf_cli.rb +8 -5
- metadata +23 -7
@@ -0,0 +1,64 @@
|
|
1
|
+
module SfCli::Sf::Org
|
2
|
+
module Login
|
3
|
+
# login to the org by the browser.
|
4
|
+
#
|
5
|
+
# *target_org* --- an alias of paticular org, or username can be used<br>
|
6
|
+
#
|
7
|
+
# *instance_url* --- URL of the instance that the org lives on.
|
8
|
+
#
|
9
|
+
# *browser* --- browser in which to open the org.
|
10
|
+
#
|
11
|
+
# == examples:
|
12
|
+
# sf.org.login_web
|
13
|
+
# sf.org.login_web target_org: :dev
|
14
|
+
#
|
15
|
+
# For more command details, see {the command reference}[https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_org_commands_unified.htm#cli_reference_org_login_web_unified]
|
16
|
+
#
|
17
|
+
def login_web(target_org: nil, instance_url: nil, browser: nil)
|
18
|
+
flags = {
|
19
|
+
:"alias" => target_org,
|
20
|
+
:"instance-url" => instance_url,
|
21
|
+
:"browser" => browser,
|
22
|
+
}
|
23
|
+
action = __method__.to_s.tr('_', ' ')
|
24
|
+
exec(action, flags: flags)
|
25
|
+
end
|
26
|
+
|
27
|
+
# login to the org by access token.
|
28
|
+
#
|
29
|
+
# NOTE: this method doesn't support user interactive mode, so *SF_ACCESS_TOKEN* environment variable must be set before call this method.
|
30
|
+
#
|
31
|
+
# *instance_url* --- URL of the instance that the org lives on.
|
32
|
+
#
|
33
|
+
# *target_org* --- an alias of paticular org, or username can be used<br>
|
34
|
+
#
|
35
|
+
# ======
|
36
|
+
# ENV['SF_ACCESS_TOKEN'] = 'xxxxxxxxxx'
|
37
|
+
# sf.org.login_access_token instance_url: https://hoge.bar.baz.salesforce.com
|
38
|
+
#
|
39
|
+
# == how to set env variable outside of ruby
|
40
|
+
# In Unix/mac:
|
41
|
+
# $ SF_ACCESS_TOKEN='xxxxxxxxxx'
|
42
|
+
# $ ruby app_using_sfcli.rb
|
43
|
+
# or
|
44
|
+
# $ SF_ACCESS_TOKEN='xxxxxxxxxx' ruby app_using_sfcli.rb
|
45
|
+
#
|
46
|
+
# In Windows:
|
47
|
+
# $ set SF_ACCESS_TOKEN=xxxxxxxxxx
|
48
|
+
# $ ruby app_using_sfcli.rb
|
49
|
+
#
|
50
|
+
# For more command details, see {the command reference}[https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_org_commands_unified.htm#cli_reference_org_login_access-token_unified]
|
51
|
+
#
|
52
|
+
def login_access_token(instance_url:, target_org: nil)
|
53
|
+
flags = {
|
54
|
+
:"instance-url" => instance_url,
|
55
|
+
:"alias" => target_org,
|
56
|
+
}
|
57
|
+
switches = {
|
58
|
+
:"no-prompt" => true,
|
59
|
+
}
|
60
|
+
action = __method__.to_s.tr('_', '-').sub('-', ' ')
|
61
|
+
exec action, flags: flags, switches: switches, redirection: :null_stderr
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -14,11 +14,14 @@ module SfCli
|
|
14
14
|
GenerateResult = Struct.new(:output_dir, :files, :raw_output, :warnings)
|
15
15
|
|
16
16
|
#
|
17
|
-
# generate a Salesforce project
|
17
|
+
# generate a Salesforce project
|
18
18
|
#
|
19
19
|
# *name* --- project name<br>
|
20
|
+
#
|
20
21
|
# *template* --- project template name<br>
|
22
|
+
#
|
21
23
|
# *output_dir* --- output directory<br>
|
24
|
+
#
|
22
25
|
# *manifest* --- switch to create manifest file in the project directory (manifest/package.xml). default: false
|
23
26
|
#
|
24
27
|
# For more command details, see the {reference document}[https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_project_commands_unified.htm#cli_reference_project_generate_unified]
|
@@ -42,15 +45,19 @@ module SfCli
|
|
42
45
|
)
|
43
46
|
end
|
44
47
|
|
45
|
-
# generate the manifest file of a Salesforce project
|
48
|
+
# generate the manifest file of a Salesforce project
|
46
49
|
#
|
47
50
|
# *metadata* --- an array that consists of metadata type like CustomObject, Layout and so on. (default: [])<br>
|
51
|
+
#
|
48
52
|
# *api_verson* --- api version (default: nil)<br>
|
53
|
+
#
|
49
54
|
# *output_dir* --- manifest's output directory in the project directory. You can use relative path from the project root (default: nil)<br>
|
55
|
+
#
|
50
56
|
# *from_org* --- username or alias of the org that contains the metadata components from which to build a manifest (default: nil)<br>
|
57
|
+
#
|
51
58
|
# *source_dir* --- paths to the local source files to include in the manifest (default: nil)
|
52
59
|
#
|
53
|
-
#
|
60
|
+
# ======
|
54
61
|
# sf.project.generate_manifest metadata: %w[CustomObject Layout] # creates a package.xml, which is initialized with CustomObject and Layout
|
55
62
|
# sf.project.generate_manifest from_org: <org_name> # creates a package.xml, which is initialized with all metadata types in the org
|
56
63
|
#
|
@@ -11,10 +11,11 @@ module SfCli
|
|
11
11
|
class Core
|
12
12
|
include ::SfCli::Sf::Core::Base
|
13
13
|
|
14
|
-
# returns a hash object containing the Salesforce object schema
|
14
|
+
# returns a hash object containing the Salesforce object schema
|
15
15
|
#
|
16
16
|
# *objectType* --- object type (ex: Account)<br>
|
17
|
-
#
|
17
|
+
#
|
18
|
+
# *target_org* --- an alias of paticular org, or username can be used<br>
|
18
19
|
#
|
19
20
|
# For more command details, see {the command reference}[https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_sobject_commands_unified.htm#cli_reference_sobject_describe_unified]
|
20
21
|
#
|
@@ -27,10 +28,11 @@ module SfCli
|
|
27
28
|
json['result']
|
28
29
|
end
|
29
30
|
|
30
|
-
# returns a list of Salesforce object
|
31
|
+
# returns a list of Salesforce object name
|
31
32
|
#
|
32
33
|
# *object_type* --- all or custom<br>
|
33
|
-
#
|
34
|
+
#
|
35
|
+
# *target_org* --- an alias of paticular org, or username can be used<br>
|
34
36
|
#
|
35
37
|
# For more command details, see {the command reference}[https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_sobject_commands_unified.htm#cli_reference_sobject_list_unified]
|
36
38
|
#
|
data/lib/sf_cli.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
require 'sf_cli/sf/main'
|
2
2
|
#
|
3
3
|
# the global method that represents *sf* command.
|
4
|
-
# This is desgined as the syntax suger, which can use with similar usability to the original.
|
5
4
|
#
|
6
|
-
#
|
5
|
+
# With method chaining, you can use similar syntax as original command.
|
7
6
|
#
|
8
7
|
# == examples
|
9
|
-
# # you can follow the similar syntax to the original command by using method chain.
|
10
8
|
#
|
11
|
-
#
|
12
|
-
# sf.
|
9
|
+
# ======
|
10
|
+
# sf.org.display # => returns the org information object
|
11
|
+
#
|
12
|
+
# ======
|
13
|
+
# sf.data.query "SELECT Name FROM Account" # => [{"Name"=>"Aethna Home Products"}]
|
14
|
+
#
|
15
|
+
# For details of sf command, see the {reference guide}[https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_unified.htm]
|
13
16
|
#
|
14
17
|
def sf
|
15
18
|
SfCli::Sf::Main.instance
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sf_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takanobu Maekawa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a class library for introducing Salesforce CLI to Ruby scripting.
|
14
14
|
Currenty only sf command is the target of development.
|
15
|
-
email:
|
15
|
+
email:
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files:
|
@@ -23,14 +23,30 @@ files:
|
|
23
23
|
- README.rdoc
|
24
24
|
- lib/sf_cli.rb
|
25
25
|
- lib/sf_cli/sf/core/base.rb
|
26
|
+
- lib/sf_cli/sf/data/bulk_result_v2.rb
|
26
27
|
- lib/sf_cli/sf/data/core.rb
|
28
|
+
- lib/sf_cli/sf/data/create_record.rb
|
29
|
+
- lib/sf_cli/sf/data/delete_bulk.rb
|
30
|
+
- lib/sf_cli/sf/data/delete_record.rb
|
31
|
+
- lib/sf_cli/sf/data/delete_resume.rb
|
32
|
+
- lib/sf_cli/sf/data/get_record.rb
|
27
33
|
- lib/sf_cli/sf/data/helper_methods.rb
|
34
|
+
- lib/sf_cli/sf/data/query.rb
|
35
|
+
- lib/sf_cli/sf/data/query_helper.rb
|
36
|
+
- lib/sf_cli/sf/data/resume.rb
|
37
|
+
- lib/sf_cli/sf/data/search.rb
|
38
|
+
- lib/sf_cli/sf/data/update_record.rb
|
39
|
+
- lib/sf_cli/sf/data/upsert_bulk.rb
|
40
|
+
- lib/sf_cli/sf/data/upsert_resume.rb
|
28
41
|
- lib/sf_cli/sf/main.rb
|
29
42
|
- lib/sf_cli/sf/model.rb
|
30
43
|
- lib/sf_cli/sf/model/class_definition.rb
|
31
44
|
- lib/sf_cli/sf/model/generator.rb
|
32
45
|
- lib/sf_cli/sf/model/schema.rb
|
33
46
|
- lib/sf_cli/sf/org/core.rb
|
47
|
+
- lib/sf_cli/sf/org/display.rb
|
48
|
+
- lib/sf_cli/sf/org/list.rb
|
49
|
+
- lib/sf_cli/sf/org/login.rb
|
34
50
|
- lib/sf_cli/sf/project/core.rb
|
35
51
|
- lib/sf_cli/sf/sobject/core.rb
|
36
52
|
homepage: https://github.com/tmkw/sf_cli
|
@@ -38,7 +54,7 @@ licenses:
|
|
38
54
|
- MIT
|
39
55
|
metadata:
|
40
56
|
homepage_url: https://github.com/tmkw/sf_cli
|
41
|
-
post_install_message:
|
57
|
+
post_install_message:
|
42
58
|
rdoc_options: []
|
43
59
|
require_paths:
|
44
60
|
- lib
|
@@ -53,9 +69,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
69
|
- !ruby/object:Gem::Version
|
54
70
|
version: '0'
|
55
71
|
requirements:
|
56
|
-
- 'Salesforce CLI ( >= 2.
|
72
|
+
- 'Salesforce CLI ( >= 2.56.7): https://developer.salesforce.com/tools/salesforcecli'
|
57
73
|
rubygems_version: 3.5.11
|
58
|
-
signing_key:
|
74
|
+
signing_key:
|
59
75
|
specification_version: 4
|
60
76
|
summary: A library for using Salesforce CLI in Ruby
|
61
77
|
test_files: []
|