shopify-cli 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.md +20 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +13 -13
  6. data/bin/load_shopify.rb +3 -1
  7. data/bin/shopify +2 -0
  8. data/docs/Gemfile.lock +23 -13
  9. data/docs/getting-started/install/index.md +37 -1
  10. data/docs/getting-started/migrate/index.md +34 -1
  11. data/ext/shopify-cli/extconf.rb +40 -20
  12. data/lib/project_types/extension/cli.rb +1 -1
  13. data/lib/project_types/extension/commands/build.rb +1 -1
  14. data/lib/project_types/extension/models/type.rb +1 -0
  15. data/lib/project_types/extension/tasks/create_extension.rb +1 -1
  16. data/lib/project_types/extension/tasks/get_app.rb +1 -1
  17. data/lib/project_types/extension/tasks/update_draft.rb +1 -1
  18. data/lib/project_types/node/commands/create.rb +4 -4
  19. data/lib/project_types/node/commands/deploy/heroku.rb +6 -1
  20. data/lib/project_types/node/commands/generate/billing.rb +6 -5
  21. data/lib/project_types/node/commands/generate/page.rb +8 -5
  22. data/lib/project_types/node/commands/generate/webhook.rb +4 -1
  23. data/lib/project_types/node/messages/messages.rb +3 -2
  24. data/lib/project_types/rails/cli.rb +0 -1
  25. data/lib/project_types/rails/commands/create.rb +52 -4
  26. data/lib/project_types/rails/commands/generate.rb +1 -0
  27. data/lib/project_types/rails/commands/generate/webhook.rb +3 -2
  28. data/lib/project_types/rails/commands/serve.rb +6 -2
  29. data/lib/project_types/rails/gem.rb +61 -6
  30. data/lib/project_types/rails/messages/messages.rb +29 -13
  31. data/lib/project_types/script/cli.rb +2 -3
  32. data/lib/project_types/script/commands/create.rb +5 -9
  33. data/lib/project_types/script/commands/disable.rb +4 -15
  34. data/lib/project_types/script/commands/enable.rb +37 -13
  35. data/lib/project_types/script/commands/push.rb +8 -13
  36. data/lib/project_types/script/config/extension_points.yml +9 -3
  37. data/lib/project_types/script/errors.rb +8 -0
  38. data/lib/project_types/script/forms/create.rb +1 -1
  39. data/lib/project_types/script/layers/application/create_script.rb +7 -6
  40. data/lib/project_types/script/layers/application/disable_script.rb +9 -7
  41. data/lib/project_types/script/layers/application/enable_script.rb +11 -9
  42. data/lib/project_types/script/layers/application/push_script.rb +6 -4
  43. data/lib/project_types/script/layers/domain/errors.rb +2 -0
  44. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +2 -2
  45. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +2 -2
  46. data/lib/project_types/script/layers/infrastructure/errors.rb +2 -0
  47. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
  48. data/lib/project_types/script/layers/infrastructure/script_repository.rb +1 -1
  49. data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
  50. data/lib/project_types/script/messages/messages.rb +25 -31
  51. data/lib/project_types/script/script_project.rb +8 -4
  52. data/lib/project_types/script/templates/ts/as-pect.config.js +6 -0
  53. data/lib/project_types/script/ui/error_handler.rb +8 -0
  54. data/lib/project_types/script/ui/printing_spinner.rb +75 -0
  55. data/lib/rubygems_plugin.rb +18 -10
  56. data/lib/shopify-cli/admin_api/populate_resource_command.rb +1 -1
  57. data/lib/shopify-cli/admin_api/schema.rb +20 -8
  58. data/lib/shopify-cli/command.rb +14 -11
  59. data/lib/shopify-cli/commands.rb +1 -0
  60. data/lib/shopify-cli/commands/config.rb +44 -0
  61. data/lib/shopify-cli/commands/connect.rb +8 -69
  62. data/lib/shopify-cli/commands/create.rb +2 -2
  63. data/lib/shopify-cli/commands/help.rb +1 -1
  64. data/lib/shopify-cli/commands/system.rb +22 -13
  65. data/lib/shopify-cli/context.rb +38 -1
  66. data/lib/shopify-cli/core.rb +0 -1
  67. data/lib/shopify-cli/core/entry_point.rb +1 -1
  68. data/lib/shopify-cli/core/executor.rb +3 -5
  69. data/lib/shopify-cli/core/monorail.rb +1 -1
  70. data/lib/shopify-cli/db.rb +1 -1
  71. data/lib/shopify-cli/feature.rb +97 -0
  72. data/lib/shopify-cli/heroku.rb +21 -5
  73. data/lib/shopify-cli/js_deps.rb +2 -2
  74. data/lib/shopify-cli/js_system.rb +2 -2
  75. data/lib/shopify-cli/messages/messages.rb +37 -12
  76. data/lib/shopify-cli/partners_api/organizations.rb +7 -7
  77. data/lib/shopify-cli/process_supervision.rb +60 -21
  78. data/lib/shopify-cli/project.rb +14 -6
  79. data/lib/shopify-cli/project_type.rb +5 -7
  80. data/lib/shopify-cli/sub_command.rb +1 -0
  81. data/lib/shopify-cli/task.rb +2 -2
  82. data/lib/shopify-cli/tasks.rb +11 -4
  83. data/lib/shopify-cli/tasks/ensure_env.rb +72 -16
  84. data/lib/shopify-cli/tasks/update_dashboard_urls.rb +4 -3
  85. data/lib/shopify-cli/tunnel.rb +44 -14
  86. data/lib/shopify-cli/version.rb +1 -1
  87. data/lib/shopify_cli.rb +36 -9
  88. data/shopify-cli.gemspec +4 -1
  89. data/vendor/deps/cli-kit/REVISION +1 -1
  90. data/vendor/deps/cli-kit/lib/cli/kit.rb +1 -1
  91. data/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +2 -2
  92. data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +12 -6
  93. data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +9 -11
  94. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +8 -2
  95. data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +7 -7
  96. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +48 -17
  97. data/vendor/deps/cli-ui/REVISION +1 -1
  98. data/vendor/deps/cli-ui/lib/cli/ui.rb +5 -4
  99. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +9 -3
  100. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +1 -0
  101. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -2
  102. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -0
  103. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +13 -5
  104. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +29 -2
  105. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +21 -10
  106. data/vendor/deps/cli-ui/lib/cli/ui/os.rb +63 -0
  107. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +11 -2
  108. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -0
  109. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -3
  110. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +6 -8
  111. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +2 -0
  112. data/vendor/gen/lib/gen.rb +39 -0
  113. data/vendor/gen/lib/gen/commands.rb +18 -0
  114. data/vendor/gen/lib/gen/commands/help.rb +20 -0
  115. data/vendor/gen/lib/gen/commands/new.rb +21 -0
  116. data/vendor/gen/lib/gen/entry_point.rb +10 -0
  117. data/vendor/gen/lib/gen/generator.rb +165 -0
  118. data/vendor/gen/template/.gitignore +2 -0
  119. data/vendor/gen/template/Gemfile +10 -0
  120. data/vendor/gen/template/README.md +1 -0
  121. data/vendor/gen/template/bin/testunit +23 -0
  122. data/vendor/gen/template/bin/update-deps +97 -0
  123. data/vendor/gen/template/dev-gems.yml +3 -0
  124. data/vendor/gen/template/dev-vendor.yml +4 -0
  125. data/vendor/gen/template/exe/__app__-gems +17 -0
  126. data/vendor/gen/template/exe/__app__-vendor +18 -0
  127. data/vendor/gen/template/lib/__app__.rb +33 -0
  128. data/vendor/gen/template/lib/__app__/commands.rb +18 -0
  129. data/vendor/gen/template/lib/__app__/commands/example.rb +19 -0
  130. data/vendor/gen/template/lib/__app__/commands/help.rb +21 -0
  131. data/vendor/gen/template/lib/__app__/entry_point.rb +10 -0
  132. data/vendor/gen/template/test/example_test.rb +17 -0
  133. data/vendor/gen/template/test/test_helper.rb +22 -0
  134. metadata +28 -6
  135. data/Vagrantfile +0 -17
  136. data/lib/project_types/script/forms/enable.rb +0 -24
  137. data/lib/project_types/script/forms/push.rb +0 -19
  138. data/lib/project_types/script/forms/script_form.rb +0 -66
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Script
4
- module Forms
5
- class Push < ScriptForm
6
- flag_arguments :api_key, :force
7
-
8
- def ask
9
- self.api_key ||= ask_api_key
10
- end
11
-
12
- private
13
-
14
- def ask_api_key
15
- ask_app_api_key(organization['apps'])
16
- end
17
- end
18
- end
19
- end
@@ -1,66 +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
- ctx.puts(ctx.message('script.forms.script_form.fetching_organizations'))
15
- @organizations = ShopifyCli::PartnersAPI::Organizations.fetch_with_app(ctx)
16
- end
17
-
18
- def ask_app_api_key(apps, message: ctx.message('script.forms.script_form.ask_app_api_key_default'))
19
- if apps.count == 0
20
- raise Errors::NoExistingAppsError
21
- elsif apps.count == 1
22
- ctx.puts(ctx.message(
23
- 'script.forms.script_form.using_app',
24
- title: apps.first['title'],
25
- api_key: apps.first['apiKey']
26
- ))
27
- apps.first["apiKey"]
28
- else
29
- CLI::UI::Prompt.ask(message) do |handler|
30
- apps.each { |app| handler.option(app["title"]) { app["apiKey"] } }
31
- end
32
- end
33
- end
34
-
35
- def ask_organization
36
- if organizations.count == 0
37
- raise Errors::NoExistingOrganizationsError
38
- elsif organizations.count == 1
39
- org = organizations.first
40
- ctx.puts(ctx.message('script.forms.script_form.using_organization',
41
- ctx.message('core.partners_api.org_name_and_id', org['businessName'], org['id'])))
42
- org
43
- else
44
- org_id = CLI::UI::Prompt.ask(ctx.message('script.forms.script_form.select_organization')) do |handler|
45
- organizations.each do |o|
46
- handler.option(ctx.message('core.partners_api.org_name_and_id', o['businessName'], o['id'])) { o['id'] }
47
- end
48
- end
49
- organizations.find { |o| o['id'] == org_id }
50
- end
51
- end
52
-
53
- def ask_shop_domain(organization, message: ctx.message('script.forms.script_form.ask_shop_domain_default'))
54
- if organization['stores'].count == 0
55
- raise Errors::NoExistingStoresError, organization['id']
56
- elsif organization['stores'].count == 1
57
- domain = organization['stores'].first['shopDomain']
58
- ctx.puts(ctx.message('script.forms.script_form.using_development_store', domain: domain))
59
- domain
60
- else
61
- CLI::UI::Prompt.ask(message, options: organization["stores"].map { |s| s["shopDomain"] })
62
- end
63
- end
64
- end
65
- end
66
- end