shopify-cli 2.7.0 → 2.7.1

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: 4cce33ea79f749e3dc6e18d724ac5e584f887971224119f6e8ea61ade325798d
4
- data.tar.gz: 3ae9563de4ea7eb1eaf3e51a03e71fba509ca9249c35e9be8d1311e952ddf577
3
+ metadata.gz: 6009a6f735f27532db922768483b5563cc1a89417742616d0712837f7a4c3f8a
4
+ data.tar.gz: 501ee710f57e5ffc27f7f9abfbb23e155a55da8f67127bfe32031c46fa2df08e
5
5
  SHA512:
6
- metadata.gz: f5e46c8fa4c9eeb026d7e7b451a53886338a32ea084153f541eda085a6a3bb6cf5247831498b0dcc960c9079e7eaf3906662965c32e17f2dfd31a47113343674
7
- data.tar.gz: 46df1b135b1d37618560a00fb8121291ddf9d63f0e35c2c33abfdcf3decb2b9d0fb3380c99726cedab37bd4b01627ac4a3df51869312f82bbfd5ebeb43d9b6a3
6
+ metadata.gz: 783329de6e2b6481c6ebcd747284dcd5e3c81c4303bf82f1d9a22e2e5f9a81aeda51a211c0344636ec03ff17fa1e5aae492fd750540387c85de4204bab8f4327
7
+ data.tar.gz: 6af49d1fff422d17362c2e05f68341fc530cd7849f7d375a39ea8cb5abcb5d825ed8a4f04d8f25cc9265c9b2660c57b028be280db23882d58506e7c184b0d4cc
data/.gitignore CHANGED
@@ -21,4 +21,5 @@ packaging/rpm/build
21
21
  packaging/rpm/shopify-cli.spec
22
22
  .byebug_history
23
23
  ext/shopify-extensions/shopify-extensions
24
+ ext/javy/bin
24
25
  .console_history
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  From version 2.6.0, the sections in this file adhere to the [keep a changelog](https://keepachangelog.com/en/1.0.0/) specification.
2
2
  ## [Unreleased]
3
3
 
4
+ ## Version 2.7.1
5
+ ### Fixed
6
+ * [#1722](https://github.com/Shopify/shopify-cli/pull/1722): Fix `theme serve` failing when the port is already being used
7
+ * [#1751](https://github.com/Shopify/shopify-cli/pull/1751): A bug in the app creation flow that caused the CLI to abort when the form validation failed.
8
+ * [#1750](https://github.com/Shopify/shopify-cli/pull/1750): Runtime errors in Windows' environments when the `PATHEXT` environment variable is not defined.
9
+ * [#1758](https://github.com/Shopify/shopify-cli/pull/1758): Fix tunnel creation for expired anonymous tunnels
10
+
4
11
  ## Version 2.7.0
5
12
  ### Changed
6
13
  * [#1650](https://github.com/Shopify/shopify-cli/pull/1650): **Breaking** Move app commands under `shopify app`.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.7.0)
4
+ shopify-cli (2.7.1)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.8.0)
data/Rakefile CHANGED
@@ -146,6 +146,33 @@ namespace :extensions do
146
146
  end
147
147
  end
148
148
 
149
+ namespace :scripts do
150
+ namespace :javy do
151
+ task :symlink do
152
+ source = Paths.root("..", "javy", "target", "release", "javy")
153
+ error("Unable to find javy executable: #{executable}") unless File.executable?(source)
154
+ target = Paths.javy("javy")
155
+ File.delete(target) if File.exist?(target)
156
+ File.symlink(source, target)
157
+ end
158
+
159
+ task :install do
160
+ require_relative Paths.javy("javy.rb")
161
+ Javy.install
162
+ end
163
+
164
+ module Paths
165
+ def self.javy(*args)
166
+ root("ext", "javy", *args)
167
+ end
168
+
169
+ def self.root(*args)
170
+ Pathname(File.dirname(__FILE__)).join(*args).to_s
171
+ end
172
+ end
173
+ end
174
+ end
175
+
149
176
  def error(message, output: STDERR, code: 1)
150
177
  output.puts(message)
151
178
  exit(code)
data/ext/javy/javy.rb ADDED
@@ -0,0 +1,186 @@
1
+ require "rbconfig"
2
+ require "open-uri"
3
+ require "zlib"
4
+ require "open3"
5
+
6
+ module Javy
7
+ ROOT = __dir__
8
+ BIN_FOLDER = File.join(ROOT, "bin")
9
+ VERSION = File.read(File.join(ROOT, "version")).strip
10
+ TARGET = File.join(BIN_FOLDER, "javy-#{VERSION}")
11
+
12
+ class << self
13
+ def install
14
+ ShopifyCLI::Result
15
+ .wrap { Installer.call(target: target, platform: platform, version: VERSION) }
16
+ .call
17
+ end
18
+
19
+ def build(source:, dest: nil)
20
+ ensure_installed
21
+
22
+ optional_args = []
23
+ optional_args += ["-o", dest] unless dest.nil?
24
+
25
+ ShopifyCLI::Result
26
+ .wrap { exec(source, *optional_args) }
27
+ .call
28
+ end
29
+
30
+ private
31
+
32
+ def exec(*args, **kwargs)
33
+ out_and_err, stat = CLI::Kit::System.capture2e(target, *args, **kwargs)
34
+ raise ExecutionError, out_and_err unless stat.success?
35
+ true
36
+ end
37
+
38
+ def platform
39
+ Platform.new
40
+ end
41
+
42
+ def target
43
+ platform.format_executable_path(TARGET)
44
+ end
45
+
46
+ def ensure_installed
47
+ delete_outdated_installations
48
+ install unless Installer.installed?(target: target)
49
+ end
50
+
51
+ def delete_outdated_installations
52
+ installed_binaries
53
+ .reject { |v| v == target }
54
+ .each { |file| File.delete(file) }
55
+ end
56
+
57
+ def installed_binaries
58
+ Dir[File.join(BIN_FOLDER, "javy-*")]
59
+ end
60
+
61
+ module Installer
62
+ def self.call(target:, platform:, version:)
63
+ asset = Asset.new(
64
+ platform: platform,
65
+ version: version,
66
+ owner: "Shopify",
67
+ repository: "javy",
68
+ basename: "javy"
69
+ )
70
+
71
+ downloaded = asset.download(target: target)
72
+ raise InstallationError.asset_not_found(platform: platform, version: version, url: asset.url) unless downloaded
73
+
74
+ true
75
+ end
76
+
77
+ def self.installed?(target:)
78
+ File.executable?(target)
79
+ end
80
+ end
81
+ end
82
+
83
+ class Error < RuntimeError; end
84
+ class ExecutionError < Error; end
85
+
86
+ class InstallationError < Error
87
+ def self.cpu_unsupported
88
+ new("Javy is not supported on this CPU")
89
+ end
90
+
91
+ def self.asset_not_found(platform:, version:, url:)
92
+ new(format(
93
+ "Unable to download javy %{version} for %{os} (%{cpu}) at %{url}",
94
+ version: version,
95
+ os: platform.os,
96
+ cpu: platform.cpu,
97
+ url: url
98
+ ))
99
+ end
100
+ end
101
+
102
+ Asset = Struct.new(:platform, :version, :owner, :repository, :basename, keyword_init: true) do
103
+ def download(target:)
104
+ FileUtils.mkdir_p(BIN_FOLDER)
105
+
106
+ Dir.chdir(File.dirname(target)) do
107
+ File.open(File.basename(target), "wb") do |target_file|
108
+ decompress(url.open, target_file)
109
+ end
110
+ File.chmod(0755, target)
111
+ end
112
+
113
+ true
114
+ rescue OpenURI::HTTPError
115
+ false
116
+ end
117
+
118
+ def url
119
+ URI.parse(format(
120
+ "https://github.com/%{owner}/%{repository}/releases/download/%{version}/%{filename}",
121
+ owner: owner,
122
+ repository: repository,
123
+ version: version,
124
+ filename: filename
125
+ ))
126
+ end
127
+
128
+ def filename
129
+ format(
130
+ "%{basename}-%{cpu}-%{os}-%{version}.gz",
131
+ basename: basename,
132
+ cpu: platform.cpu,
133
+ os: platform.os,
134
+ version: version
135
+ )
136
+ end
137
+
138
+ private
139
+
140
+ def decompress(source, target)
141
+ zlib = Zlib::GzipReader.new(source)
142
+ target << zlib.read
143
+ ensure
144
+ zlib.close
145
+ end
146
+ end
147
+
148
+ Platform = Struct.new(:ruby_config) do
149
+ def initialize(ruby_config = RbConfig::CONFIG)
150
+ super(ruby_config)
151
+ end
152
+
153
+ def to_s
154
+ format("%{cpu}-%{os}", cpu: cpu, os: os)
155
+ end
156
+
157
+ def os
158
+ case ruby_config.fetch("host_os")
159
+ when /linux/
160
+ "linux"
161
+ when /darwin/
162
+ "macos"
163
+ else
164
+ "windows"
165
+ end
166
+ end
167
+
168
+ def cpu
169
+ case ruby_config.fetch("host_cpu")
170
+ when "x64", "x86_64"
171
+ "x86_64"
172
+ else
173
+ raise InstallationError.cpu_unsupported
174
+ end
175
+ end
176
+
177
+ def format_executable_path(path)
178
+ case os
179
+ when "windows"
180
+ File.extname(path) != ".exe" ? path + ".exe" : path
181
+ else
182
+ path
183
+ end
184
+ end
185
+ end
186
+ end
data/ext/javy/version ADDED
@@ -0,0 +1 @@
1
+ v0.1.0
@@ -28,6 +28,7 @@ module Extension
28
28
  type: project.specification_identifier.downcase,
29
29
  command: "build",
30
30
  config_file_name: specification_handler.server_config_file,
31
+ context: @ctx,
31
32
  ).call
32
33
 
33
34
  @ctx.puts(@ctx.message("build.build_success_message"))
@@ -13,7 +13,7 @@ module Extension
13
13
  property :resource_url, accepts: String
14
14
  property! :store, accepts: String
15
15
  property! :title, accepts: String
16
- property! :tunnel_url, accepts: String
16
+ property :tunnel_url, accepts: String
17
17
  property! :type, accepts: String
18
18
 
19
19
  def self.call(*args)
@@ -15,7 +15,7 @@ module Extension
15
15
 
16
16
  property! :command, accepts: SUPPORTED_COMMANDS
17
17
  property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
18
- property :context, accepts: ShopifyCLI::Context
18
+ property! :context, accepts: ShopifyCLI::Context
19
19
  property :config_file_name, accepts: String
20
20
  property :port, accepts: Integer, default: 39351
21
21
  property :resource_url, accepts: String
@@ -13,6 +13,7 @@ module Script
13
13
  hidden_feature(feature_set: :script_project)
14
14
  subcommand :Create, "create", Project.project_filepath("commands/create")
15
15
  subcommand :Push, "push", Project.project_filepath("commands/push")
16
+ subcommand :Javy, "javy", Project.project_filepath("commands/javy")
16
17
  end
17
18
  ShopifyCLI::Commands.register("Script::Command", "script")
18
19
 
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+ require_relative "../../../../ext/javy/javy.rb"
4
+
5
+ module Script
6
+ class Command
7
+ class Javy < ShopifyCLI::Command::SubCommand
8
+ hidden_feature
9
+
10
+ prerequisite_task ensure_project_type: :script
11
+
12
+ options do |parser, flags|
13
+ parser.on("--in=IN") { |in_file| flags[:in_file] = in_file }
14
+ parser.on("--out=OUT") { |out_file| flags[:out_file] = out_file }
15
+ end
16
+
17
+ def call(*)
18
+ source = options.flags[:in_file]
19
+ dest = options.flags[:out_file]
20
+
21
+ @ctx.abort(@ctx.message("script.javy.errors.invalid_arguments", ShopifyCLI::TOOL_NAME)) unless source
22
+
23
+ ::Javy.build(source: source, dest: dest).unwrap { |e| @ctx.abort(e.message) }
24
+ end
25
+
26
+ def self.help
27
+ ShopifyCLI::Context.message("script.javy.help", ShopifyCLI::TOOL_NAME)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -32,7 +32,7 @@ payment_methods:
32
32
  package: "@shopify/scripts-checkout-apis"
33
33
  typescript:
34
34
  beta: true
35
- package: "@shopify/scripts-checkout-apis-temp"
35
+ package: "@shopify/scripts-checkout-apis"
36
36
  repo: "https://github.com/Shopify/scripts-apis-examples"
37
37
  shipping_methods:
38
38
  domain: 'checkout'
@@ -42,7 +42,7 @@ shipping_methods:
42
42
  package: "@shopify/scripts-checkout-apis"
43
43
  typescript:
44
44
  beta: true
45
- package: "@shopify/scripts-checkout-apis-temp"
45
+ package: "@shopify/scripts-checkout-apis"
46
46
  repo: "https://github.com/Shopify/scripts-apis-examples"
47
47
  discount_types:
48
48
  beta: true
@@ -56,8 +56,15 @@ module Script
56
56
  end
57
57
  end
58
58
 
59
+ class DeprecatedEPError < ScriptProjectError
60
+ attr_reader(:extension_point)
61
+ def initialize(extension_point)
62
+ super()
63
+ @extension_point = extension_point
64
+ end
65
+ end
66
+
59
67
  class DependencyInstallError < ScriptProjectError; end
60
- class DeprecatedEPError < ScriptProjectError; end
61
68
  class EmptyResponseError < ScriptProjectError; end
62
69
  class InvalidResponseError < ScriptProjectError; end
63
70
  class ForbiddenError < ScriptProjectError; end
@@ -176,6 +176,19 @@ module Script
176
176
  script_pushed: "{{v}} Script pushed to app (API key: %{api_key}).",
177
177
  },
178
178
 
179
+ javy: {
180
+ help: <<~HELP,
181
+ Compile the JavaScript code into WebAssembly.
182
+ Usage: {{command:%s script javy}}
183
+ Options:
184
+ {{command:--in}} The name of the JavaScript file that will be compiled.
185
+ {{command:--out}} The name of the file that the WebAssembly should be written to.
186
+ HELP
187
+ errors: {
188
+ invalid_arguments: "Javy was run with invalid arguments. Run {{command: %s script javy --help}} for more information.",
189
+ },
190
+ },
191
+
179
192
  project_deps: {
180
193
  none_required: "{{v}} None required",
181
194
  checking_with_npm: "Checking dependencies with npm",
@@ -74,7 +74,7 @@ module Script
74
74
  }
75
75
  when Layers::Infrastructure::Errors::DeprecatedEPError
76
76
  {
77
- cause_of_error: ShopifyCLI::Context.message("script.error.deprecated_ep", e.ep),
77
+ cause_of_error: ShopifyCLI::Context.message("script.error.deprecated_ep", e.extension_point),
78
78
  help_suggestion: ShopifyCLI::Context.message("script.error.deprecated_ep_cause"),
79
79
  }
80
80
  when Layers::Domain::Errors::InvalidExtensionPointError
@@ -96,12 +96,36 @@ module Theme
96
96
  {{command:--poll}} Force polling to detect file changes
97
97
  {{command:--host=HOST}} Set which network interface the web server listens on. The default value is 127.0.0.1.
98
98
  HELP
99
- serve: "Viewing theme…",
99
+ viewing_theme: "Viewing theme…",
100
+ syncing_theme: "Syncing theme #%s on %s",
100
101
  open_fail: "Couldn't open the theme",
101
102
  error: {
102
103
  address_binding_error: "Couldn't bind to localhost."\
103
104
  " To serve your theme, set a different address with {{command:%s theme serve --host=<address>}}",
104
105
  },
106
+ serving: <<~SERVING,
107
+
108
+ Serving %s
109
+
110
+ SERVING
111
+ customize_or_preview: <<~CUSTOMIZE_OR_PREVIEW,
112
+
113
+ Customize this theme in the Online Store Editor:
114
+ {{green:%s}}
115
+
116
+ Share this theme preview:
117
+ {{green:%s}}
118
+
119
+ (Use Ctrl-C to stop)
120
+ CUSTOMIZE_OR_PREVIEW
121
+ ensure_user: <<~ENSURE_USER,
122
+ You are not authorized to edit themes on %s.
123
+ Make sure you are a user of that store, and allowed to edit themes.
124
+ ENSURE_USER
125
+ already_in_use_error: "Error",
126
+ address_already_in_use: "The address \"%s\" is already in use.",
127
+ try_this: "Try this",
128
+ try_port_option: "Use the --port=PORT option to serve the theme in a different port.",
105
129
  },
106
130
  check: {
107
131
  help: <<~HELP,
@@ -764,7 +764,7 @@ module ShopifyCLI
764
764
  Anonymized reports will be sent to Shopify.
765
765
  MESSAGE
766
766
  turned_off_message: <<~MESSAGE,
767
- Turn on automatic reporting later wtih {{command:%s reporting on}}.
767
+ Turn on automatic reporting later with {{command:%s reporting on}}.
768
768
  MESSAGE
769
769
  },
770
770
  whoami: {
@@ -26,6 +26,8 @@ module ShopifyCLI
26
26
  verbose: verbose,
27
27
  })
28
28
 
29
+ raise ShopifyCLI::AbortSilent if form.nil?
30
+
29
31
  check_node
30
32
  check_npm
31
33
  build(form.name)
@@ -25,7 +25,7 @@ module ShopifyCLI
25
25
  type: type,
26
26
  verbose: verbose,
27
27
  })
28
- return context.puts(self.class.help) if form.nil?
28
+ raise ShopifyCLI::AbortSilent if form.nil?
29
29
 
30
30
  check_php
31
31
  check_composer
@@ -39,6 +39,8 @@ module ShopifyCLI
39
39
  form_options[:rails_opts] = rails_opts unless rails_opts.nil?
40
40
  form = form_data(form_options)
41
41
 
42
+ raise ShopifyCLI::AbortSilent if form.nil?
43
+
42
44
  ruby_version = Rails::Ruby.version(context)
43
45
  context.abort(context.message("core.app.create.rails.error.invalid_ruby_version")) unless
44
46
  ruby_version.satisfies?("~>2.5") || ruby_version.satisfies?("~>3.0.0")
@@ -36,6 +36,7 @@ module ShopifyCLI
36
36
  @app = LocalAssets.new(ctx, @app, theme: theme)
37
37
  @app = HotReload.new(ctx, @app, theme: theme, watcher: watcher, ignore_filter: ignore_filter)
38
38
  stopped = false
39
+ address = "http://#{http_bind}:#{port}"
39
40
 
40
41
  theme.ensure_exists!
41
42
 
@@ -44,8 +45,8 @@ module ShopifyCLI
44
45
  stop
45
46
  end
46
47
 
47
- CLI::UI::Frame.open(@ctx.message("theme.serve.serve")) do
48
- ctx.print_task("Syncing theme ##{theme.id} on #{theme.shop}")
48
+ CLI::UI::Frame.open(@ctx.message("theme.serve.viewing_theme")) do
49
+ ctx.print_task(ctx.message("theme.serve.syncing_theme", theme.id, theme.shop))
49
50
  @syncer.start_threads
50
51
  if block_given?
51
52
  yield @syncer
@@ -55,18 +56,9 @@ module ShopifyCLI
55
56
 
56
57
  return if stopped
57
58
 
58
- ctx.puts("")
59
- ctx.puts("Serving #{theme.root}")
60
- ctx.puts("")
61
- ctx.open_url!("http://127.0.0.1:#{port}")
62
- ctx.puts("")
63
- ctx.puts("Customize this theme in the Online Store Editor:")
64
- ctx.puts("{{green:#{theme.editor_url}}}")
65
- ctx.puts("")
66
- ctx.puts("Share this theme preview:")
67
- ctx.puts("{{green:#{theme.preview_url}}}")
68
- ctx.puts("")
69
- ctx.puts("(Use Ctrl-C to stop)")
59
+ ctx.puts(ctx.message("theme.serve.serving", theme.root))
60
+ ctx.open_url!(address)
61
+ ctx.puts(ctx.message("theme.serve.customize_or_preview", theme.editor_url, theme.preview_url))
70
62
  end
71
63
 
72
64
  logger = if ctx.debug?
@@ -87,8 +79,9 @@ module ShopifyCLI
87
79
 
88
80
  rescue ShopifyCLI::API::APIRequestForbiddenError,
89
81
  ShopifyCLI::API::APIRequestUnauthorizedError
90
- @ctx.abort("You are not authorized to edit themes on #{theme.shop}.\n" \
91
- "Make sure you are a user of that store, and allowed to edit themes.")
82
+ raise ShopifyCLI::Abort, @ctx.message("theme.serve.ensure_user", theme.shop)
83
+ rescue Errno::EADDRINUSE
84
+ abort_address_already_in_use(address)
92
85
  rescue Errno::EADDRNOTAVAIL
93
86
  raise AddressBindingError, "Error binding to the address #{http_bind}."
94
87
  end
@@ -99,6 +92,24 @@ module ShopifyCLI
99
92
  @syncer.shutdown
100
93
  WebServer.shutdown
101
94
  end
95
+
96
+ private
97
+
98
+ def abort_address_already_in_use(address)
99
+ open_frame(@ctx.message("theme.serve.already_in_use_error"), color: :red) do
100
+ @ctx.puts(@ctx.message("theme.serve.address_already_in_use", address))
101
+ end
102
+
103
+ open_frame(@ctx.message("theme.serve.try_this"), color: :green) do
104
+ @ctx.puts(@ctx.message("theme.serve.try_port_option"))
105
+ end
106
+
107
+ raise ShopifyCLI::AbortSilent
108
+ end
109
+
110
+ def open_frame(title, color:, &block)
111
+ CLI::UI::Frame.open(title, color: CLI::UI.resolve_color(color), timing: false, &block)
112
+ end
102
113
  end
103
114
  end
104
115
  end
@@ -12,7 +12,7 @@ module ShopifyCLI
12
12
  class Tunnel
13
13
  extend SingleForwardable
14
14
 
15
- def_delegators :new, :start, :stop, :auth, :stats, :urls, :running_on?
15
+ def_delegators :new, :start, :stop, :auth, :authenticated?, :stats, :urls, :running_on?
16
16
 
17
17
  class FetchUrlError < RuntimeError; end
18
18
  class NgrokError < RuntimeError; end
@@ -65,16 +65,12 @@ module ShopifyCLI
65
65
  #
66
66
  def start(ctx, port: PORT)
67
67
  install(ctx)
68
- url, account, seconds_remaining = start_ngrok(ctx, port)
69
- if account
68
+ if authenticated?
69
+ url, account = start_ngrok(ctx, port)
70
70
  ctx.puts(ctx.message("core.tunnel.start_with_account", url, account))
71
71
  else
72
- if seconds_remaining <= 0
73
- ctx.puts(ctx.message("core.tunnel.timed_out"))
74
- url, _account, seconds_remaining = restart_ngrok(ctx, port)
75
- end
72
+ url, _ = restart_ngrok(ctx, port)
76
73
  ctx.puts(ctx.message("core.tunnel.start", url))
77
- ctx.puts(ctx.message("core.tunnel.will_timeout", seconds_to_hm(seconds_remaining)))
78
74
  ctx.puts(ctx.message("core.tunnel.signup_suggestion", ShopifyCLI::TOOL_NAME))
79
75
  end
80
76
  url
@@ -91,7 +87,16 @@ module ShopifyCLI
91
87
  #
92
88
  def auth(ctx, token)
93
89
  install(ctx)
94
- ctx.system(File.join(ShopifyCLI.cache_dir, "ngrok"), "authtoken", token)
90
+ ctx.system(ngrok_path, "authtoken", token)
91
+ end
92
+
93
+ ##
94
+ # returns a boolean: if the user has a ngrok token to authenticate
95
+ #
96
+ def authenticated?
97
+ ngrok_config_path = File.join(Dir.home, ".ngrok2/ngrok.yml")
98
+ return false unless File.exist?(ngrok_config_path)
99
+ File.read(ngrok_config_path).include?("authtoken")
95
100
  end
96
101
 
97
102
  ##
@@ -145,7 +150,7 @@ module ShopifyCLI
145
150
 
146
151
  def install(ctx)
147
152
  ngrok = "ngrok#{ctx.executable_file_extension}"
148
- return if File.exist?(File.join(ShopifyCLI.cache_dir, ngrok))
153
+ return if File.exist?(ngrok_path)
149
154
  check_prereq_command(ctx, "curl")
150
155
  check_prereq_command(ctx, ctx.linux? ? "unzip" : "tar")
151
156
  spinner = CLI::UI::SpinGroup.new
@@ -165,7 +170,7 @@ module ShopifyCLI
165
170
  spinner.wait
166
171
 
167
172
  # final check to see if ngrok is accessible
168
- unless File.exist?(File.join(ShopifyCLI.cache_dir, ngrok))
173
+ unless File.exist?(ngrok_path)
169
174
  ctx.abort(ctx.message("core.tunnel.error.ngrok", ngrok, ShopifyCLI.cache_dir))
170
175
  end
171
176
  end
@@ -177,8 +182,12 @@ module ShopifyCLI
177
182
  raise e.class, e.message
178
183
  end
179
184
 
185
+ def ngrok_path
186
+ File.join(ShopifyCLI.cache_dir, "ngrok")
187
+ end
188
+
180
189
  def ngrok_command(port)
181
- "\"#{File.join(ShopifyCLI.cache_dir, "ngrok")}\" http -inspect=false -log=stdout -log-level=debug #{port}"
190
+ "\"#{ngrok_path}\" http -inspect=false -log=stdout -log-level=debug #{port}"
182
191
  end
183
192
 
184
193
  def seconds_to_hm(seconds)
@@ -188,14 +197,11 @@ module ShopifyCLI
188
197
  def start_ngrok(ctx, port)
189
198
  process = ShopifyCLI::ProcessSupervision.start(:ngrok, ngrok_command(port))
190
199
  log = fetch_url(ctx, process.log_path)
191
- seconds_remaining = (process.time.to_i + log.timeout) - Time.now.to_i
192
- [log.url, log.account, seconds_remaining]
200
+ [log.url, log.account]
193
201
  end
194
202
 
195
203
  def restart_ngrok(ctx, port)
196
- unless ShopifyCLI::ProcessSupervision.stop(:ngrok)
197
- ctx.abort(ctx.message("core.tunnel.error.stop"))
198
- end
204
+ ShopifyCLI::ProcessSupervision.stop(:ngrok)
199
205
  start_ngrok(ctx, port)
200
206
  end
201
207
 
@@ -208,7 +214,7 @@ module ShopifyCLI
208
214
  class LogParser # :nodoc:
209
215
  TIMEOUT = 10
210
216
 
211
- attr_reader :url, :account, :timeout
217
+ attr_reader :url, :account
212
218
 
213
219
  def initialize(log_path)
214
220
  @log_path = log_path
@@ -237,9 +243,8 @@ module ShopifyCLI
237
243
  end
238
244
 
239
245
  def parse_account
240
- account, timeout, _ = @log.match(/AccountName:(.*)\s+SessionDuration:([\d]+) PlanName/)&.captures
246
+ account, _ = @log.match(/AccountName:(.*)\s+SessionDuration/)&.captures
241
247
  @account = account&.empty? ? nil : account
242
- @timeout = timeout&.empty? ? 0 : timeout.to_i
243
248
  end
244
249
 
245
250
  def error
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.7.0"
2
+ VERSION = "2.7.1"
3
3
  end
@@ -222,7 +222,7 @@ module CLI
222
222
  end
223
223
 
224
224
  def which(cmd, env)
225
- exts = os == :windows ? env.fetch('PATHEXT').split(';') : ['']
225
+ exts = os == :windows ? env.fetch('PATHEXT', ['']).split(';') : ['']
226
226
  env.fetch('PATH', '').split(File::PATH_SEPARATOR).each do |path|
227
227
  exts.each do |ext|
228
228
  exe = File.join(path, "#{cmd}#{ext}")
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: 2.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2021-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,6 +150,8 @@ files:
150
150
  - docs/contributors/testing.md
151
151
  - docs/users/installation.md
152
152
  - docs/users/migrate-from-themekit.md
153
+ - ext/javy/javy.rb
154
+ - ext/javy/version
153
155
  - ext/shopify-extensions/extconf.rb
154
156
  - ext/shopify-extensions/shopify_extensions.rb
155
157
  - ext/shopify-extensions/version
@@ -269,6 +271,7 @@ files:
269
271
  - lib/project_types/rails/ruby.rb
270
272
  - lib/project_types/script/cli.rb
271
273
  - lib/project_types/script/commands/create.rb
274
+ - lib/project_types/script/commands/javy.rb
272
275
  - lib/project_types/script/commands/push.rb
273
276
  - lib/project_types/script/config/extension_points.yml
274
277
  - lib/project_types/script/errors.rb