shopify-cli 2.9.0 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -2
  3. data/Gemfile.lock +1 -1
  4. data/lib/project_types/script/layers/domain/errors.rb +3 -2
  5. data/lib/project_types/script/layers/domain/script_config.rb +6 -4
  6. data/lib/project_types/script/layers/infrastructure/errors.rb +37 -24
  7. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +28 -28
  8. data/lib/project_types/script/layers/infrastructure/script_service.rb +22 -5
  9. data/lib/project_types/script/messages/messages.rb +15 -17
  10. data/lib/project_types/script/ui/error_handler.rb +41 -29
  11. data/lib/project_types/theme/commands/pull.rb +6 -1
  12. data/lib/project_types/theme/commands/push.rb +6 -1
  13. data/lib/project_types/theme/messages/messages.rb +4 -0
  14. data/lib/shopify_cli/commands/login.rb +4 -10
  15. data/lib/shopify_cli/constants.rb +6 -2
  16. data/lib/shopify_cli/core/executor.rb +4 -4
  17. data/lib/shopify_cli/environment.rb +35 -16
  18. data/lib/shopify_cli/identity_auth.rb +3 -3
  19. data/lib/shopify_cli/messages/messages.rb +1 -1
  20. data/lib/shopify_cli/method_object.rb +21 -9
  21. data/lib/shopify_cli/result.rb +61 -59
  22. data/lib/shopify_cli/task.rb +5 -3
  23. data/lib/shopify_cli/theme/dev_server/cdn/cdn_helper.rb +49 -0
  24. data/lib/shopify_cli/theme/dev_server/cdn_assets.rb +69 -0
  25. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +8 -28
  26. data/lib/shopify_cli/theme/dev_server/local_assets.rb +4 -0
  27. data/lib/shopify_cli/theme/dev_server.rb +2 -0
  28. data/lib/shopify_cli/theme/file.rb +2 -2
  29. data/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
  30. data/lib/shopify_cli/theme/ignore_filter.rb +14 -18
  31. data/lib/shopify_cli/theme/include_filter.rb +43 -0
  32. data/lib/shopify_cli/theme/syncer.rb +17 -2
  33. data/lib/shopify_cli/version.rb +1 -1
  34. data/lib/shopify_cli.rb +2 -1
  35. data/vendor/deps/ruby2_keywords/LICENSE +22 -0
  36. data/vendor/deps/ruby2_keywords/README.md +67 -0
  37. data/vendor/deps/ruby2_keywords/Rakefile +54 -0
  38. data/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
  39. data/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
  40. data/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
  41. metadata +12 -2
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "filter/path_matcher"
4
+
3
5
  module ShopifyCLI
4
6
  module Theme
5
7
  class IgnoreFilter
8
+ include Filter::PathMatcher
9
+
6
10
  FILE = ".shopifyignore"
7
11
 
8
12
  DEFAULT_REGEXES = [
@@ -72,11 +76,11 @@ module ShopifyCLI
72
76
  return true if path.empty?
73
77
 
74
78
  regexes.each do |regex|
75
- return true if regex.match(path)
79
+ return true if regex_match?(regex, path)
76
80
  end
77
81
 
78
82
  globs.each do |glob|
79
- return true if ::File.fnmatch?(glob, path)
83
+ return true if glob_match?(glob, path)
80
84
  end
81
85
 
82
86
  false
@@ -91,24 +95,16 @@ module ShopifyCLI
91
95
  new_regexes = DEFAULT_REGEXES.dup
92
96
  new_globs = DEFAULT_GLOBS.dup
93
97
 
94
- patterns.each do |pattern|
95
- pattern = pattern.strip
96
-
97
- if pattern.start_with?("/") && pattern.end_with?("/")
98
- new_regexes << Regexp.new(pattern.gsub(%r{^\/|\/$}, ""))
99
- next
98
+ patterns
99
+ .map(&:strip)
100
+ .each do |pattern|
101
+ if regex?(pattern)
102
+ new_regexes << as_regex(pattern)
103
+ else
104
+ new_globs << as_glob(pattern)
105
+ end
100
106
  end
101
107
 
102
- # if specifying a directory, match everything below it
103
- pattern += "*" if pattern.end_with?("/")
104
-
105
- # The pattern will be scoped to root directory, so it should match anything
106
- # within that space
107
- pattern.prepend("*") unless pattern.start_with?("*")
108
-
109
- new_globs << pattern
110
- end
111
-
112
108
  [new_regexes, new_globs]
113
109
  end
114
110
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "filter/path_matcher"
4
+
5
+ module ShopifyCLI
6
+ module Theme
7
+ class IncludeFilter
8
+ include Filter::PathMatcher
9
+
10
+ def initialize(pattern = nil)
11
+ @pattern = pattern
12
+ end
13
+
14
+ def match?(path)
15
+ return true unless present?(@pattern)
16
+
17
+ if regex_pattern?
18
+ regex_match?(regex_pattern, path)
19
+ else
20
+ glob_match?(glob_pattern, path)
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def present?(pattern)
27
+ !pattern.nil? && !pattern.empty?
28
+ end
29
+
30
+ def regex_pattern?
31
+ @is_regex_pattern ||= regex?(@pattern)
32
+ end
33
+
34
+ def regex_pattern
35
+ @regex_pattern ||= as_regex(@pattern)
36
+ end
37
+
38
+ def glob_pattern
39
+ @glob_pattern ||= as_glob(@pattern)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -16,13 +16,15 @@ module ShopifyCLI
16
16
  API_VERSION = "unstable"
17
17
 
18
18
  attr_reader :checksums
19
+ attr_accessor :include_filter
19
20
  attr_accessor :ignore_filter
20
21
 
21
22
  def_delegators :@error_reporter, :has_any_error?
22
23
 
23
- def initialize(ctx, theme:, ignore_filter: nil)
24
+ def initialize(ctx, theme:, include_filter: nil, ignore_filter: nil)
24
25
  @ctx = ctx
25
26
  @theme = theme
27
+ @include_filter = include_filter
26
28
  @ignore_filter = ignore_filter
27
29
  @error_reporter = ErrorReporter.new(ctx)
28
30
  @standard_reporter = StandardReporter.new(ctx)
@@ -193,7 +195,7 @@ module ShopifyCLI
193
195
  # Already enqueued
194
196
  return if @pending.include?(operation)
195
197
 
196
- if @ignore_filter&.ignore?(operation.file_path)
198
+ if ignore?(operation)
197
199
  @ctx.debug("ignore #{operation.file_path}")
198
200
  return
199
201
  end
@@ -251,6 +253,19 @@ module ShopifyCLI
251
253
  response
252
254
  end
253
255
 
256
+ def ignore?(operation)
257
+ path = operation.file_path
258
+ ignored_by_ignore_filter?(path) || ignored_by_include_filter?(path)
259
+ end
260
+
261
+ def ignored_by_ignore_filter?(path)
262
+ ignore_filter&.ignore?(path)
263
+ end
264
+
265
+ def ignored_by_include_filter?(path)
266
+ include_filter && !include_filter.match?(path)
267
+ end
268
+
254
269
  def get(file)
255
270
  _status, body, response = ShopifyCLI::AdminAPI.rest_request(
256
271
  @ctx,
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.9.0"
2
+ VERSION = "2.10.0"
3
3
  end
data/lib/shopify_cli.rb CHANGED
@@ -15,12 +15,13 @@ ENV["PATH"] = ENV["PATH"].split(":").select { |p| p.start_with?("/", "~") }.join
15
15
  vendor_path = File.expand_path("../../vendor/lib", __FILE__)
16
16
  $LOAD_PATH.unshift(vendor_path) unless $LOAD_PATH.include?(vendor_path)
17
17
 
18
- deps = %w(cli-ui cli-kit smart_properties webrick)
18
+ deps = %w(cli-ui cli-kit smart_properties ruby2_keywords webrick)
19
19
  deps.each do |dep|
20
20
  vendor_path = File.expand_path("../../vendor/deps/#{dep}/lib", __FILE__)
21
21
  $LOAD_PATH.unshift(vendor_path) unless $LOAD_PATH.include?(vendor_path)
22
22
  end
23
23
 
24
+ require "ruby2_keywords"
24
25
  require "cli/ui"
25
26
  require "cli/kit"
26
27
  require "smart_properties"
@@ -0,0 +1,22 @@
1
+ Copyright 2019-2020 Nobuyoshi Nakada, Yusuke Endoh
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,67 @@
1
+ # ruby2_keywords
2
+
3
+ Provides empty `Module#ruby2_keywords` method, for the forward
4
+ source-level compatibility against ruby2.7 and ruby3.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ruby2_keywords'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install ruby2_keywords
21
+
22
+ ## Usage
23
+
24
+ For class/module instance methods:
25
+
26
+ ```ruby
27
+ require 'ruby2_keywords'
28
+
29
+ module YourModule
30
+ ruby2_keywords def delegating_method(*args)
31
+ other_method(*args)
32
+ end
33
+ end
34
+ ```
35
+
36
+ For global methods:
37
+
38
+ ```ruby
39
+ require 'ruby2_keywords'
40
+
41
+ ruby2_keywords def oldstyle_keywords(options = {})
42
+ end
43
+ ```
44
+
45
+ You can do the same for a method defined by `Module#define_method`:
46
+
47
+ ```ruby
48
+ define_method :delegating_method do |*args, &block|
49
+ other_method(*args, &block)
50
+ end
51
+ ruby2_keywords :delegating_method
52
+ ```
53
+
54
+ ## Contributing
55
+
56
+ Bug reports and pull requests are welcome on [GitHub] or
57
+ [Ruby Issue Tracking System].
58
+
59
+ ## License
60
+
61
+ The gem is available as open source under the terms of the
62
+ [Ruby License] or the [2-Clause BSD License].
63
+
64
+ [GitHub]: https://github.com/ruby/ruby2_keywords/
65
+ [Ruby Issue Tracking System]: https://bugs.ruby-lang.org
66
+ [Ruby License]: https://www.ruby-lang.org/en/about/license.txt
67
+ [2-Clause BSD License]: https://opensource.org/licenses/BSD-2-Clause
@@ -0,0 +1,54 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ helper = Bundler::GemHelper.instance
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.test_files = FileList["test/**/test_*.rb"]
8
+ end
9
+
10
+ task :default => :test
11
+
12
+ task "build" => "date_epoch"
13
+
14
+ task "date_epoch" do
15
+ ENV["SOURCE_DATE_EPOCH"] = IO.popen(%W[git -C #{__dir__} log -1 --format=%ct], &:read).chomp
16
+ end
17
+
18
+ def helper.update_gemspec
19
+ path = "#{__dir__}/#{gemspec.name}.gemspec"
20
+ File.open(path, "r+b") do |f|
21
+ if (d = f.read).sub!(/^(version\s*=\s*)".*"/) {$1 + gemspec.version.to_s.dump}
22
+ f.rewind
23
+ f.truncate(0)
24
+ f.print(d)
25
+ end
26
+ end
27
+ end
28
+
29
+ def helper.commit_bump
30
+ sh(%W[git -C #{__dir__} commit -m bump\ up\ to\ #{gemspec.version}
31
+ #{gemspec.name}.gemspec])
32
+ end
33
+
34
+ def helper.version=(v)
35
+ gemspec.version = v
36
+ update_gemspec
37
+ commit_bump
38
+ tag_version
39
+ end
40
+ major, minor, teeny = helper.gemspec.version.segments
41
+
42
+ task "bump:teeny" do
43
+ helper.version = Gem::Version.new("#{major}.#{minor}.#{teeny+1}")
44
+ end
45
+
46
+ task "bump:minor" do
47
+ raise "can't bump up minor"
48
+ end
49
+
50
+ task "bump:major" do
51
+ raise "can't bump up major"
52
+ end
53
+
54
+ task "bump" => "bump:teeny"
@@ -0,0 +1,57 @@
1
+ class Module
2
+ unless private_method_defined?(:ruby2_keywords)
3
+ private
4
+ # call-seq:
5
+ # ruby2_keywords(method_name, ...)
6
+ #
7
+ # Does nothing.
8
+ def ruby2_keywords(name, *)
9
+ # nil
10
+ end
11
+ end
12
+ end
13
+
14
+ main = TOPLEVEL_BINDING.receiver
15
+ unless main.respond_to?(:ruby2_keywords, true)
16
+ # call-seq:
17
+ # ruby2_keywords(method_name, ...)
18
+ #
19
+ # Does nothing.
20
+ def main.ruby2_keywords(name, *)
21
+ # nil
22
+ end
23
+ end
24
+
25
+ class Proc
26
+ unless method_defined?(:ruby2_keywords)
27
+ # call-seq:
28
+ # proc.ruby2_keywords -> proc
29
+ #
30
+ # Does nothing and just returns the receiver.
31
+ def ruby2_keywords
32
+ self
33
+ end
34
+ end
35
+ end
36
+
37
+ class << Hash
38
+ unless method_defined?(:ruby2_keywords_hash?)
39
+ # call-seq:
40
+ # Hash.ruby2_keywords_hash?(hash) -> false
41
+ #
42
+ # Returns false.
43
+ def ruby2_keywords_hash?(hash)
44
+ false
45
+ end
46
+ end
47
+
48
+ unless method_defined?(:ruby2_keywords_hash)
49
+ # call-seq:
50
+ # Hash.ruby2_keywords_hash(hash) -> new_hash
51
+ #
52
+ # Duplicates a given hash and returns the new hash.
53
+ def ruby2_keywords_hash(hash)
54
+ hash.dup
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,18 @@
1
+ version = "0.0.4"
2
+ abort "Version must not reach 1" if version[/\d+/].to_i >= 1
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "ruby2_keywords"
6
+ s.version = version
7
+ s.summary = "Shim library for Module#ruby2_keywords"
8
+ s.homepage = "https://github.com/ruby/ruby2_keywords"
9
+ s.licenses = ["Ruby", "BSD-2-Clause"]
10
+ s.authors = ["Nobuyoshi Nakada"]
11
+ s.require_paths = ["lib"]
12
+ s.rdoc_options = ["--main", "README.md"]
13
+ s.files = [
14
+ "LICENSE",
15
+ "README.md",
16
+ "lib/ruby2_keywords.rb",
17
+ ]
18
+ end
@@ -0,0 +1,41 @@
1
+ require 'test/unit'
2
+ LOADING_RUBY2_KEYWORDS = (RUBY_VERSION.scan(/\d+/).map(&:to_i) <=> [2, 7]) < 0
3
+ if LOADING_RUBY2_KEYWORDS
4
+ require 'ruby2_keywords'
5
+ end
6
+
7
+ class TestKeywordArguments < Test::Unit::TestCase
8
+ def test_loaded_features
9
+ list = $LOADED_FEATURES.grep(%r[/ruby2_keywords\.rb\z])
10
+ if LOADING_RUBY2_KEYWORDS
11
+ assert_not_empty(list)
12
+ assert_not_include($LOADED_FEATURES, "ruby2_keywords.rb")
13
+ else
14
+ assert_empty(list)
15
+ assert_include($LOADED_FEATURES, "ruby2_keywords.rb")
16
+ end
17
+ end
18
+
19
+ def test_module_ruby2_keywords
20
+ assert_send([Module, :private_method_defined?, :ruby2_keywords])
21
+ assert_operator(Module.instance_method(:ruby2_keywords).arity, :<, 0)
22
+ end
23
+
24
+ def test_toplevel_ruby2_keywords
25
+ main = TOPLEVEL_BINDING.receiver
26
+ assert_send([main, :respond_to?, :ruby2_keywords, true])
27
+ assert_operator(main.method(:ruby2_keywords).arity, :<, 0)
28
+ end
29
+
30
+ def test_proc_ruby2_keywords
31
+ assert_respond_to(Proc.new {}, :ruby2_keywords)
32
+ end
33
+
34
+ def test_hash_ruby2_keywords_hash?
35
+ assert_false(Hash.ruby2_keywords_hash?({}))
36
+ end
37
+
38
+ def test_hash_ruby2_keywords_hash
39
+ assert_equal({}, Hash.ruby2_keywords_hash({}.freeze))
40
+ end
41
+ end
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.9.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-17 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -458,6 +458,8 @@ files:
458
458
  - lib/shopify_cli/tasks/select_org_and_shop.rb
459
459
  - lib/shopify_cli/tasks/update_dashboard_urls.rb
460
460
  - lib/shopify_cli/theme/dev_server.rb
461
+ - lib/shopify_cli/theme/dev_server/cdn/cdn_helper.rb
462
+ - lib/shopify_cli/theme/dev_server/cdn_assets.rb
461
463
  - lib/shopify_cli/theme/dev_server/cdn_fonts.rb
462
464
  - lib/shopify_cli/theme/dev_server/certificate_manager.rb
463
465
  - lib/shopify_cli/theme/dev_server/header_hash.rb
@@ -472,7 +474,9 @@ files:
472
474
  - lib/shopify_cli/theme/dev_server/web_server.rb
473
475
  - lib/shopify_cli/theme/development_theme.rb
474
476
  - lib/shopify_cli/theme/file.rb
477
+ - lib/shopify_cli/theme/filter/path_matcher.rb
475
478
  - lib/shopify_cli/theme/ignore_filter.rb
479
+ - lib/shopify_cli/theme/include_filter.rb
476
480
  - lib/shopify_cli/theme/mime_type.rb
477
481
  - lib/shopify_cli/theme/syncer.rb
478
482
  - lib/shopify_cli/theme/syncer/error_reporter.rb
@@ -536,6 +540,12 @@ files:
536
540
  - vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb
537
541
  - vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb
538
542
  - vendor/deps/cli-ui/lib/cli/ui/wrap.rb
543
+ - vendor/deps/ruby2_keywords/LICENSE
544
+ - vendor/deps/ruby2_keywords/README.md
545
+ - vendor/deps/ruby2_keywords/Rakefile
546
+ - vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb
547
+ - vendor/deps/ruby2_keywords/ruby2_keywords.gemspec
548
+ - vendor/deps/ruby2_keywords/test/test_keyword.rb
539
549
  - vendor/deps/smart_properties/REVISION
540
550
  - vendor/deps/smart_properties/lib/smart_properties.rb
541
551
  - vendor/deps/smart_properties/lib/smart_properties/errors.rb