alet 0.1.2 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cbf4ee403adc8ddacb9640214c603e822cb543da6ece81e162402bf5c72871e
4
- data.tar.gz: 8d4ff7690e2222f8cc69d4d9a07edda96a4121a88edbb0d563d7006843fd6169
3
+ metadata.gz: 132887d88cce23c1ca1eef8d0d7da205f334d814259e22bfdb88481342050fba
4
+ data.tar.gz: 628305b1623058660782f647ddad310969844f9450cd5d3dc719927868931784
5
5
  SHA512:
6
- metadata.gz: 4ea239caeba3b419d73a20db668fa28b9485651c30b7be48b0550581b5deb19f9de03f2cf28a894874da2af38b60d951d06956d512af7b95612c51701c76e6e2
7
- data.tar.gz: 00d775cd7160640640e47798d768ab170bf0f055f23ee861951654710ff367a49c05f673ea34e35ce5d78dee91d16fb8b0f8ddbb4b4e4c6b8073a36a85ada1e6
6
+ metadata.gz: 8e1f2220dee8fa6982806f026b7080572e9807fa75a52a778cc5d8133f2a5a57d2760f8c4d1d5d92f234a717e4f7c6dfe419123664133cbdd255ecdf8faf65d4
7
+ data.tar.gz: 3cd1d82e9d7f81850ee4d53eb03243f6e51ecab3d63c7b9b2c28daa8b6c26e563a0b2cbdb997f592cb2696b4ab68e08520a08d90930a3b28397e30853e462781
data/lib/alet/app.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'gli'
2
2
  require 'irb'
3
- require 'alet/config'
3
+ require 'alet'
4
4
  require 'alet/utils/irb'
5
- require 'alet/generate/project'
5
+ require 'alet/project'
6
6
  require 'alet/version'
7
7
  require 'i18n'
8
8
 
@@ -29,11 +29,9 @@ module Alet
29
29
  desc t('cli.target_org')
30
30
  flag [:o, 'target-org'], default_value: nil, arg_name: 'org'
31
31
 
32
-
33
32
  desc t('cli.irb.desc')
34
33
  command :irb do |c|
35
34
  c.desc desc t('cli.target_org')
36
- c.flag [:o, 'target-org'], default_value: nil, arg_name: 'org'
37
35
 
38
36
  c.example "alet", desc: t('cli.irb.example.default')
39
37
  c.example "alet -o org", desc: t('cli.irb.example.target_org')
@@ -44,32 +42,39 @@ module Alet
44
42
  end
45
43
  end
46
44
 
47
- desc t('cli.generate.desc')
48
- command [:generate, :g] do |c|
49
- c.desc desc t('cli.generate.project.desc')
50
- c.arg_name 'project_name'
51
- c.command :project do |prj|
52
- prj.desc t('cli.generate.project.target_org')
53
- prj.flag [:o, 'target-org'], default_value: nil, arg_name: 'org'
45
+ desc t('cli.project.desc')
46
+ command [:project, :p] do |prj|
47
+ prj.desc desc t('cli.project.generate.desc')
48
+ prj.arg_name 'project_name'
54
49
 
55
- prj.desc t('cli.generate.project.manifest')
56
- prj.switch [:m, :manifest], negatable: false
50
+ prj.desc t('cli.project.open_editor')
51
+ prj.switch [:e, 'editor-open'], negatable: false
57
52
 
58
- prj.desc t('cli.generate.project.open_editor')
59
- prj.switch [:e, 'editor-open'], negatable: false
53
+ prj.command [:generate, :g] do |gen|
54
+ gen.desc t('cli.project.generate.manifest')
55
+ gen.switch [:m, :manifest], negatable: false
60
56
 
61
- prj.desc t('cli.generate.project.retrieve')
62
- prj.switch [:r, 'retrieve'], negatable: false
57
+ gen.desc t('cli.project.generate.retrieve')
58
+ gen.switch [:r, 'retrieve'], negatable: false
63
59
 
64
- prj.example "alet generate project MyProject", desc: t('cli.generate.project.example.default')
65
- prj.example "alet generate project MyProject -m", desc: t('cli.generate.project.example.manifest')
66
- prj.example "alet generate project MyProject -m -o org", desc: t('cli.generate.project.example.from_org')
67
- prj.example "alet generate project MyProject -mr -o org", desc:t('cli.generate.project.example.retrieve')
60
+ gen.example "alet generate project MyProject", desc: t('cli.project.generate.example.default')
61
+ gen.example "alet generate project MyProject -m", desc: t('cli.project.generate.example.manifest')
62
+ gen.example "alet -o org generate project MyProject -m", desc: t('cli.project.generate.example.from_org')
63
+ gen.example "alet -o org generate project MyProject -mr", desc:t('cli.project.generate.example.retrieve')
68
64
 
69
- prj.action do |_, options, args|
65
+ gen.action do |global_options, _options, args|
66
+ options = global_options.merge _options
70
67
  Alet::Project.generate(args.first, **options)
71
68
  end
72
69
  end
70
+
71
+ prj.desc desc t('cli.project.update.desc')
72
+ prj.command [:update, :u] do |update|
73
+ update.action do |global_options, _options, args|
74
+ options = global_options.merge _options
75
+ Alet::Project.update(args.first, **options)
76
+ end
77
+ end
73
78
  end
74
79
 
75
80
  default_command :irb
@@ -3,45 +3,52 @@ en:
3
3
  desc: A Ruby-styled Salesforce console utility
4
4
  target_org: Username or alias of the target org
5
5
  irb:
6
- desc: start irb session(if there is no subcommand specified, irb gets default)
6
+ desc: Start irb session(if there is no subcommand specified, irb gets default)
7
7
  example:
8
- default: start irb session
9
- target_org: start irb session with specifying target org
10
- generate:
11
- desc: generate resources that are related to Salesforce DX project
12
- project:
13
- desc: generate salesforce DX project
8
+ default: Start irb session
9
+ target_org: Start irb session with specifying target org
10
+ project:
11
+ desc: Create/Update a Salesforce DX project
12
+ open_editor: Open editor(vs code) to edit the project
13
+ generate:
14
+ desc: Generate a salesforce DX project
14
15
  target_org: Username or alias of the target org, which the manifest and source files are generated based on
15
16
  manifest: Generate a manifest (package.xml)
16
17
  retrieve: Retrieve source files from org
17
- open_editor: open editor(vs code) to edit the project
18
18
  example:
19
19
  default: create a Salesfore DX project
20
20
  manifest: create a Salesfore DX project with manifest file (package.xml)
21
21
  from_org: The manifest file is built based on org
22
22
  retrieve: The manifest file and medadata source files are built based on org. This option is only available with -o option.
23
- connection:
24
- description: Current connection with Salesforce
23
+ update:
24
+ desc: Update a salesforce DX project based on current org
25
25
  apex:
26
26
  description: Execute Apex code
27
- gen:
28
- description: Generate sObject classes
27
+ model:
28
+ description: List/Generate sObject classes
29
+ list:
30
+ noclass: No class is generated in this session
31
+ title: 【Generated Classes】
29
32
  help: |
30
33
  ## Name
31
- gen
34
+ model
32
35
 
33
36
  ## SYNOPSIS
34
- gene sObjectType...
37
+ model [list|load sObjectType...]
35
38
 
36
39
  ## DESCRIPTION
37
- generate sObject classes
40
+ 1. show sobject model classes that has been generated already.
41
+ 2. generate classes that represent sobjects.
38
42
 
39
43
  ## ARGUMENTS
40
- **sObjectType** sObject type
44
+ **list** list model classes that has been generated already.
45
+ **load sObjectType...** generate sObject classes
41
46
 
42
47
  ## EXAMPLES
43
48
  ```shell
44
- gen Account Contact User
49
+ model # shows sobject model classes that has been generated already.
50
+ model list # same as above
51
+ model load Account Contact User # load Account, Contact and User sobject classes
45
52
  query:
46
53
  description: Query by SOQL
47
54
  help: |
@@ -102,3 +109,241 @@ en:
102
109
  ```shell
103
110
  export SELECT Id, Name FROM Account
104
111
  ```
112
+ org:
113
+ description: Current connection with Salesforce
114
+ help: |
115
+ ## NAME
116
+ org
117
+
118
+ ## SYNOPSIS
119
+ org
120
+
121
+ ## DESCRIPTION
122
+ show current connection settings
123
+ grep:
124
+ description: find sObject
125
+ help: |
126
+ ## NAME
127
+ grep
128
+
129
+ ## SYNOPSIS
130
+ grep [-ln] regexp
131
+
132
+ ## DESCRIPTION
133
+ find sobject by name or label
134
+
135
+ ## ARGUMENTS
136
+ **regexp** regular expression that indicates name or label
137
+
138
+ ## OPTIONS
139
+ **-l, [---label]** find by only label
140
+ **-n, [---api-name]** find by only api name
141
+
142
+ ## EXAMPLE
143
+ ```shell
144
+ grep Account
145
+ grep -n Account*
146
+ ```
147
+ desc:
148
+ description: show object summary
149
+ table:
150
+ field: Fields
151
+ relation: Relations
152
+ record_type: RecordType
153
+ column:
154
+ label: label
155
+ name: name
156
+ type: type
157
+ relation_name: relation name
158
+ relation_type: relation type
159
+ relation_class: class name
160
+ relation_field: field name
161
+ record_type_name: name
162
+ record_type_id: id
163
+ record_type_developer_name: developer name
164
+ relation_type:
165
+ parent: child-parent
166
+ child: parent-child
167
+ error:
168
+ notfound: Not Found
169
+ help: |
170
+ ## NAME
171
+ desc
172
+
173
+ ## SYNOPSIS
174
+ desc [-rta] object-name
175
+
176
+ ## DESCRIPTION
177
+ show an object summary
178
+
179
+ ## ARGUMENTS
180
+ **object-name** object name
181
+
182
+ ## OPTIONS
183
+ **-r, [---relation]** show relationships
184
+ **-t, [---record-type]** show record types
185
+ **-a, [---all])** show all summary
186
+
187
+ if there is no options only field summary is shown.
188
+
189
+ ## EXAMPLE
190
+ ```shell
191
+ desc Account # show Account's field summary
192
+ desc -r Account # show Account's relationships
193
+ ```
194
+ conn:
195
+ description: connection settings
196
+ invalid_subcommand: invalid subcommand
197
+ help: |
198
+ ## NAME
199
+ conn
200
+
201
+ ## SYNOPSIS
202
+ conn [reset]
203
+
204
+ ## DESCRIPTION
205
+ Show current connection settings when no subcommand is specified. Or reset the connection when "reset" subcommand is executed.
206
+ gen:
207
+ description: generate Salesforce DX project resources
208
+ error:
209
+ no_subcommand: subcommand isn't specified
210
+ invalid_subcommand: invalid subcommand
211
+ file_duplicated: the same component already exists
212
+ help: |
213
+ ## NAME
214
+ gen
215
+
216
+ ## SYNOPSIS
217
+ `gen sub-command ...`
218
+
219
+ ## DESCRIPTION
220
+ generate resources in your local Salesforce DX project
221
+
222
+ ## ARGUMENTS
223
+ you must specify a subcommand and its arguments.
224
+ **apex** generate an Apex class or Apex trigger in local project
225
+ **lwc** generate an lwc in local project
226
+
227
+ ### apex subcommand:
228
+
229
+ #### SYNOPSIS
230
+ `gen apex [-t|-e event1,event2,...|-o object-name] name`
231
+
232
+ #### DESCRIPTION
233
+ generate an Apex class or Apex trigger in local project.
234
+
235
+ #### ARGUMENTS
236
+ `name` the name of the Apex class or Apex trigger
237
+
238
+ #### OPTIONS
239
+ `-t`, `--trigger` generate a trigger
240
+ `-o`, `--sobject` sobject that the trigger works
241
+ `-e`, `--event` events that the trigger works.Available values are: bi, ai, bu, au, bd, ad and aud.If there are multiple values they must join with camma like "bi,bu" (no space).
242
+
243
+ ##### available values of event
244
+
245
+ |value|meaning|
246
+ |bi|before insert|
247
+ |ai|after insert|
248
+ |bu|before update|
249
+ |au|after update|
250
+ |bd|before delete|
251
+ |ad|after delete|
252
+ |aud|after undelete|
253
+
254
+ ## EXAMPLE
255
+ ```shell
256
+ gen apex MyClass1
257
+ gen apex MyTrigger --trigger
258
+ gen apex -t MyTrigger -o Account
259
+ gen apex -t MyTrigger -o Account --event bi,au # generate trigger named MyTrigger that works when before insert and after update on Account object
260
+ ```
261
+
262
+ ### lwc subcommand
263
+
264
+ #### SYNOPSIS
265
+ `gen lwc [-l label|-d description|-e|-t target1,target2,...|-o object1,object2,...] name`
266
+
267
+ #### DESCRIPTION
268
+ generate LWC(Lightning Web Component) files in local project.
269
+
270
+ #### ARGUMENTS
271
+ `name` component name of LWC
272
+
273
+ #### OPTIONS
274
+ `-l`, `--label` specify `masterLabel` section in the xml configulation file.
275
+ `-d`, `--description` specify `description` section in the xml configulation file.
276
+ `-e`, `--exposed` specify `isExposed` section in the xml configulation file. Default is false
277
+ `-t`, `--target` specify `target` section in the xml configulation file.If there are multiple values they must join with camma.
278
+ `-o`, `--object` specify `object` section in the xml configulation file. this options is only available when `target` includes **record**.If there are multiple values they must join with camma.
279
+
280
+ ##### available values of target
281
+
282
+ |value |meaning |
283
+ |app |lightning__AppPage |
284
+ |flow |lightning__FlowScreen |
285
+ |home |lightning__HomePage |
286
+ |action|lightning__RecordAction|
287
+ |record|lightning__RecordPage |
288
+ |tab |lightning__Tab |
289
+ |bar |lightning__UtilityBar |
290
+
291
+ #### EXAMPLE
292
+ ```shell
293
+ gen lwc LWC1
294
+ gen lwc LWC1 -l "my first LWC"
295
+ gen lwc LWC1 -d "this is my first LWC"
296
+ gen lwc LWC1 -t app,home,record
297
+ gen lwc LWC1 -o Account -t record
298
+ ```
299
+
300
+ #### SEE ALSO
301
+ [XML Configuration File Elements](https://developer.salesforce.com/docs/platform/lwc/guide/reference-configuration-tags.html)
302
+ deploy:
303
+ description: deploy project's resources
304
+ error:
305
+ no_arguments: no arguments
306
+ help: |
307
+ ## NAME
308
+ deploy
309
+
310
+ ## SYNOPSIS
311
+ `deploy [-d|-t test1,test2...|-l test-level] component-type component-name...`
312
+
313
+ ## DESCRIPTION
314
+ deploy(upload) local project's files to the Salesforce org
315
+
316
+ ## ARGUMENTS
317
+ `component-type` `file` or metadata type name. for metadata type, some shortcut names are available.
318
+ `component-name` name of the component. if `component-type` is `file` this must be a file path or directory path. If `component-type` is metadata type the name can include wildcard(*)
319
+
320
+ ### shortcut name of metadata type
321
+
322
+ |shortcut name|metadata type|
323
+ |apex|ApexClass|
324
+ |trigger|ApexTrigger|
325
+ |lwc|LightningComponentBundle|
326
+
327
+ you can check all metadata types by sf command (`sf org list metadata-type`)
328
+
329
+ ## OPTIONS
330
+ `-d`, `--dryrun` Validate deploy and run Apex tests but don’t save to the org.
331
+ `-l`, `--test-level` deployment Apex testing level
332
+ `-t`, `--tests` Apex tests to run when --test-level is RunSpecifiedTests. when multiple tests are specified, join them with comma (no space).
333
+ `-m`, `--manifest` deploy files according to manifest file. When this options is specified `component-name` is ignored.
334
+
335
+ ### available test-level value
336
+
337
+ |value|meaning|
338
+ |RunSpecifiedTests|Runs only the tests that you specify with the --tests flag|
339
+ |RunLocalTests|All tests in your org are run, except the ones that originate from installed managed and unlocked packages|
340
+ |RunLocalTests|All tests in your org are run, including tests of managed packages.|
341
+
342
+ ## EXAMPLE
343
+ ```shell
344
+ deploy apex MyClass1
345
+ deploy lwc myLWC
346
+ deploy apex MyClass --test-level RunSpecifiedTests --tests test1,test2
347
+ deploy file -m manifest/package.xml
348
+ deploy file force-app/main/default/class/MyClass1.cls
349
+ ```