shopify-cli 2.9.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +117 -0
- data/.github/ISSUE_TEMPLATE/enhancement.yaml +38 -0
- data/.github/ISSUE_TEMPLATE/feature.yaml +47 -0
- data/.github/ISSUE_TEMPLATE.md +18 -0
- data/CHANGELOG.md +38 -5
- data/Gemfile.lock +1 -1
- data/dev.yml +3 -0
- data/lib/project_types/extension/commands/build.rb +3 -0
- data/lib/project_types/extension/commands/check.rb +3 -0
- data/lib/project_types/extension/commands/create.rb +3 -0
- data/lib/project_types/extension/commands/push.rb +3 -0
- data/lib/project_types/extension/commands/serve.rb +3 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +1 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +3 -1
- data/lib/project_types/script/cli.rb +5 -0
- data/lib/project_types/script/commands/connect.rb +3 -1
- data/lib/project_types/script/commands/create.rb +2 -0
- data/lib/project_types/script/commands/push.rb +6 -0
- data/lib/project_types/script/config/extension_points.yml +12 -0
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
- data/lib/project_types/script/graphql/module_upload_url_generate.graphql +5 -1
- data/lib/project_types/script/layers/application/build_script.rb +6 -3
- data/lib/project_types/script/layers/application/project_dependencies.rb +1 -1
- data/lib/project_types/script/layers/application/push_script.rb +38 -30
- data/lib/project_types/script/layers/domain/errors.rb +10 -3
- data/lib/project_types/script/layers/domain/extension_point.rb +2 -2
- data/lib/project_types/script/layers/domain/push_package.rb +0 -3
- data/lib/project_types/script/layers/domain/script_config.rb +6 -4
- data/lib/project_types/script/layers/domain/script_project.rb +1 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +47 -24
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +2 -12
- data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +1 -0
- data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +1 -0
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +2 -12
- data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +15 -0
- data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +36 -0
- data/lib/project_types/script/layers/infrastructure/metadata_repository.rb +18 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +7 -8
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -54
- data/lib/project_types/script/layers/infrastructure/script_service.rb +35 -12
- data/lib/project_types/script/layers/infrastructure/script_uploader.rb +22 -9
- data/lib/project_types/script/loaders/project.rb +2 -1
- data/lib/project_types/script/messages/messages.rb +94 -88
- data/lib/project_types/script/ui/error_handler.rb +75 -38
- data/lib/project_types/theme/commands/check.rb +3 -0
- data/lib/project_types/theme/commands/delete.rb +3 -0
- data/lib/project_types/theme/commands/init.rb +3 -0
- data/lib/project_types/theme/commands/language_server.rb +3 -0
- data/lib/project_types/theme/commands/package.rb +3 -0
- data/lib/project_types/theme/commands/publish.rb +3 -0
- data/lib/project_types/theme/commands/pull.rb +12 -1
- data/lib/project_types/theme/commands/push.rb +12 -1
- data/lib/project_types/theme/commands/serve.rb +3 -0
- data/lib/project_types/theme/messages/messages.rb +4 -0
- data/lib/shopify_cli/command/sub_command.rb +2 -0
- data/lib/shopify_cli/command.rb +66 -0
- data/lib/shopify_cli/commands/app/create/node.rb +3 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +3 -0
- data/lib/shopify_cli/commands/app/create.rb +3 -0
- data/lib/shopify_cli/commands/app/deploy.rb +3 -0
- data/lib/shopify_cli/commands/app/serve.rb +3 -0
- data/lib/shopify_cli/commands/login.rb +4 -10
- data/lib/shopify_cli/constants.rb +18 -2
- data/lib/shopify_cli/core/executor.rb +4 -4
- data/lib/shopify_cli/environment.rb +61 -16
- data/lib/shopify_cli/exception_reporter.rb +9 -0
- data/lib/shopify_cli/github/issue_url_generator.rb +19 -8
- data/lib/shopify_cli/identity_auth/env_auth_token.rb +34 -0
- data/lib/shopify_cli/identity_auth.rb +36 -18
- data/lib/shopify_cli/messages/messages.rb +2 -2
- data/lib/shopify_cli/method_object.rb +21 -9
- data/lib/shopify_cli/partners_api.rb +7 -2
- data/lib/shopify_cli/result.rb +61 -59
- data/lib/shopify_cli/services/app/create/rails_service.rb +37 -13
- data/lib/shopify_cli/task.rb +5 -3
- data/lib/shopify_cli/theme/file.rb +2 -2
- data/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
- data/lib/shopify_cli/theme/ignore_filter.rb +14 -18
- data/lib/shopify_cli/theme/include_filter.rb +65 -0
- data/lib/shopify_cli/theme/syncer.rb +17 -2
- data/lib/shopify_cli/utilities.rb +7 -0
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +3 -1
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +11 -6
- data/vendor/deps/cli-kit/lib/cli/kit/util.rb +5 -1
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +6 -4
- data/vendor/deps/ruby2_keywords/LICENSE +22 -0
- data/vendor/deps/ruby2_keywords/README.md +67 -0
- data/vendor/deps/ruby2_keywords/Rakefile +54 -0
- data/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
- data/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
- data/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
- data/vendor/lib/semantic/version.rb +0 -1
- metadata +18 -3
- data/lib/project_types/rails/commands/create.rb +0 -210
@@ -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.
|
4
|
+
version: 2.11.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-
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,6 +118,9 @@ files:
|
|
118
118
|
- ".github/CONTRIBUTING.md"
|
119
119
|
- ".github/DESIGN.md"
|
120
120
|
- ".github/ISSUE_TEMPLATE.md"
|
121
|
+
- ".github/ISSUE_TEMPLATE/bug_report.yaml"
|
122
|
+
- ".github/ISSUE_TEMPLATE/enhancement.yaml"
|
123
|
+
- ".github/ISSUE_TEMPLATE/feature.yaml"
|
121
124
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
122
125
|
- ".github/probots.yml"
|
123
126
|
- ".github/workflows/shopify.yml"
|
@@ -273,7 +276,6 @@ files:
|
|
273
276
|
- lib/project_types/php/forms/create.rb
|
274
277
|
- lib/project_types/php/messages/messages.rb
|
275
278
|
- lib/project_types/rails/cli.rb
|
276
|
-
- lib/project_types/rails/commands/create.rb
|
277
279
|
- lib/project_types/rails/forms/create.rb
|
278
280
|
- lib/project_types/rails/gem.rb
|
279
281
|
- lib/project_types/rails/messages/messages.rb
|
@@ -317,6 +319,9 @@ files:
|
|
317
319
|
- lib/project_types/script/layers/infrastructure/languages/task_runner.rb
|
318
320
|
- lib/project_types/script/layers/infrastructure/languages/typescript_project_creator.rb
|
319
321
|
- lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb
|
322
|
+
- lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb
|
323
|
+
- lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb
|
324
|
+
- lib/project_types/script/layers/infrastructure/metadata_repository.rb
|
320
325
|
- lib/project_types/script/layers/infrastructure/push_package_repository.rb
|
321
326
|
- lib/project_types/script/layers/infrastructure/script_project_repository.rb
|
322
327
|
- lib/project_types/script/layers/infrastructure/script_service.rb
|
@@ -402,6 +407,7 @@ files:
|
|
402
407
|
- lib/shopify_cli/heroku.rb
|
403
408
|
- lib/shopify_cli/http_request.rb
|
404
409
|
- lib/shopify_cli/identity_auth.rb
|
410
|
+
- lib/shopify_cli/identity_auth/env_auth_token.rb
|
405
411
|
- lib/shopify_cli/identity_auth/servlet.rb
|
406
412
|
- lib/shopify_cli/js_deps.rb
|
407
413
|
- lib/shopify_cli/js_system.rb
|
@@ -472,7 +478,9 @@ files:
|
|
472
478
|
- lib/shopify_cli/theme/dev_server/web_server.rb
|
473
479
|
- lib/shopify_cli/theme/development_theme.rb
|
474
480
|
- lib/shopify_cli/theme/file.rb
|
481
|
+
- lib/shopify_cli/theme/filter/path_matcher.rb
|
475
482
|
- lib/shopify_cli/theme/ignore_filter.rb
|
483
|
+
- lib/shopify_cli/theme/include_filter.rb
|
476
484
|
- lib/shopify_cli/theme/mime_type.rb
|
477
485
|
- lib/shopify_cli/theme/syncer.rb
|
478
486
|
- lib/shopify_cli/theme/syncer/error_reporter.rb
|
@@ -483,6 +491,7 @@ files:
|
|
483
491
|
- lib/shopify_cli/thread_pool/job.rb
|
484
492
|
- lib/shopify_cli/transform_data_structure.rb
|
485
493
|
- lib/shopify_cli/tunnel.rb
|
494
|
+
- lib/shopify_cli/utilities.rb
|
486
495
|
- lib/shopify_cli/version.rb
|
487
496
|
- shopify-cli.gemspec
|
488
497
|
- shopify-dev
|
@@ -536,6 +545,12 @@ files:
|
|
536
545
|
- vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb
|
537
546
|
- vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb
|
538
547
|
- vendor/deps/cli-ui/lib/cli/ui/wrap.rb
|
548
|
+
- vendor/deps/ruby2_keywords/LICENSE
|
549
|
+
- vendor/deps/ruby2_keywords/README.md
|
550
|
+
- vendor/deps/ruby2_keywords/Rakefile
|
551
|
+
- vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb
|
552
|
+
- vendor/deps/ruby2_keywords/ruby2_keywords.gemspec
|
553
|
+
- vendor/deps/ruby2_keywords/test/test_keyword.rb
|
539
554
|
- vendor/deps/smart_properties/REVISION
|
540
555
|
- vendor/deps/smart_properties/lib/smart_properties.rb
|
541
556
|
- vendor/deps/smart_properties/lib/smart_properties/errors.rb
|
@@ -1,210 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Rails
|
3
|
-
class Command
|
4
|
-
class Create < ShopifyCLI::Command::AppSubCommand
|
5
|
-
prerequisite_task :ensure_authenticated
|
6
|
-
|
7
|
-
USER_AGENT_CODE = <<~USERAGENT
|
8
|
-
module ShopifyAPI
|
9
|
-
class Base < ActiveResource::Base
|
10
|
-
self.headers['User-Agent'] << " | ShopifyApp/\#{ShopifyApp::VERSION} | Shopify CLI"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
USERAGENT
|
14
|
-
|
15
|
-
DEFAULT_RAILS_FLAGS = %w(--skip-spring)
|
16
|
-
|
17
|
-
options do |parser, flags|
|
18
|
-
# backwards compatibility allow 'title' for now
|
19
|
-
parser.on("--title=TITLE") { |t| flags[:title] = t }
|
20
|
-
parser.on("--name=NAME") { |t| flags[:title] = t }
|
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
|
25
|
-
parser.on("--shop_domain=MYSHOPIFYDOMAIN") { |url| flags[:shop_domain] = url }
|
26
|
-
parser.on("--shop-domain=MYSHOPIFYDOMAIN") { |url| flags[:shop_domain] = url }
|
27
|
-
parser.on("--type=APPTYPE") { |type| flags[:type] = type }
|
28
|
-
parser.on("--db=DB") { |db| flags[:db] = db }
|
29
|
-
parser.on("--rails_opts=RAILSOPTS") { |opts| flags[:rails_opts] = opts }
|
30
|
-
parser.on("--rails-opts=RAILSOPTS") { |opts| flags[:rails_opts] = opts }
|
31
|
-
end
|
32
|
-
|
33
|
-
def call(args, _name)
|
34
|
-
form_data = self.form_data(args)
|
35
|
-
return @ctx.puts(self.class.help) if form_data.nil?
|
36
|
-
|
37
|
-
ruby_version = Ruby.version(@ctx)
|
38
|
-
@ctx.abort(@ctx.message("rails.create.error.invalid_ruby_version")) unless
|
39
|
-
ruby_version.satisfies?("~>2.5") || ruby_version.satisfies?("~>3.0.0")
|
40
|
-
|
41
|
-
check_node
|
42
|
-
check_yarn
|
43
|
-
|
44
|
-
build(form_data.name, form_data.db)
|
45
|
-
|
46
|
-
set_custom_ua
|
47
|
-
ShopifyCLI::Project.write(
|
48
|
-
@ctx,
|
49
|
-
project_type: "rails",
|
50
|
-
organization_id: form_data.organization_id,
|
51
|
-
)
|
52
|
-
|
53
|
-
api_client = if ShopifyCLI::Environment.acceptance_test?
|
54
|
-
{
|
55
|
-
"apiKey" => "public_api_key",
|
56
|
-
"apiSecretKeys" => [
|
57
|
-
{
|
58
|
-
"secret" => "api_secret_key",
|
59
|
-
},
|
60
|
-
],
|
61
|
-
}
|
62
|
-
else
|
63
|
-
ShopifyCLI::Tasks::CreateApiClient.call(
|
64
|
-
@ctx,
|
65
|
-
org_id: form_data.organization_id,
|
66
|
-
title: form_data.title,
|
67
|
-
type: form_data.type,
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
ShopifyCLI::Resources::EnvFile.new(
|
72
|
-
api_key: api_client["apiKey"],
|
73
|
-
secret: api_client["apiSecretKeys"].first["secret"],
|
74
|
-
shop: form_data.shop_domain,
|
75
|
-
scopes: "write_products,write_customers,write_draft_orders",
|
76
|
-
).write(@ctx)
|
77
|
-
|
78
|
-
partners_url = ShopifyCLI::PartnersAPI.partners_url_for(form_data.organization_id, api_client["id"])
|
79
|
-
|
80
|
-
@ctx.puts(@ctx.message("apps.create.info.created", form_data.title, partners_url))
|
81
|
-
@ctx.puts(@ctx.message("apps.create.info.serve", form_data.name, ShopifyCLI::TOOL_NAME, "rails"))
|
82
|
-
unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
|
83
|
-
@ctx.puts(@ctx.message("apps.create.info.install", partners_url, form_data.title))
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def form_data(args)
|
88
|
-
if ShopifyCLI::Environment.acceptance_test?
|
89
|
-
Struct.new(:title, :name, :organization_id, :type, :shop_domain, :db, keyword_init: true).new(
|
90
|
-
title: options.flags[:title],
|
91
|
-
name: options.flags[:title],
|
92
|
-
organization_id: "123",
|
93
|
-
shop_domain: "test.shopify.io",
|
94
|
-
type: "public",
|
95
|
-
db: options.flags[:db]
|
96
|
-
)
|
97
|
-
else
|
98
|
-
Forms::Create.ask(@ctx, args, options.flags)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def self.help
|
103
|
-
ShopifyCLI::Context.message("rails.create.help", ShopifyCLI::TOOL_NAME, ShopifyCLI::TOOL_NAME)
|
104
|
-
end
|
105
|
-
|
106
|
-
private
|
107
|
-
|
108
|
-
def check_node
|
109
|
-
cmd_path = @ctx.which("node")
|
110
|
-
if cmd_path.nil?
|
111
|
-
@ctx.abort(@ctx.message("rails.create.error.node_required")) unless @ctx.windows?
|
112
|
-
@ctx.puts("{{x}} {{red:" + @ctx.message("rails.create.error.node_required") + "}}")
|
113
|
-
@ctx.puts(@ctx.message("rails.create.info.open_new_shell", "node"))
|
114
|
-
raise ShopifyCLI::AbortSilent
|
115
|
-
end
|
116
|
-
|
117
|
-
version, stat = @ctx.capture2e("node", "-v")
|
118
|
-
unless stat.success?
|
119
|
-
@ctx.abort(@ctx.message("rails.create.error.node_version_failure")) unless @ctx.windows?
|
120
|
-
# execution stops above if not Windows
|
121
|
-
@ctx.puts("{{x}} {{red:" + @ctx.message("rails.create.error.node_version_failure") + "}}")
|
122
|
-
@ctx.puts(@ctx.message("rails.create.info.open_new_shell", "node"))
|
123
|
-
raise ShopifyCLI::AbortSilent
|
124
|
-
end
|
125
|
-
|
126
|
-
@ctx.done(@ctx.message("rails.create.node_version", version))
|
127
|
-
end
|
128
|
-
|
129
|
-
def check_yarn
|
130
|
-
cmd_path = @ctx.which("yarn")
|
131
|
-
if cmd_path.nil?
|
132
|
-
@ctx.abort(@ctx.message("rails.create.error.yarn_required")) unless @ctx.windows?
|
133
|
-
@ctx.puts("{{x}} {{red:" + @ctx.message("rails.create.error.yarn_required") + "}}")
|
134
|
-
@ctx.puts(@ctx.message("rails.create.info.open_new_shell", "yarn"))
|
135
|
-
raise ShopifyCLI::AbortSilent
|
136
|
-
end
|
137
|
-
|
138
|
-
version, stat = @ctx.capture2e("yarn", "-v")
|
139
|
-
unless stat.success?
|
140
|
-
@ctx.abort(@ctx.message("rails.create.error.yarn_version_failure")) unless @ctx.windows?
|
141
|
-
@ctx.puts("{{x}} {{red:" + @ctx.message("rails.create.error.yarn_version_failure") + "}}")
|
142
|
-
@ctx.puts(@ctx.message("rails.create.info.open_new_shell", "yarn"))
|
143
|
-
raise ShopifyCLI::AbortSilent
|
144
|
-
end
|
145
|
-
|
146
|
-
@ctx.done(@ctx.message("rails.create.yarn_version", version))
|
147
|
-
end
|
148
|
-
|
149
|
-
def build(name, db)
|
150
|
-
@ctx.abort(@ctx.message("rails.create.error.install_failure", "rails")) unless install_gem("rails", "<6.1")
|
151
|
-
@ctx.abort(@ctx.message("rails.create.error.install_failure", "bundler ~>2.0")) unless
|
152
|
-
install_gem("bundler", "~>2.0")
|
153
|
-
|
154
|
-
full_path = File.join(@ctx.root, name)
|
155
|
-
@ctx.abort(@ctx.message("rails.create.error.dir_exists", name)) if Dir.exist?(full_path)
|
156
|
-
|
157
|
-
CLI::UI::Frame.open(@ctx.message("rails.create.generating_app", name)) do
|
158
|
-
new_command = %w(rails new)
|
159
|
-
new_command << name
|
160
|
-
new_command += DEFAULT_RAILS_FLAGS
|
161
|
-
new_command << "--database=#{db}"
|
162
|
-
new_command += options.flags[:rails_opts].split unless options.flags[:rails_opts].nil?
|
163
|
-
|
164
|
-
syscall(new_command)
|
165
|
-
end
|
166
|
-
|
167
|
-
@ctx.root = full_path
|
168
|
-
|
169
|
-
File.open(File.join(@ctx.root, ".gitignore"), "a") { |f| f.write(".env") }
|
170
|
-
|
171
|
-
@ctx.puts(@ctx.message("rails.create.adding_shopify_gem"))
|
172
|
-
File.open(File.join(@ctx.root, "Gemfile"), "a") do |f|
|
173
|
-
f.puts "\ngem 'shopify_app', '>=17.0.3'"
|
174
|
-
end
|
175
|
-
CLI::UI::Frame.open(@ctx.message("rails.create.running_bundle_install")) do
|
176
|
-
syscall(%w(bundle install))
|
177
|
-
end
|
178
|
-
|
179
|
-
CLI::UI::Frame.open(@ctx.message("rails.create.running_generator")) do
|
180
|
-
syscall(%w(rails generate shopify_app --new-shopify-cli-app))
|
181
|
-
end
|
182
|
-
|
183
|
-
CLI::UI::Frame.open(@ctx.message("rails.create.running_migrations")) do
|
184
|
-
syscall(%w(rails db:create))
|
185
|
-
syscall(%w(rails db:migrate RAILS_ENV=development))
|
186
|
-
end
|
187
|
-
|
188
|
-
unless File.exist?(File.join(@ctx.root, "config/webpacker.yml"))
|
189
|
-
CLI::UI::Frame.open(@ctx.message("rails.create.running_webpacker_install")) do
|
190
|
-
syscall(%w(rails webpacker:install))
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
def set_custom_ua
|
196
|
-
ua_path = File.join("config", "initializers", "user_agent.rb")
|
197
|
-
@ctx.write(ua_path, USER_AGENT_CODE)
|
198
|
-
end
|
199
|
-
|
200
|
-
def syscall(args)
|
201
|
-
args[0] = Gem.binary_path_for(@ctx, args[0])
|
202
|
-
@ctx.system(*args, chdir: @ctx.root)
|
203
|
-
end
|
204
|
-
|
205
|
-
def install_gem(name, version = nil)
|
206
|
-
Gem.install(@ctx, name, version)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|