shopify-cli 1.0.5 → 1.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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/bin/load_shopify.rb +3 -1
  4. data/bin/shopify +2 -0
  5. data/ext/shopify-cli/extconf.rb +40 -20
  6. data/lib/project_types/node/commands/create.rb +4 -4
  7. data/lib/project_types/node/commands/deploy/heroku.rb +6 -1
  8. data/lib/project_types/node/commands/generate/billing.rb +6 -5
  9. data/lib/project_types/node/commands/generate/page.rb +8 -5
  10. data/lib/project_types/node/commands/generate/webhook.rb +4 -1
  11. data/lib/project_types/node/messages/messages.rb +1 -0
  12. data/lib/project_types/rails/commands/create.rb +52 -4
  13. data/lib/project_types/rails/commands/generate.rb +1 -0
  14. data/lib/project_types/rails/commands/generate/webhook.rb +3 -2
  15. data/lib/project_types/rails/commands/serve.rb +6 -2
  16. data/lib/project_types/rails/gem.rb +61 -6
  17. data/lib/project_types/rails/messages/messages.rb +27 -11
  18. data/lib/project_types/script/config/extension_points.yml +3 -3
  19. data/lib/project_types/script/forms/create.rb +1 -1
  20. data/lib/rubygems_plugin.rb +18 -10
  21. data/lib/shopify-cli/admin_api/populate_resource_command.rb +1 -1
  22. data/lib/shopify-cli/commands/connect.rb +1 -1
  23. data/lib/shopify-cli/commands/system.rb +9 -8
  24. data/lib/shopify-cli/context.rb +28 -0
  25. data/lib/shopify-cli/heroku.rb +18 -2
  26. data/lib/shopify-cli/js_deps.rb +2 -2
  27. data/lib/shopify-cli/js_system.rb +2 -2
  28. data/lib/shopify-cli/process_supervision.rb +52 -15
  29. data/lib/shopify-cli/project.rb +14 -6
  30. data/lib/shopify-cli/tunnel.rb +10 -4
  31. data/lib/shopify-cli/version.rb +1 -1
  32. data/lib/shopify_cli.rb +6 -2
  33. data/shopify-cli.gemspec +4 -1
  34. data/vendor/deps/cli-kit/REVISION +1 -1
  35. data/vendor/deps/cli-kit/lib/cli/kit.rb +1 -1
  36. data/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +2 -2
  37. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +12 -6
  38. data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +9 -11
  39. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +8 -2
  40. data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +7 -7
  41. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +48 -17
  42. data/vendor/deps/cli-ui/REVISION +1 -1
  43. data/vendor/deps/cli-ui/lib/cli/ui.rb +5 -4
  44. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +9 -3
  45. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +1 -0
  46. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -2
  47. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -0
  48. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +13 -5
  49. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +29 -2
  50. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +21 -10
  51. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +63 -0
  52. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +11 -2
  53. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -0
  54. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -3
  55. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +6 -8
  56. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +2 -0
  57. data/vendor/gen/lib/gen.rb +39 -0
  58. data/vendor/gen/lib/gen/commands.rb +18 -0
  59. data/vendor/gen/lib/gen/commands/help.rb +20 -0
  60. data/vendor/gen/lib/gen/commands/new.rb +21 -0
  61. data/vendor/gen/lib/gen/entry_point.rb +10 -0
  62. data/vendor/gen/lib/gen/generator.rb +165 -0
  63. data/vendor/gen/template/.gitignore +2 -0
  64. data/vendor/gen/template/Gemfile +10 -0
  65. data/vendor/gen/template/README.md +1 -0
  66. data/vendor/gen/template/bin/testunit +23 -0
  67. data/vendor/gen/template/bin/update-deps +97 -0
  68. data/vendor/gen/template/dev-gems.yml +3 -0
  69. data/vendor/gen/template/dev-vendor.yml +4 -0
  70. data/vendor/gen/template/exe/__app__-gems +17 -0
  71. data/vendor/gen/template/exe/__app__-vendor +18 -0
  72. data/vendor/gen/template/lib/__app__.rb +33 -0
  73. data/vendor/gen/template/lib/__app__/commands.rb +18 -0
  74. data/vendor/gen/template/lib/__app__/commands/example.rb +19 -0
  75. data/vendor/gen/template/lib/__app__/commands/help.rb +21 -0
  76. data/vendor/gen/template/lib/__app__/entry_point.rb +10 -0
  77. data/vendor/gen/template/test/example_test.rb +17 -0
  78. data/vendor/gen/template/test/test_helper.rb +22 -0
  79. metadata +25 -4
  80. data/Vagrantfile +0 -17
  81. data/lib/project_types/script/forms/script_form.rb +0 -69
@@ -0,0 +1,10 @@
1
+ require '__app__'
2
+
3
+ module __App__
4
+ module EntryPoint
5
+ def self.call(args)
6
+ cmd, command_name, args = __App__::Resolver.call(args)
7
+ __App__::Executor.call(cmd, command_name, args)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ module __App__
4
+ class ExampleTest < MiniTest::Test
5
+ include CLI::Kit::Support::TestHelper
6
+
7
+ def test_example
8
+ CLI::Kit::System.fake("ls -al", stdout: "a\nb", success: true)
9
+
10
+ out, = CLI::Kit::System.capture2('ls', '-al')
11
+ assert_equal %w(a b), out.split("\n")
12
+
13
+ errors = assert_all_commands_run(should_raise: false)
14
+ assert_nil errors, "expected command to run successfully"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ begin
2
+ addpath = lambda do |p|
3
+ path = File.expand_path("../../#{p}", __FILE__)
4
+ $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
5
+ end
6
+ addpath.call("lib")
7
+ end
8
+
9
+ require 'cli/kit'
10
+
11
+ require 'fileutils'
12
+ require 'tmpdir'
13
+ require 'tempfile'
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ CLI::UI::StdoutRouter.enable
19
+
20
+ require 'minitest/autorun'
21
+ require "minitest/unit"
22
+ require 'mocha/minitest'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,7 +91,6 @@ files:
91
91
  - RELEASING.md
92
92
  - Rakefile
93
93
  - SECURITY.md
94
- - Vagrantfile
95
94
  - bin/load_shopify.rb
96
95
  - bin/shopify
97
96
  - dev.yml
@@ -216,7 +215,6 @@ files:
216
215
  - lib/project_types/script/config/extension_points.yml
217
216
  - lib/project_types/script/errors.rb
218
217
  - lib/project_types/script/forms/create.rb
219
- - lib/project_types/script/forms/script_form.rb
220
218
  - lib/project_types/script/graphql/app_script_update_or_create.graphql
221
219
  - lib/project_types/script/graphql/script_service_proxy.graphql
222
220
  - lib/project_types/script/graphql/shop_script_delete.graphql
@@ -335,6 +333,7 @@ files:
335
333
  - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb
336
334
  - vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb
337
335
  - vendor/deps/cli-ui/lib/cli/ui/glyph.rb
336
+ - vendor/deps/cli-ui/lib/cli/ui/os.rb
338
337
  - vendor/deps/cli-ui/lib/cli/ui/printer.rb
339
338
  - vendor/deps/cli-ui/lib/cli/ui/progress.rb
340
339
  - vendor/deps/cli-ui/lib/cli/ui/prompt.rb
@@ -358,6 +357,28 @@ files:
358
357
  - vendor/deps/smart_properties/lib/smart_properties/validations.rb
359
358
  - vendor/deps/smart_properties/lib/smart_properties/validations/ancestor.rb
360
359
  - vendor/deps/smart_properties/lib/smart_properties/version.rb
360
+ - vendor/gen/lib/gen.rb
361
+ - vendor/gen/lib/gen/commands.rb
362
+ - vendor/gen/lib/gen/commands/help.rb
363
+ - vendor/gen/lib/gen/commands/new.rb
364
+ - vendor/gen/lib/gen/entry_point.rb
365
+ - vendor/gen/lib/gen/generator.rb
366
+ - vendor/gen/template/.gitignore
367
+ - vendor/gen/template/Gemfile
368
+ - vendor/gen/template/README.md
369
+ - vendor/gen/template/bin/testunit
370
+ - vendor/gen/template/bin/update-deps
371
+ - vendor/gen/template/dev-gems.yml
372
+ - vendor/gen/template/dev-vendor.yml
373
+ - vendor/gen/template/exe/__app__-gems
374
+ - vendor/gen/template/exe/__app__-vendor
375
+ - vendor/gen/template/lib/__app__.rb
376
+ - vendor/gen/template/lib/__app__/commands.rb
377
+ - vendor/gen/template/lib/__app__/commands/example.rb
378
+ - vendor/gen/template/lib/__app__/commands/help.rb
379
+ - vendor/gen/template/lib/__app__/entry_point.rb
380
+ - vendor/gen/template/test/example_test.rb
381
+ - vendor/gen/template/test/test_helper.rb
361
382
  - vendor/lib/semantic/LICENSE
362
383
  - vendor/lib/semantic/semantic.rb
363
384
  - vendor/lib/semantic/version.rb
@@ -1,17 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure('2') do |config|
5
- # config.vm.define "centos" do |centos|
6
- # centos.vm.box = "centos/7"
7
- # end
8
-
9
- # config.vm.define "windows" do |windows|
10
- # windows.vm.box = "Microsoft/EdgeOnWindows10"
11
- # windows.vm.box_version = "1.0"
12
- # end
13
-
14
- config.vm.define('ubuntu') do |ubuntu|
15
- ubuntu.vm.box = 'ubuntu/xenial64'
16
- end
17
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Forms
5
- class ScriptForm < ShopifyCli::Form
6
- protected
7
-
8
- def organization
9
- @organization ||= ask_organization
10
- end
11
-
12
- def organizations
13
- return @organizations if defined?(@organizations)
14
- UI::PrintingSpinner.spin(ctx, ctx.message('script.forms.script_form.fetching_organizations')) do |ctx, spinner|
15
- @organizations = ShopifyCli::PartnersAPI::Organizations.fetch_with_app(ctx)
16
- spinner.update_title(ctx.message('script.forms.script_form.fetched_organizations'))
17
- end
18
- @organizations
19
- end
20
-
21
- def ask_app_api_key(apps, message: ctx.message('script.forms.script_form.ask_app_api_key_default'))
22
- if apps.count == 0
23
- raise Errors::NoExistingAppsError
24
- elsif apps.count == 1
25
- ctx.puts(ctx.message(
26
- 'script.forms.script_form.using_app',
27
- title: apps.first['title'],
28
- api_key: apps.first['apiKey']
29
- ))
30
- apps.first["apiKey"]
31
- else
32
- CLI::UI::Prompt.ask(message) do |handler|
33
- apps.each { |app| handler.option(app["title"]) { app["apiKey"] } }
34
- end
35
- end
36
- end
37
-
38
- def ask_organization
39
- if organizations.count == 0
40
- raise Errors::NoExistingOrganizationsError
41
- elsif organizations.count == 1
42
- org = organizations.first
43
- ctx.puts(ctx.message('script.forms.script_form.using_organization',
44
- ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
45
- org
46
- else
47
- org_id = CLI::UI::Prompt.ask(ctx.message('script.forms.script_form.select_organization')) do |handler|
48
- organizations.each do |o|
49
- handler.option(ctx.message('core.partners_api.org_name_and_id', o['businessName'], o['id'])) { o['id'] }
50
- end
51
- end
52
- organizations.find { |o| o['id'] == org_id }
53
- end
54
- end
55
-
56
- def ask_shop_domain(organization, message: ctx.message('script.forms.script_form.ask_shop_domain_default'))
57
- if organization['stores'].count == 0
58
- raise Errors::NoExistingStoresError, organization['id']
59
- elsif organization['stores'].count == 1
60
- domain = organization['stores'].first['shopDomain']
61
- ctx.puts(ctx.message('script.forms.script_form.using_development_store', domain: domain))
62
- domain
63
- else
64
- CLI::UI::Prompt.ask(message, options: organization["stores"].map { |s| s["shopDomain"] })
65
- end
66
- end
67
- end
68
- end
69
- end