shopify-cli 1.13.1 → 2.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.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -1
- data/.github/CONTRIBUTING.md +7 -7
- data/.github/DESIGN.md +3 -3
- data/.github/workflows/build.yml +1 -1
- data/.gitignore +3 -0
- data/.rubocop.yml +3 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +60 -26
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +4 -1
- data/README.md +94 -26
- data/RELEASING.md +31 -7
- data/Rakefile +2 -2
- data/SECURITY.md +1 -1
- data/THEMEKIT_MIGRATION.md +18 -0
- data/bin/load_shopify.rb +1 -1
- data/bin/shopify +3 -3
- data/dev.yml +1 -1
- data/docs/app/node/index.md +1 -1
- data/docs/app/rails/index.md +1 -1
- data/docs/core/index.md +1 -1
- data/docs/getting-started/index.md +1 -1
- data/docs/getting-started/install/index.md +1 -1
- data/docs/getting-started/migrate/index.md +1 -1
- data/docs/getting-started/uninstall/index.md +1 -1
- data/docs/getting-started/upgrade/index.md +1 -1
- data/docs/help/start-app/index.md +1 -1
- data/docs/index.md +1 -1
- data/ext/shopify-cli/extconf.rb +17 -5
- data/install.sh +1 -1
- data/lib/docgen/index_template.md.erb +2 -2
- data/lib/graphql/all_orgs_with_extensions.graphql +37 -0
- data/lib/graphql/api_versions.graphql +1 -1
- data/lib/graphql/find_organization.graphql +2 -1
- data/lib/project_types/extension/cli.rb +19 -15
- data/lib/project_types/extension/commands/build.rb +4 -5
- data/lib/project_types/extension/commands/check.rb +44 -0
- data/lib/project_types/extension/commands/connect.rb +35 -0
- data/lib/project_types/extension/commands/create.rb +12 -16
- data/lib/project_types/extension/commands/extension_command.rb +2 -2
- data/lib/project_types/extension/commands/info.rb +86 -0
- data/lib/project_types/extension/commands/push.rb +8 -7
- data/lib/project_types/extension/commands/register.rb +4 -5
- data/lib/project_types/extension/commands/serve.rb +5 -8
- data/lib/project_types/extension/commands/tunnel.rb +3 -1
- data/lib/project_types/extension/errors.rb +9 -0
- data/lib/project_types/extension/extension_project.rb +24 -1
- data/lib/project_types/extension/extension_project_keys.rb +1 -0
- data/lib/project_types/extension/features/argo.rb +6 -6
- data/lib/project_types/extension/features/argo_runtime.rb +22 -66
- data/lib/project_types/extension/features/argo_serve.rb +25 -18
- data/lib/project_types/extension/forms/connect.rb +42 -0
- data/lib/project_types/extension/forms/questions/ask_name.rb +14 -6
- data/lib/project_types/extension/forms/questions/ask_registration.rb +51 -0
- data/lib/project_types/extension/messages/messages.rb +84 -16
- data/lib/project_types/extension/models/specification.rb +1 -0
- data/lib/project_types/extension/models/specification_handlers/{checkout_argo_extension.rb → checkout_ui_extension.rb} +3 -1
- data/lib/project_types/extension/models/specification_handlers/default.rb +13 -3
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +89 -0
- data/lib/project_types/extension/models/specifications.rb +1 -0
- data/lib/project_types/extension/tasks/configure_features.rb +6 -7
- data/lib/project_types/extension/tasks/configure_options.rb +20 -0
- data/lib/project_types/extension/tasks/get_extensions.rb +32 -0
- data/lib/project_types/node/cli.rb +9 -21
- data/lib/project_types/node/commands/connect.rb +8 -2
- data/lib/project_types/node/commands/create.rb +9 -5
- data/lib/project_types/node/commands/deploy.rb +15 -5
- data/lib/project_types/node/commands/deploy/heroku.rb +29 -29
- data/lib/project_types/node/commands/generate.rb +4 -2
- data/lib/project_types/node/commands/open.rb +4 -2
- data/lib/project_types/node/commands/serve.rb +3 -2
- data/lib/project_types/node/commands/tunnel.rb +4 -2
- data/lib/project_types/node/messages/messages.rb +47 -90
- data/lib/project_types/rails/cli.rb +9 -21
- data/lib/project_types/rails/commands/connect.rb +8 -2
- data/lib/project_types/rails/commands/create.rb +10 -6
- data/lib/project_types/rails/commands/deploy.rb +15 -5
- data/lib/project_types/rails/commands/deploy/heroku.rb +84 -82
- data/lib/project_types/rails/commands/generate.rb +15 -5
- data/lib/project_types/rails/commands/generate/webhook.rb +28 -26
- data/lib/project_types/rails/commands/open.rb +4 -2
- data/lib/project_types/rails/commands/serve.rb +3 -2
- data/lib/project_types/rails/commands/tunnel.rb +4 -2
- data/lib/project_types/rails/messages/messages.rb +72 -119
- data/lib/project_types/script/cli.rb +6 -8
- data/lib/project_types/script/commands/create.rb +3 -1
- data/lib/project_types/script/commands/push.rb +7 -4
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +9 -3
- data/lib/project_types/script/layers/application/create_script.rb +4 -3
- data/lib/project_types/script/layers/domain/errors.rb +6 -11
- data/lib/project_types/script/layers/domain/push_package.rb +4 -8
- data/lib/project_types/script/layers/domain/script_json.rb +32 -0
- data/lib/project_types/script/layers/domain/script_project.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +13 -17
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +29 -21
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -4
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -34
- data/lib/project_types/script/layers/infrastructure/script_service.rb +37 -16
- data/lib/project_types/script/messages/messages.rb +64 -54
- data/lib/project_types/script/tasks/ensure_env.rb +3 -1
- data/lib/project_types/script/ui/error_handler.rb +32 -32
- data/lib/project_types/theme/cli.rb +16 -27
- data/lib/project_types/theme/commands/check.rb +33 -0
- data/lib/project_types/theme/commands/delete.rb +64 -0
- data/lib/project_types/theme/commands/init.rb +42 -0
- data/lib/project_types/theme/commands/language_server.rb +16 -0
- data/lib/project_types/theme/commands/package.rb +55 -0
- data/lib/project_types/theme/commands/publish.rb +43 -0
- data/lib/project_types/theme/commands/pull.rb +51 -0
- data/lib/project_types/theme/commands/push.rb +58 -32
- data/lib/project_types/theme/commands/serve.rb +8 -16
- data/lib/project_types/theme/forms/confirm_store.rb +15 -0
- data/lib/project_types/theme/forms/select.rb +59 -0
- data/lib/project_types/theme/messages/messages.rb +118 -103
- data/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
- data/lib/shopify-cli/admin_api.rb +57 -38
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +6 -14
- data/lib/shopify-cli/admin_api/schema.rb +1 -10
- data/lib/shopify-cli/api.rb +29 -14
- data/lib/shopify-cli/command.rb +15 -3
- data/lib/shopify-cli/commands.rb +7 -2
- data/lib/shopify-cli/commands/help.rb +2 -29
- data/lib/shopify-cli/commands/login.rb +95 -0
- data/lib/shopify-cli/commands/logout.rb +24 -8
- data/lib/shopify-cli/commands/populate.rb +23 -0
- data/lib/{project_types/node → shopify-cli}/commands/populate/customer.rb +2 -8
- data/lib/{project_types/node → shopify-cli}/commands/populate/draft_order.rb +2 -2
- data/lib/{project_types/node → shopify-cli}/commands/populate/product.rb +2 -8
- data/lib/shopify-cli/commands/store.rb +15 -0
- data/lib/shopify-cli/commands/switch.rb +39 -0
- data/lib/shopify-cli/commands/system.rb +12 -0
- data/lib/shopify-cli/commands/whoami.rb +28 -0
- data/lib/shopify-cli/connect.rb +32 -0
- data/lib/shopify-cli/context.rb +65 -4
- data/lib/shopify-cli/core/entry_point.rb +3 -22
- data/lib/shopify-cli/core/monorail.rb +6 -2
- data/lib/shopify-cli/db.rb +4 -4
- data/lib/shopify-cli/http_request.rb +16 -0
- data/lib/shopify-cli/identity_auth.rb +282 -0
- data/lib/shopify-cli/{oauth → identity_auth}/servlet.rb +11 -12
- data/lib/shopify-cli/messages/messages.rb +140 -46
- data/lib/shopify-cli/packager.rb +5 -5
- data/lib/shopify-cli/partners_api.rb +21 -44
- data/lib/shopify-cli/partners_api/organizations.rb +8 -0
- data/lib/shopify-cli/project_commands.rb +16 -0
- data/lib/shopify-cli/project_type.rb +0 -31
- data/lib/shopify-cli/shopifolk.rb +8 -11
- data/lib/shopify-cli/sub_command.rb +1 -0
- data/lib/shopify-cli/tasks.rb +3 -0
- data/lib/shopify-cli/tasks/confirm_store.rb +18 -0
- data/lib/shopify-cli/tasks/create_api_client.rb +2 -2
- data/lib/shopify-cli/tasks/ensure_authenticated.rb +13 -0
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +1 -1
- data/lib/shopify-cli/tasks/ensure_project_type.rb +12 -0
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +0 -3
- data/lib/shopify-cli/theme/dev_server.rb +98 -0
- data/lib/shopify-cli/theme/dev_server/certificate_manager.rb +79 -0
- data/lib/shopify-cli/theme/dev_server/header_hash.rb +94 -0
- data/lib/shopify-cli/theme/dev_server/hot-reload.js +93 -0
- data/lib/shopify-cli/theme/dev_server/hot_reload.rb +76 -0
- data/lib/shopify-cli/theme/dev_server/local_assets.rb +87 -0
- data/lib/shopify-cli/theme/dev_server/proxy.rb +205 -0
- data/lib/shopify-cli/theme/dev_server/sse.rb +75 -0
- data/lib/shopify-cli/theme/dev_server/watcher.rb +59 -0
- data/lib/shopify-cli/theme/dev_server/web_server.rb +140 -0
- data/lib/shopify-cli/theme/development_theme.rb +69 -0
- data/lib/shopify-cli/theme/file.rb +112 -0
- data/lib/shopify-cli/theme/ignore_filter.rb +109 -0
- data/lib/shopify-cli/theme/mime_type.rb +34 -0
- data/lib/shopify-cli/theme/syncer.rb +332 -0
- data/lib/shopify-cli/theme/theme.rb +204 -0
- data/lib/shopify-cli/tunnel.rb +1 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +18 -11
- data/shopify-cli.gemspec +12 -5
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- metadata +92 -35
- data/.github/workflows/release.yml +0 -59
- data/lib/project_types/extension/features/argo_serve_options.rb +0 -42
- data/lib/project_types/node/commands/populate.rb +0 -23
- data/lib/project_types/rails/commands/populate.rb +0 -23
- data/lib/project_types/rails/commands/populate/customer.rb +0 -31
- data/lib/project_types/rails/commands/populate/draft_order.rb +0 -28
- data/lib/project_types/rails/commands/populate/product.rb +0 -30
- data/lib/project_types/script/layers/domain/config_ui.rb +0 -16
- data/lib/project_types/theme/commands/connect.rb +0 -54
- data/lib/project_types/theme/commands/create.rb +0 -48
- data/lib/project_types/theme/commands/deploy.rb +0 -38
- data/lib/project_types/theme/commands/generate.rb +0 -20
- data/lib/project_types/theme/commands/generate/env.rb +0 -79
- data/lib/project_types/theme/forms/connect.rb +0 -34
- data/lib/project_types/theme/forms/create.rb +0 -22
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +0 -78
- data/lib/project_types/theme/themekit.rb +0 -113
- data/lib/shopify-cli/commands/connect.rb +0 -64
- data/lib/shopify-cli/commands/create.rb +0 -50
- data/lib/shopify-cli/oauth.rb +0 -198
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
require "shopify_cli"
|
|
2
2
|
|
|
3
3
|
module Node
|
|
4
|
-
|
|
5
|
-
class Open < ShopifyCli::
|
|
4
|
+
class Command
|
|
5
|
+
class Open < ShopifyCli::SubCommand
|
|
6
|
+
prerequisite_task ensure_project_type: :node
|
|
7
|
+
|
|
6
8
|
def call(*)
|
|
7
9
|
project = ShopifyCli::Project.current
|
|
8
10
|
@ctx.open_url!("#{project.env.host}/auth?shop=#{project.env.shop}")
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Node
|
|
3
|
-
|
|
4
|
-
class Serve < ShopifyCli::
|
|
3
|
+
class Command
|
|
4
|
+
class Serve < ShopifyCli::SubCommand
|
|
5
|
+
prerequisite_task ensure_project_type: :node
|
|
5
6
|
prerequisite_task :ensure_env, :ensure_dev_store
|
|
6
7
|
|
|
7
8
|
options do |parser, flags|
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
require "shopify_cli"
|
|
4
4
|
|
|
5
5
|
module Node
|
|
6
|
-
|
|
7
|
-
class Tunnel < ShopifyCli::
|
|
6
|
+
class Command
|
|
7
|
+
class Tunnel < ShopifyCli::SubCommand
|
|
8
8
|
# subcommands :auth, :start, :stop
|
|
9
9
|
|
|
10
|
+
prerequisite_task ensure_project_type: :node
|
|
11
|
+
|
|
10
12
|
def call(args, _name)
|
|
11
13
|
subcommand = args.shift
|
|
12
14
|
case subcommand
|
|
@@ -4,26 +4,34 @@ module Node
|
|
|
4
4
|
module Messages
|
|
5
5
|
MESSAGES = {
|
|
6
6
|
node: {
|
|
7
|
+
help: <<~HELP,
|
|
8
|
+
Suite of commands for developing Node.js apps. See {{command:%1$s node <command> --help}} for usage of each command.
|
|
9
|
+
Usage: {{command:%1$s node [ %2$s ]}}
|
|
10
|
+
HELP
|
|
11
|
+
|
|
7
12
|
error: {
|
|
8
13
|
generic: "Error",
|
|
9
14
|
},
|
|
10
15
|
|
|
11
16
|
connect: {
|
|
12
17
|
connected: "Project now connected to {{green:%s}}",
|
|
18
|
+
help: <<~HELP,
|
|
19
|
+
{{command:%s node connect}}: Connects an existing Node.js app to Shopify CLI. Creates a config file.
|
|
20
|
+
Usage: {{command:%s node connect}}
|
|
21
|
+
HELP
|
|
13
22
|
production_warning: <<~MESSAGE,
|
|
14
|
-
|
|
23
|
+
{{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
|
|
15
24
|
MESSAGE
|
|
16
25
|
},
|
|
17
26
|
|
|
18
27
|
create: {
|
|
19
28
|
help: <<~HELP,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{{command:--shop-domain=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
|
|
29
|
+
{{command:%s node create}}: Creates an embedded nodejs app.
|
|
30
|
+
Usage: {{command:%s node create}}
|
|
31
|
+
Options:
|
|
32
|
+
{{command:--name=NAME}} App name. Any string.
|
|
33
|
+
{{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
|
|
34
|
+
{{command:--store=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
|
|
27
35
|
HELP
|
|
28
36
|
error: {
|
|
29
37
|
node_required: "node is required to create an app project. Download at https://nodejs.org/en/download.",
|
|
@@ -39,18 +47,18 @@ module Node
|
|
|
39
47
|
|
|
40
48
|
deploy: {
|
|
41
49
|
help: <<~HELP,
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
Deploy the current Node project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
|
|
51
|
+
Usage: {{command:%s node deploy [ heroku ]}}
|
|
44
52
|
HELP
|
|
45
53
|
extended_help: <<~HELP,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
{{bold:Subcommands:}}
|
|
55
|
+
{{cyan:heroku}}: Deploys the current Node project to Heroku.
|
|
56
|
+
Usage: {{command:%s node deploy heroku}}
|
|
49
57
|
HELP
|
|
50
58
|
heroku: {
|
|
51
59
|
help: <<~HELP,
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
Deploy the current Node project to Heroku
|
|
61
|
+
Usage: {{command:%s node deploy heroku}}
|
|
54
62
|
HELP
|
|
55
63
|
downloading: "Downloading Heroku CLI…",
|
|
56
64
|
downloaded: "Downloaded Heroku CLI",
|
|
@@ -83,85 +91,34 @@ module Node
|
|
|
83
91
|
|
|
84
92
|
generate: {
|
|
85
93
|
help: <<~HELP,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
{{red:The {{command:generate}} command is no longer supported.}}
|
|
95
|
+
You can complete any tasks previously supported by {{command:generate}} with these guides:
|
|
96
|
+
{{green:page}}
|
|
97
|
+
Create a page with Polaris design components: {{green:https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/build-your-user-interface-with-polaris}}
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
{{green:webhook}}
|
|
100
|
+
Register and process webhooks: {{green:https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/webhooks.md}}
|
|
93
101
|
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
{{green:billing}}
|
|
103
|
+
Create and manage app billing models: {{green:https://shopify.dev/tutorials/bill-for-your-app-using-graphql-admin-api}}
|
|
96
104
|
HELP
|
|
97
105
|
},
|
|
98
106
|
|
|
99
107
|
open: {
|
|
100
108
|
help: <<~HELP,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
HELP
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
populate: {
|
|
107
|
-
help: <<~HELP,
|
|
108
|
-
Populate your Shopify development store with example customers, orders, or products.
|
|
109
|
-
Usage: {{command:%s populate [ customers | draftorders | products ]}}
|
|
109
|
+
Open your local development app in the default browser.
|
|
110
|
+
Usage: {{command:%s node open}}
|
|
110
111
|
HELP
|
|
111
|
-
extended_help: <<~HELP,
|
|
112
|
-
{{bold:Subcommands:}}
|
|
113
|
-
|
|
114
|
-
{{cyan:customers [options]}}: Add dummy customers to the specified development store.
|
|
115
|
-
Usage: {{command:%1$s populate customers}}
|
|
116
|
-
|
|
117
|
-
{{cyan:draftorders [options]}}: Add dummy orders to the specified development store.
|
|
118
|
-
Usage: {{command:%1$s populate draftorders}}
|
|
119
|
-
|
|
120
|
-
{{cyan:products [options]}}: Add dummy products to the specified development store.
|
|
121
|
-
Usage: {{command:%1$s populate products}}
|
|
122
|
-
|
|
123
|
-
{{bold:Options:}}
|
|
124
|
-
|
|
125
|
-
{{cyan:--count [integer]}}: The number of dummy items to populate. Defaults to 5.
|
|
126
|
-
{{cyan:--silent}}: Silence the populate output.
|
|
127
|
-
{{cyan:--help}}: Display more options specific to each subcommand.
|
|
128
|
-
|
|
129
|
-
{{bold:Examples:}}
|
|
130
|
-
|
|
131
|
-
{{command:%1$s populate products}}
|
|
132
|
-
Populate your development store with 5 additional products.
|
|
133
|
-
|
|
134
|
-
{{command:%1$s populate customers --count 30}}
|
|
135
|
-
Populate your development store with 30 additional customers.
|
|
136
|
-
|
|
137
|
-
{{command:%1$s populate draftorders}}
|
|
138
|
-
Populate your development store with 5 additional orders.
|
|
139
|
-
|
|
140
|
-
{{command:%1$s populate products --help}}
|
|
141
|
-
Display the list of options available to customize the {{command:%1$s populate products}} command.
|
|
142
|
-
HELP
|
|
143
|
-
|
|
144
|
-
customer: {
|
|
145
|
-
added: "%s added to {{green:%s}} at {{underline:%scustomers/%d}}",
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
draft_order: {
|
|
149
|
-
added: "DraftOrder added to {{green:%s}} at {{underline:%sdraft_orders/%d}}",
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
product: {
|
|
153
|
-
added: "%s added to {{green:%s}} at {{underline:%sproducts/%d}}",
|
|
154
|
-
},
|
|
155
112
|
},
|
|
156
113
|
|
|
157
114
|
serve: {
|
|
158
115
|
help: <<~HELP,
|
|
159
|
-
|
|
160
|
-
|
|
116
|
+
Start a local development node server for your project, as well as a public ngrok tunnel to your localhost.
|
|
117
|
+
Usage: {{command:%s node serve}}
|
|
161
118
|
HELP
|
|
162
119
|
extended_help: <<~HELP,
|
|
163
|
-
|
|
164
|
-
|
|
120
|
+
{{bold:Options:}}
|
|
121
|
+
{{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
|
|
165
122
|
HELP
|
|
166
123
|
|
|
167
124
|
error: {
|
|
@@ -172,25 +129,25 @@ module Node
|
|
|
172
129
|
{{*}} To install and start using your app, open this URL in your browser:
|
|
173
130
|
{{green:%s}}
|
|
174
131
|
MESSAGE
|
|
175
|
-
running_server: "Running server
|
|
132
|
+
running_server: "Running server…",
|
|
176
133
|
},
|
|
177
134
|
|
|
178
135
|
tunnel: {
|
|
179
136
|
help: <<~HELP,
|
|
180
|
-
|
|
181
|
-
|
|
137
|
+
Start or stop an http tunnel to your local development app using ngrok.
|
|
138
|
+
Usage: {{command:%s node tunnel [ auth | start | stop ]}}
|
|
182
139
|
HELP
|
|
183
140
|
extended_help: <<~HELP,
|
|
184
|
-
|
|
141
|
+
{{bold:Subcommands:}}
|
|
185
142
|
|
|
186
|
-
|
|
187
|
-
|
|
143
|
+
{{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account. Visit https://dashboard.ngrok.com/signup to sign up.
|
|
144
|
+
Usage: {{command:%1$s node tunnel auth <token>}}
|
|
188
145
|
|
|
189
|
-
|
|
190
|
-
|
|
146
|
+
{{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
|
|
147
|
+
Usage: {{command:%1$s node tunnel start}}
|
|
191
148
|
|
|
192
|
-
|
|
193
|
-
|
|
149
|
+
{{cyan:stop}}: Stops the ngrok tunnel.
|
|
150
|
+
Usage: {{command:%1$s node tunnel stop}}
|
|
194
151
|
|
|
195
152
|
HELP
|
|
196
153
|
|
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Rails
|
|
3
3
|
class Project < ShopifyCli::ProjectType
|
|
4
|
-
title("Ruby on Rails App")
|
|
5
|
-
creator("Rails::Commands::Create")
|
|
6
|
-
connector("Rails::Commands::Connect")
|
|
7
|
-
|
|
8
|
-
register_command("Rails::Commands::Deploy", "deploy")
|
|
9
|
-
register_command("Rails::Commands::Generate", "generate")
|
|
10
|
-
register_command("Rails::Commands::Open", "open")
|
|
11
|
-
register_command("Rails::Commands::Populate", "populate")
|
|
12
|
-
register_command("Rails::Commands::Serve", "serve")
|
|
13
|
-
register_command("Rails::Commands::Tunnel", "tunnel")
|
|
14
|
-
# register_task('Rails::Tasks::RailsTask', 'rails_task')
|
|
15
|
-
|
|
16
4
|
require Project.project_filepath("messages/messages")
|
|
17
5
|
register_messages(Rails::Messages::MESSAGES)
|
|
18
6
|
end
|
|
19
7
|
|
|
20
8
|
# define/autoload project specific Commands
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
autoload :Tunnel, Project.project_filepath("commands/tunnel")
|
|
9
|
+
class Command < ShopifyCli::ProjectCommands
|
|
10
|
+
subcommand :Connect, "connect", Project.project_filepath("commands/connect")
|
|
11
|
+
subcommand :Create, "create", Project.project_filepath("commands/create")
|
|
12
|
+
subcommand :Deploy, "deploy", Project.project_filepath("commands/deploy")
|
|
13
|
+
subcommand :Generate, "generate", Project.project_filepath("commands/generate")
|
|
14
|
+
subcommand :Open, "open", Project.project_filepath("commands/open")
|
|
15
|
+
subcommand :Serve, "serve", Project.project_filepath("commands/serve")
|
|
16
|
+
subcommand :Tunnel, "tunnel", Project.project_filepath("commands/tunnel")
|
|
30
17
|
end
|
|
18
|
+
ShopifyCli::Commands.register("Rails::Command", "rails")
|
|
31
19
|
|
|
32
20
|
# define/autoload project specific Tasks
|
|
33
21
|
module Tasks
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Rails
|
|
3
|
-
|
|
3
|
+
class Command
|
|
4
4
|
class Connect < ShopifyCli::SubCommand
|
|
5
|
+
prerequisite_task ensure_project_type: :rails
|
|
6
|
+
|
|
5
7
|
def call(*)
|
|
6
8
|
if ShopifyCli::Project.has_current? && ShopifyCli::Project.current.env
|
|
7
9
|
@ctx.puts(@ctx.message("rails.connect.production_warning"))
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
app = ShopifyCli::
|
|
12
|
+
app = ShopifyCli::Connect.new(@ctx).default_connect("rails")
|
|
11
13
|
@ctx.done(@ctx.message("rails.connect.connected", app))
|
|
12
14
|
end
|
|
15
|
+
|
|
16
|
+
def self.help
|
|
17
|
+
ShopifyCli::Context.message("rails.connect.help", ShopifyCli::TOOL_NAME, ShopifyCli::TOOL_NAME)
|
|
18
|
+
end
|
|
13
19
|
end
|
|
14
20
|
end
|
|
15
21
|
end
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Rails
|
|
3
|
-
|
|
3
|
+
class Command
|
|
4
4
|
class Create < ShopifyCli::SubCommand
|
|
5
|
+
prerequisite_task :ensure_authenticated
|
|
6
|
+
|
|
5
7
|
USER_AGENT_CODE = <<~USERAGENT
|
|
6
8
|
module ShopifyAPI
|
|
7
9
|
class Base < ActiveResource::Base
|
|
8
|
-
self.headers['User-Agent'] << " | ShopifyApp/\#{ShopifyApp::VERSION} | Shopify
|
|
10
|
+
self.headers['User-Agent'] << " | ShopifyApp/\#{ShopifyApp::VERSION} | Shopify CLI"
|
|
9
11
|
end
|
|
10
12
|
end
|
|
11
13
|
USERAGENT
|
|
@@ -16,11 +18,13 @@ module Rails
|
|
|
16
18
|
# backwards compatibility allow 'title' for now
|
|
17
19
|
parser.on("--title=TITLE") { |t| flags[:title] = t }
|
|
18
20
|
parser.on("--name=NAME") { |t| flags[:title] = t }
|
|
19
|
-
parser.on("--organization_id=ID") { |
|
|
20
|
-
parser.on("--organization-id=ID") { |
|
|
21
|
+
parser.on("--organization_id=ID") { |id| flags[:organization_id] = id }
|
|
22
|
+
parser.on("--organization-id=ID") { |id| flags[:organization_id] = id }
|
|
23
|
+
parser.on("--store=MYSHOPIFYDOMAIN") { |url| flags[:shop_domain] = url }
|
|
24
|
+
# backwards compatibility allow 'shop domain' for now
|
|
21
25
|
parser.on("--shop_domain=MYSHOPIFYDOMAIN") { |url| flags[:shop_domain] = url }
|
|
22
26
|
parser.on("--shop-domain=MYSHOPIFYDOMAIN") { |url| flags[:shop_domain] = url }
|
|
23
|
-
parser.on("--type=APPTYPE") { |
|
|
27
|
+
parser.on("--type=APPTYPE") { |type| flags[:type] = type }
|
|
24
28
|
parser.on("--db=DB") { |db| flags[:db] = db }
|
|
25
29
|
parser.on("--rails_opts=RAILSOPTS") { |opts| flags[:rails_opts] = opts }
|
|
26
30
|
parser.on("--rails-opts=RAILSOPTS") { |opts| flags[:rails_opts] = opts }
|
|
@@ -62,7 +66,7 @@ module Rails
|
|
|
62
66
|
partners_url = ShopifyCli::PartnersAPI.partners_url_for(form.organization_id, api_client["id"], local_debug?)
|
|
63
67
|
|
|
64
68
|
@ctx.puts(@ctx.message("apps.create.info.created", form.title, partners_url))
|
|
65
|
-
@ctx.puts(@ctx.message("apps.create.info.serve", form.name, ShopifyCli::TOOL_NAME))
|
|
69
|
+
@ctx.puts(@ctx.message("apps.create.info.serve", form.name, ShopifyCli::TOOL_NAME, "rails"))
|
|
66
70
|
unless ShopifyCli::Shopifolk.acting_as_shopify_organization?
|
|
67
71
|
@ctx.puts(@ctx.message("apps.create.info.install", partners_url, form.title))
|
|
68
72
|
end
|
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Rails
|
|
5
|
-
|
|
6
|
-
class Deploy < ShopifyCli::
|
|
7
|
-
|
|
5
|
+
class Command
|
|
6
|
+
class Deploy < ShopifyCli::SubCommand
|
|
7
|
+
prerequisite_task ensure_project_type: :rails
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
autoload :Heroku, Project.project_filepath("commands/deploy/heroku")
|
|
10
|
+
|
|
11
|
+
HEROKU = "heroku"
|
|
12
|
+
|
|
13
|
+
def call(args, _name)
|
|
14
|
+
subcommand = args.shift
|
|
15
|
+
case subcommand
|
|
16
|
+
when HEROKU
|
|
17
|
+
Rails::Command::Deploy::Heroku.start(@ctx)
|
|
18
|
+
else
|
|
19
|
+
@ctx.puts(self.class.help)
|
|
20
|
+
end
|
|
11
21
|
end
|
|
12
22
|
|
|
13
23
|
def self.help
|
|
@@ -2,109 +2,111 @@
|
|
|
2
2
|
require "shopify_cli"
|
|
3
3
|
|
|
4
4
|
module Rails
|
|
5
|
-
|
|
5
|
+
class Command
|
|
6
6
|
class Deploy
|
|
7
|
-
class Heroku
|
|
8
|
-
|
|
7
|
+
class Heroku
|
|
8
|
+
class << self
|
|
9
|
+
DB_CHECK_CMD = 'bundle exec rails runner "puts ActiveRecord::Base.connection.adapter_name.downcase"'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def call(*)
|
|
15
|
-
CLI::UI::Frame.open(@ctx.message("rails.deploy.heroku.db_check.validating")) do
|
|
16
|
-
CLI::UI::Spinner.spin(@ctx.message("rails.deploy.heroku.db_check.checking")) do |spinner|
|
|
17
|
-
db_type, err = check_db(@ctx)
|
|
18
|
-
@ctx.abort(@ctx.message(err)) unless err.nil?
|
|
19
|
-
spinner.update_title(@ctx.message("rails.deploy.heroku.db_check.validated", db_type))
|
|
20
|
-
end
|
|
21
|
-
true
|
|
11
|
+
def help
|
|
12
|
+
ShopifyCli::Context.message("rails.deploy.heroku.help", ShopifyCli::TOOL_NAME)
|
|
22
13
|
end
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
def start(ctx)
|
|
16
|
+
CLI::UI::Frame.open(ctx.message("rails.deploy.heroku.db_check.validating")) do
|
|
17
|
+
CLI::UI::Spinner.spin(ctx.message("rails.deploy.heroku.db_check.checking")) do |spinner|
|
|
18
|
+
db_type, err = check_db(ctx)
|
|
19
|
+
ctx.abort(ctx.message(err)) unless err.nil?
|
|
20
|
+
spinner.update_title(ctx.message("rails.deploy.heroku.db_check.validated", db_type))
|
|
21
|
+
end
|
|
22
|
+
true
|
|
23
|
+
end
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
heroku_service.
|
|
29
|
-
spinner.update_title(@ctx.message("rails.deploy.heroku.downloaded"))
|
|
30
|
-
end
|
|
31
|
-
spin_group.wait
|
|
25
|
+
spin_group = CLI::UI::SpinGroup.new
|
|
26
|
+
heroku_service = ShopifyCli::Heroku.new(ctx)
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
spin_group.add(@ctx.message("rails.deploy.heroku.git.checking")) do |spinner|
|
|
38
|
-
ShopifyCli::Git.init(@ctx)
|
|
39
|
-
spinner.update_title(@ctx.message("rails.deploy.heroku.git.initialized"))
|
|
40
|
-
end
|
|
41
|
-
spin_group.wait
|
|
42
|
-
|
|
43
|
-
if (account = heroku_service.whoami)
|
|
44
|
-
@ctx.puts(@ctx.message("rails.deploy.heroku.authenticated_with_account", account))
|
|
45
|
-
else
|
|
46
|
-
CLI::UI::Frame.open(
|
|
47
|
-
@ctx.message("rails.deploy.heroku.authenticating"),
|
|
48
|
-
success_text: @ctx.message("rails.deploy.heroku.authenticated")
|
|
49
|
-
) do
|
|
50
|
-
heroku_service.authenticate
|
|
28
|
+
spin_group.add(ctx.message("rails.deploy.heroku.downloading")) do |spinner|
|
|
29
|
+
heroku_service.download
|
|
30
|
+
spinner.update_title(ctx.message("rails.deploy.heroku.downloaded"))
|
|
51
31
|
end
|
|
52
|
-
|
|
32
|
+
spin_group.wait
|
|
53
33
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
spin_group.add(ctx.message("rails.deploy.heroku.installing")) do |spinner|
|
|
35
|
+
heroku_service.install
|
|
36
|
+
spinner.update_title(ctx.message("rails.deploy.heroku.installed"))
|
|
37
|
+
end
|
|
38
|
+
spin_group.add(ctx.message("rails.deploy.heroku.git.checking")) do |spinner|
|
|
39
|
+
ShopifyCli::Git.init(ctx)
|
|
40
|
+
spinner.update_title(ctx.message("rails.deploy.heroku.git.initialized"))
|
|
60
41
|
end
|
|
42
|
+
spin_group.wait
|
|
61
43
|
|
|
62
|
-
if
|
|
63
|
-
|
|
44
|
+
if (account = heroku_service.whoami)
|
|
45
|
+
ctx.puts(ctx.message("rails.deploy.heroku.authenticated_with_account", account))
|
|
46
|
+
else
|
|
64
47
|
CLI::UI::Frame.open(
|
|
65
|
-
|
|
66
|
-
success_text:
|
|
48
|
+
ctx.message("rails.deploy.heroku.authenticating"),
|
|
49
|
+
success_text: ctx.message("rails.deploy.heroku.authenticated")
|
|
67
50
|
) do
|
|
68
|
-
heroku_service.
|
|
51
|
+
heroku_service.authenticate
|
|
69
52
|
end
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if (app_name = heroku_service.app)
|
|
56
|
+
ctx.puts(ctx.message("rails.deploy.heroku.app.selected", app_name))
|
|
57
|
+
else
|
|
58
|
+
app_type = CLI::UI::Prompt.ask(ctx.message("rails.deploy.heroku.app.no_apps_found")) do |handler|
|
|
59
|
+
handler.option(ctx.message("rails.deploy.heroku.app.create")) { :new }
|
|
60
|
+
handler.option(ctx.message("rails.deploy.heroku.app.select")) { :existing }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if app_type == :existing
|
|
64
|
+
app_name = CLI::UI::Prompt.ask(ctx.message("rails.deploy.heroku.app.name"))
|
|
65
|
+
CLI::UI::Frame.open(
|
|
66
|
+
ctx.message("rails.deploy.heroku.app.selecting", app_name),
|
|
67
|
+
success_text: ctx.message("rails.deploy.heroku.app.selected", app_name)
|
|
68
|
+
) do
|
|
69
|
+
heroku_service.select_existing_app(app_name)
|
|
70
|
+
end
|
|
71
|
+
elsif app_type == :new
|
|
72
|
+
CLI::UI::Frame.open(
|
|
73
|
+
ctx.message("rails.deploy.heroku.app.creating"),
|
|
74
|
+
success_text: ctx.message("rails.deploy.heroku.app.created")
|
|
75
|
+
) do
|
|
76
|
+
heroku_service.create_new_app
|
|
77
|
+
end
|
|
76
78
|
end
|
|
77
79
|
end
|
|
78
|
-
end
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
branches = ShopifyCli::Git.branches(ctx)
|
|
82
|
+
if branches.length == 1
|
|
83
|
+
branch_to_deploy = branches[0]
|
|
84
|
+
ctx.puts(ctx.message("rails.deploy.heroku.git.branch_selected", branch_to_deploy))
|
|
85
|
+
else
|
|
86
|
+
branch_to_deploy = CLI::UI::Prompt.ask(ctx.message("rails.deploy.heroku.git.what_branch")) do |handler|
|
|
87
|
+
branches.each do |branch|
|
|
88
|
+
handler.option(branch) { branch }
|
|
89
|
+
end
|
|
88
90
|
end
|
|
89
91
|
end
|
|
90
|
-
end
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
CLI::UI::Frame.open(
|
|
94
|
+
ctx.message("rails.deploy.heroku.deploying"),
|
|
95
|
+
success_text: ctx.message("rails.deploy.heroku.deployed")
|
|
96
|
+
) do
|
|
97
|
+
heroku_service.deploy(branch_to_deploy)
|
|
98
|
+
end
|
|
97
99
|
end
|
|
98
|
-
end
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
def check_db(ctx)
|
|
102
|
+
out, stat = ctx.capture2e(DB_CHECK_CMD)
|
|
103
|
+
if stat.success? && out.strip == "sqlite"
|
|
104
|
+
["sqlite", "rails.deploy.heroku.db_check.sqlite"]
|
|
105
|
+
elsif !stat.success?
|
|
106
|
+
[nil, "rails.deploy.heroku.db_check.problem"]
|
|
107
|
+
else
|
|
108
|
+
[out.strip, nil]
|
|
109
|
+
end
|
|
108
110
|
end
|
|
109
111
|
end
|
|
110
112
|
end
|