shopify-cli 1.0.0 → 1.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/.travis.yml +3 -2
- data/CHANGELOG.md +20 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +13 -13
- data/docs/Gemfile.lock +23 -13
- data/docs/getting-started/install/index.md +37 -1
- data/docs/getting-started/migrate/index.md +34 -1
- data/lib/project_types/extension/cli.rb +1 -1
- data/lib/project_types/extension/commands/build.rb +1 -1
- data/lib/project_types/extension/models/type.rb +1 -0
- data/lib/project_types/extension/tasks/create_extension.rb +1 -1
- data/lib/project_types/extension/tasks/get_app.rb +1 -1
- data/lib/project_types/extension/tasks/update_draft.rb +1 -1
- data/lib/project_types/node/forms/create.rb +3 -54
- data/lib/project_types/node/messages/messages.rb +3 -14
- data/lib/project_types/rails/cli.rb +0 -1
- data/lib/project_types/rails/forms/create.rb +3 -52
- data/lib/project_types/rails/messages/messages.rb +2 -13
- data/lib/project_types/script/cli.rb +2 -3
- data/lib/project_types/script/commands/create.rb +5 -9
- data/lib/project_types/script/commands/disable.rb +4 -15
- data/lib/project_types/script/commands/enable.rb +37 -13
- data/lib/project_types/script/commands/push.rb +8 -13
- data/lib/project_types/script/config/extension_points.yml +9 -3
- data/lib/project_types/script/errors.rb +8 -0
- data/lib/project_types/script/forms/script_form.rb +5 -2
- data/lib/project_types/script/layers/application/create_script.rb +7 -6
- data/lib/project_types/script/layers/application/disable_script.rb +9 -7
- data/lib/project_types/script/layers/application/enable_script.rb +11 -9
- data/lib/project_types/script/layers/application/push_script.rb +6 -4
- data/lib/project_types/script/layers/domain/errors.rb +2 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
- data/lib/project_types/script/messages/messages.rb +25 -31
- data/lib/project_types/script/script_project.rb +8 -4
- data/lib/project_types/script/templates/ts/as-pect.config.js +6 -0
- data/lib/project_types/script/ui/error_handler.rb +8 -0
- data/lib/project_types/script/ui/printing_spinner.rb +75 -0
- data/lib/shopify-cli/admin_api.rb +1 -2
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +10 -1
- data/lib/shopify-cli/admin_api/schema.rb +20 -8
- data/lib/shopify-cli/command.rb +14 -11
- data/lib/shopify-cli/commands.rb +1 -0
- data/lib/shopify-cli/commands/config.rb +44 -0
- data/lib/shopify-cli/commands/connect.rb +8 -69
- data/lib/shopify-cli/commands/create.rb +2 -2
- data/lib/shopify-cli/commands/help.rb +1 -1
- data/lib/shopify-cli/commands/system.rb +14 -6
- data/lib/shopify-cli/context.rb +10 -1
- data/lib/shopify-cli/core.rb +0 -1
- data/lib/shopify-cli/core/entry_point.rb +7 -1
- data/lib/shopify-cli/core/executor.rb +3 -5
- data/lib/shopify-cli/core/finalize.rb +13 -0
- data/lib/shopify-cli/core/monorail.rb +1 -1
- data/lib/shopify-cli/db.rb +1 -1
- data/lib/shopify-cli/feature.rb +97 -0
- data/lib/shopify-cli/heroku.rb +4 -4
- data/lib/shopify-cli/messages/messages.rb +51 -12
- data/lib/shopify-cli/partners_api/organizations.rb +7 -7
- data/lib/shopify-cli/process_supervision.rb +8 -6
- data/lib/shopify-cli/project_type.rb +5 -7
- data/lib/shopify-cli/sub_command.rb +1 -0
- data/lib/shopify-cli/task.rb +2 -2
- data/lib/shopify-cli/tasks.rb +12 -4
- data/lib/shopify-cli/tasks/ensure_env.rb +72 -16
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +77 -0
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +4 -3
- data/lib/shopify-cli/tunnel.rb +38 -14
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +32 -9
- metadata +7 -4
- data/lib/project_types/script/forms/enable.rb +0 -24
- data/lib/project_types/script/forms/push.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b05da9533ccffc11607217b455d2a23590668a445a0af58c67c168fe5a5dfe96
|
4
|
+
data.tar.gz: e10408bf78ac963dd50953edbf438bc4dbf247d0001db8a1b1013b0f981189f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7626a67bc6ba0fe13b6223b4239927e4f4e39c74a2536e7fe0a38b4403d9c115771a913c4921d28a81175de84c1cc9e7fc9b84e046042a5957ba9f3aa1d56d7d
|
7
|
+
data.tar.gz: 630008b941f6c034f51fcdb370f6dd09dba5bcb18a44b5bd1035367443bdc28d679adf69ee9e0f3a9417ddfcbef473411d99934a9a14fc777310edf67677711c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
Version 1.0.5
|
2
|
+
------
|
3
|
+
* Fix a bug in out opt-in metrics
|
4
|
+
|
5
|
+
Version 1.0.4
|
6
|
+
------
|
7
|
+
* Fix a bug when running the `connect` command with an account with multiple organizations
|
8
|
+
|
9
|
+
Version 1.0.3
|
10
|
+
------
|
11
|
+
* Fix a bug which causes an error in the `populate` and `generate` commands when prompting for the shop name
|
12
|
+
|
13
|
+
Version 1.0.2
|
14
|
+
------
|
15
|
+
* Fix missing shop parameter to AdminAPI.query() call (impacting populate and generate commands)
|
16
|
+
|
17
|
+
Version 1.0.1
|
18
|
+
------
|
19
|
+
* Fixed an issue with RVM taking over the shell shim fd when it was not in use
|
20
|
+
|
1
21
|
Version 1.0.0
|
2
22
|
------
|
3
23
|
* Release the installer-based version of the CLI
|
data/Gemfile
CHANGED
@@ -16,7 +16,7 @@ group :test do
|
|
16
16
|
gem 'mocha', require: false
|
17
17
|
gem 'minitest', '>= 5.0.0', require: false
|
18
18
|
gem 'minitest-reporters', require: false
|
19
|
-
gem 'fakefs', require: false
|
19
|
+
gem 'fakefs', '>= 1.0', require: false
|
20
20
|
gem 'webmock', require: false
|
21
21
|
gem 'timecop', require: false
|
22
22
|
end
|
data/Gemfile.lock
CHANGED
@@ -4,13 +4,13 @@ GEM
|
|
4
4
|
addressable (2.5.2)
|
5
5
|
public_suffix (>= 2.0.2, < 4.0)
|
6
6
|
ansi (1.5.0)
|
7
|
-
ast (2.4.
|
7
|
+
ast (2.4.1)
|
8
8
|
builder (3.2.3)
|
9
|
-
byebug (8.2.
|
9
|
+
byebug (8.2.5)
|
10
10
|
coderay (1.1.2)
|
11
11
|
crack (0.4.3)
|
12
12
|
safe_yaml (~> 1.0.0)
|
13
|
-
fakefs (
|
13
|
+
fakefs (1.2.2)
|
14
14
|
hashdiff (0.3.2)
|
15
15
|
metaclass (0.0.4)
|
16
16
|
method_source (0.9.2)
|
@@ -22,9 +22,9 @@ GEM
|
|
22
22
|
ruby-progressbar
|
23
23
|
mocha (1.7.0)
|
24
24
|
metaclass (~> 0.0.1)
|
25
|
-
parallel (1.19.
|
26
|
-
parser (2.7.1.
|
27
|
-
ast (~> 2.4.
|
25
|
+
parallel (1.19.2)
|
26
|
+
parser (2.7.1.4)
|
27
|
+
ast (~> 2.4.1)
|
28
28
|
pry (0.12.2)
|
29
29
|
coderay (~> 1.1.0)
|
30
30
|
method_source (~> 0.9.0)
|
@@ -34,19 +34,19 @@ GEM
|
|
34
34
|
public_suffix (3.0.3)
|
35
35
|
rainbow (3.0.0)
|
36
36
|
rake (13.0.1)
|
37
|
-
regexp_parser (1.7.
|
37
|
+
regexp_parser (1.7.1)
|
38
38
|
rexml (3.2.4)
|
39
|
-
rubocop (0.
|
39
|
+
rubocop (0.89.1)
|
40
40
|
parallel (~> 1.10)
|
41
|
-
parser (>= 2.7.
|
41
|
+
parser (>= 2.7.1.1)
|
42
42
|
rainbow (>= 2.2.2, < 4.0)
|
43
43
|
regexp_parser (>= 1.7)
|
44
44
|
rexml
|
45
|
-
rubocop-ast (>= 0.0.
|
45
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
46
46
|
ruby-progressbar (~> 1.7)
|
47
47
|
unicode-display_width (>= 1.4.0, < 2.0)
|
48
|
-
rubocop-ast (0.0
|
49
|
-
parser (>= 2.7.
|
48
|
+
rubocop-ast (0.3.0)
|
49
|
+
parser (>= 2.7.1.4)
|
50
50
|
ruby-progressbar (1.10.1)
|
51
51
|
safe_yaml (1.0.4)
|
52
52
|
session (3.2.0)
|
@@ -62,7 +62,7 @@ PLATFORMS
|
|
62
62
|
|
63
63
|
DEPENDENCIES
|
64
64
|
byebug
|
65
|
-
fakefs
|
65
|
+
fakefs (>= 1.0)
|
66
66
|
minitest (>= 5.0.0)
|
67
67
|
minitest-reporters
|
68
68
|
mocha
|
data/docs/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (6.0.3.
|
4
|
+
activesupport (6.0.3.2)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
@@ -16,9 +16,9 @@ GEM
|
|
16
16
|
colorator (1.1.0)
|
17
17
|
commonmarker (0.17.13)
|
18
18
|
ruby-enum (~> 0.5)
|
19
|
-
concurrent-ruby (1.1.
|
20
|
-
dnsruby (1.61.
|
21
|
-
|
19
|
+
concurrent-ruby (1.1.7)
|
20
|
+
dnsruby (1.61.4)
|
21
|
+
simpleidn (~> 0.1)
|
22
22
|
em-websocket (0.5.1)
|
23
23
|
eventmachine (>= 0.12.9)
|
24
24
|
http_parser.rb (~> 0.6.0)
|
@@ -28,12 +28,12 @@ GEM
|
|
28
28
|
execjs (2.7.0)
|
29
29
|
faraday (1.0.1)
|
30
30
|
multipart-post (>= 1.2, < 3)
|
31
|
-
ffi (1.13.
|
31
|
+
ffi (1.13.1)
|
32
32
|
forwardable-extended (2.6.0)
|
33
33
|
gemoji (3.0.1)
|
34
|
-
github-pages (
|
34
|
+
github-pages (207)
|
35
35
|
github-pages-health-check (= 1.16.1)
|
36
|
-
jekyll (= 3.
|
36
|
+
jekyll (= 3.9.0)
|
37
37
|
jekyll-avatar (= 0.7.0)
|
38
38
|
jekyll-coffeescript (= 1.1.1)
|
39
39
|
jekyll-commonmark-ghpages (= 0.1.6)
|
@@ -67,7 +67,8 @@ GEM
|
|
67
67
|
jekyll-theme-time-machine (= 0.1.1)
|
68
68
|
jekyll-titles-from-headings (= 0.5.3)
|
69
69
|
jemoji (= 0.11.1)
|
70
|
-
kramdown (=
|
70
|
+
kramdown (= 2.3.0)
|
71
|
+
kramdown-parser-gfm (= 1.1.0)
|
71
72
|
liquid (= 4.0.3)
|
72
73
|
mercenary (~> 0.3)
|
73
74
|
minima (= 2.5.1)
|
@@ -86,14 +87,14 @@ GEM
|
|
86
87
|
http_parser.rb (0.6.0)
|
87
88
|
i18n (0.9.5)
|
88
89
|
concurrent-ruby (~> 1.0)
|
89
|
-
jekyll (3.
|
90
|
+
jekyll (3.9.0)
|
90
91
|
addressable (~> 2.4)
|
91
92
|
colorator (~> 1.0)
|
92
93
|
em-websocket (~> 0.5)
|
93
94
|
i18n (~> 0.7)
|
94
95
|
jekyll-sass-converter (~> 1.0)
|
95
96
|
jekyll-watch (~> 2.0)
|
96
|
-
kramdown (
|
97
|
+
kramdown (>= 1.17, < 3)
|
97
98
|
liquid (~> 4.0)
|
98
99
|
mercenary (~> 0.3.3)
|
99
100
|
pathutil (~> 0.9)
|
@@ -191,7 +192,10 @@ GEM
|
|
191
192
|
gemoji (~> 3.0)
|
192
193
|
html-pipeline (~> 2.2)
|
193
194
|
jekyll (>= 3.0, < 5.0)
|
194
|
-
kramdown (
|
195
|
+
kramdown (2.3.0)
|
196
|
+
rexml
|
197
|
+
kramdown-parser-gfm (1.1.0)
|
198
|
+
kramdown (~> 2.0)
|
195
199
|
liquid (4.0.3)
|
196
200
|
listen (3.2.1)
|
197
201
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
@@ -204,7 +208,7 @@ GEM
|
|
204
208
|
jekyll-seo-tag (~> 2.1)
|
205
209
|
minitest (5.14.1)
|
206
210
|
multipart-post (2.1.1)
|
207
|
-
nokogiri (1.10.
|
211
|
+
nokogiri (1.10.10)
|
208
212
|
mini_portile2 (~> 2.4.0)
|
209
213
|
octokit (4.18.0)
|
210
214
|
faraday (>= 0.9)
|
@@ -215,6 +219,7 @@ GEM
|
|
215
219
|
rb-fsevent (0.10.4)
|
216
220
|
rb-inotify (0.10.1)
|
217
221
|
ffi (~> 1.0)
|
222
|
+
rexml (3.2.4)
|
218
223
|
rouge (3.19.0)
|
219
224
|
ruby-enum (0.8.0)
|
220
225
|
i18n
|
@@ -228,6 +233,8 @@ GEM
|
|
228
233
|
sawyer (0.8.2)
|
229
234
|
addressable (>= 2.3.5)
|
230
235
|
faraday (> 0.8, < 2.0)
|
236
|
+
simpleidn (0.1.1)
|
237
|
+
unf (~> 0.1.4)
|
231
238
|
terminal-table (1.8.0)
|
232
239
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
233
240
|
thread_safe (0.3.6)
|
@@ -235,8 +242,11 @@ GEM
|
|
235
242
|
ethon (>= 0.9.0)
|
236
243
|
tzinfo (1.2.7)
|
237
244
|
thread_safe (~> 0.1)
|
245
|
+
unf (0.1.4)
|
246
|
+
unf_ext
|
247
|
+
unf_ext (0.0.7.7)
|
238
248
|
unicode-display_width (1.7.0)
|
239
|
-
zeitwerk (2.
|
249
|
+
zeitwerk (2.4.0)
|
240
250
|
|
241
251
|
PLATFORMS
|
242
252
|
ruby
|
@@ -36,4 +36,40 @@ $ sudo yum install shopify-cli-x.y.x.rpm
|
|
36
36
|
|
37
37
|
```console
|
38
38
|
$ gem install shopify-cli
|
39
|
-
```
|
39
|
+
```
|
40
|
+
|
41
|
+
### To check that Shopify App CLI is installed correctly:
|
42
|
+
|
43
|
+
```console
|
44
|
+
$ shopify version
|
45
|
+
1.0.0
|
46
|
+
$
|
47
|
+
```
|
48
|
+
|
49
|
+
> Note 1: the version displayed may be newer.
|
50
|
+
|
51
|
+
> Note 2: If you have the `shopify_api` gem installed, you may see the following response:
|
52
|
+
> ```console
|
53
|
+
> shopify command is no longer bundled with shopify_api.
|
54
|
+
> if you need these tools, install the shopify_cli gem
|
55
|
+
> ```
|
56
|
+
>
|
57
|
+
> If so, then you will also need to upgrade the `shopify_api` gem to v9.2.0+ to remove a deprecated `shopify` command that is contained in that gem.
|
58
|
+
>
|
59
|
+
> If you also have the `shopify_app` gem (which depends on `shopify_api` gem), you'll need to install or update `shopify_api` first, then uninstall the older version.
|
60
|
+
>
|
61
|
+
> To get a list of the version(s) of `shopify_api` currently installed:
|
62
|
+
> ```console
|
63
|
+
> $ gem list shopify_api
|
64
|
+
> ```
|
65
|
+
>
|
66
|
+
> To install the latest version:
|
67
|
+
> ```console
|
68
|
+
> $ gem install shopify_api
|
69
|
+
> ```
|
70
|
+
>
|
71
|
+
> To uninstall the older version:
|
72
|
+
> ```console
|
73
|
+
> $ gem uninstall shopify_api -v x.y.z
|
74
|
+
> ```
|
75
|
+
> Replace x.y.z with a version number listed from the `gem list` command. Repeat as needed.
|
@@ -22,6 +22,7 @@ There are two steps to completely uninstall the legacy version of Shopify App CL
|
|
22
22
|
|
23
23
|
1. Delete the legacy CLI files
|
24
24
|
1. Remove the legacy `shopify` command from your shell profile
|
25
|
+
1. Reload your terminal
|
25
26
|
|
26
27
|
### 1. Delete the CLI files
|
27
28
|
|
@@ -51,7 +52,39 @@ if [[ -f /HOME_DIR/.shopify-cli/shopify.sh ]]; then source /HOME_DIR/.shopify-cl
|
|
51
52
|
[ -f "/HOME_DIR/.shopify-app-cli/shopify.sh" ] && source "/HOME_DIR/.shopify-app-cli/shopify.sh"
|
52
53
|
```
|
53
54
|
|
54
|
-
Deleting or commenting out the relevant line in your shell profile will remove `shopify` as a command.
|
55
|
+
Deleting or commenting out the relevant line in your shell profile will remove `shopify` as a command.
|
56
|
+
|
57
|
+
### 3. Reload your terminal
|
58
|
+
|
59
|
+
For the changes above to take effect, exit your terminal, and start a new one.
|
60
|
+
|
61
|
+
If you try running `shopify` now, you should get a `command not found` error.
|
62
|
+
|
63
|
+
> If you have the `shopify_api` gem installed, you may see the following response:
|
64
|
+
> ```console
|
65
|
+
> shopify command is no longer bundled with shopify_api.
|
66
|
+
> if you need these tools, install the shopify_cli gem
|
67
|
+
> ```
|
68
|
+
>
|
69
|
+
> If so, then you will also need to upgrade the `shopify_api` gem to v9.2.0+ to remove a deprecated `shopify` command that is contained in that gem.
|
70
|
+
>
|
71
|
+
> If you also have the `shopify_app` gem (which depends on `shopify_api` gem), you'll need to install or update `shopify_api` first, then uninstall the older version.
|
72
|
+
>
|
73
|
+
> To get a list of the version(s) of `shopify_api` currently installed:
|
74
|
+
> ```console
|
75
|
+
> $ gem list shopify_api
|
76
|
+
> ```
|
77
|
+
>
|
78
|
+
> To install the latest version:
|
79
|
+
> ```console
|
80
|
+
> $ gem install shopify_api
|
81
|
+
> ```
|
82
|
+
>
|
83
|
+
> To uninstall the older version:
|
84
|
+
> ```console
|
85
|
+
> $ gem uninstall shopify_api -v x.y.z
|
86
|
+
> ```
|
87
|
+
> Replace x.y.z with a version number listed from the `gem list` command. Repeat as needed.
|
55
88
|
|
56
89
|
## 2. Install the new version
|
57
90
|
|
@@ -20,7 +20,7 @@ module Extension
|
|
20
20
|
extension_context: extension_context,
|
21
21
|
}
|
22
22
|
|
23
|
-
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, input).dig(*RESPONSE_FIELD)
|
23
|
+
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
|
24
24
|
context.abort(context.message('tasks.errors.parse_error')) if response.nil?
|
25
25
|
|
26
26
|
abort_if_user_errors(context, response)
|
@@ -12,7 +12,7 @@ module Extension
|
|
12
12
|
def call(context:, api_key:)
|
13
13
|
input = { api_key: api_key }
|
14
14
|
|
15
|
-
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, input).dig(*RESPONSE_FIELD)
|
15
|
+
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
|
16
16
|
context.abort(context.message('tasks.errors.parse_error')) if response.nil?
|
17
17
|
|
18
18
|
Converters::AppConverter.from_hash(response.dig(APP_FIELD))
|
@@ -18,7 +18,7 @@ module Extension
|
|
18
18
|
config: JSON.generate(config),
|
19
19
|
extension_context: extension_context,
|
20
20
|
}
|
21
|
-
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, input).dig(*RESPONSE_FIELD)
|
21
|
+
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
|
22
22
|
context.abort(context.message('tasks.errors.parse_error')) if response.nil?
|
23
23
|
|
24
24
|
abort_if_user_errors(context, response)
|
@@ -10,8 +10,9 @@ module Node
|
|
10
10
|
self.title ||= CLI::UI::Prompt.ask(ctx.message('node.forms.create.app_name'))
|
11
11
|
self.type = ask_type
|
12
12
|
self.name = self.title.downcase.split(" ").join("_")
|
13
|
-
|
14
|
-
self.
|
13
|
+
res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
|
14
|
+
self.organization_id = res[:organization_id]
|
15
|
+
self.shop_domain = res[:shop_domain]
|
15
16
|
end
|
16
17
|
|
17
18
|
private
|
@@ -30,58 +31,6 @@ module Node
|
|
30
31
|
ctx.puts(ctx.message('node.forms.create.app_type.selected', type))
|
31
32
|
type
|
32
33
|
end
|
33
|
-
|
34
|
-
def organizations
|
35
|
-
@organizations ||= ShopifyCli::PartnersAPI::Organizations.fetch_all(ctx)
|
36
|
-
end
|
37
|
-
|
38
|
-
def organization
|
39
|
-
@organization ||= if !organization_id.nil?
|
40
|
-
org = ShopifyCli::PartnersAPI::Organizations.fetch(ctx, id: organization_id)
|
41
|
-
if org.nil?
|
42
|
-
ctx.puts(ctx.message('node.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
43
|
-
ctx.abort(ctx.message('node.forms.create.error.organization_not_found'))
|
44
|
-
end
|
45
|
-
org
|
46
|
-
elsif organizations.count == 0
|
47
|
-
ctx.puts(ctx.message('node.forms.create.partners_notice'))
|
48
|
-
ctx.puts(ctx.message('node.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
49
|
-
ctx.abort(ctx.message('node.forms.create.error.no_organizations'))
|
50
|
-
elsif organizations.count == 1
|
51
|
-
org = organizations.first
|
52
|
-
ctx.puts(ctx.message('node.forms.create.organization',
|
53
|
-
ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
|
54
|
-
org
|
55
|
-
else
|
56
|
-
org_id = CLI::UI::Prompt.ask(ctx.message('node.forms.create.organization_select')) do |handler|
|
57
|
-
organizations.each do |o|
|
58
|
-
handler.option(ctx.message('core.partners_api.org_name_and_id', o['businessName'], o['id'])) { o['id'] }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
organizations.find { |o| o['id'] == org_id }
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def ask_shop_domain
|
66
|
-
valid_stores = organization['stores'].select do |store|
|
67
|
-
store['transferDisabled'] == true || store['convertableToPartnerTest'] == true
|
68
|
-
end
|
69
|
-
|
70
|
-
if valid_stores.count == 0
|
71
|
-
ctx.puts(ctx.message('node.forms.create.no_development_stores'))
|
72
|
-
ctx.puts(ctx.message('node.forms.create.create_store', organization['id']))
|
73
|
-
ctx.puts(ctx.message('node.forms.create.authentication_issue', ShopifyCli::TOOL_NAME))
|
74
|
-
elsif valid_stores.count == 1
|
75
|
-
domain = valid_stores.first['shopDomain']
|
76
|
-
ctx.puts(ctx.message('node.forms.create.development_store', domain))
|
77
|
-
domain
|
78
|
-
else
|
79
|
-
CLI::UI::Prompt.ask(
|
80
|
-
ctx.message('node.forms.create.development_store_select'),
|
81
|
-
options: valid_stores.map { |s| s['shopDomain'] }
|
82
|
-
)
|
83
|
-
end
|
84
|
-
end
|
85
34
|
end
|
86
35
|
end
|
87
36
|
end
|