Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 167a1b1

Browse files
authored
Merge pull request #737 from Shopify/convert_to_gem_feature
Convert to installer-based CLI
2 parents d039dbe + c4c1a10 commit 167a1b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+873
-1623
lines changed

.github/CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@ We’ll review your pull request and either merge it, request changes to it, or
4242

4343
### Contributor License Agreement (CLA)
4444

45-
Each contributor is required to [sign a CLA](https://cla.shopify.com/). This process is automated as part of your first pull request and is only required once. If any contributor has not signed or does not have an associated GitHub account, the CLA check will fail and the pull request is unable to be merged.
45+
Each contributor is required to [sign a CLA](https://cla.shopify.com/). This process is automated as part of your first pull request and is only required once. If any contributor has not signed or does not have an associated GitHub account, the CLA check will fail and the pull request is unable to be merged.
46+
47+
## Releasing a new version
48+
49+
If you are changing the CLI version, please make sure to update all the places that use it:
50+
* ShopifyCLI::VERSION
51+
* Debian package version under `packaging/debian`

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
.rubocop-*
22
.tmp/*
3-
ngrok*
43
.bundle/*
54
.DS_Store
6-
heroku
75
*.gz
86
.vagrant/
97
*.log
@@ -13,3 +11,9 @@ tmp/
1311
markdown_intermediate
1412
.idea
1513
vendor/bundle
14+
*.gem
15+
packaging/builds
16+
packaging/debian/shopify-cli
17+
packaging/debian/shopify-cli.deb
18+
packaging/rpm/build
19+
packaging/rpm/shopify-cli.spec

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ AllCops:
55
Exclude:
66
- 'vendor/**/*'
77
- 'docs/**/*'
8+
- 'packaging/**/*'
89
TargetRubyVersion: 2.4
910

1011
Layout/EmptyLines:
@@ -24,6 +25,11 @@ Layout/HeredocIndentation:
2425
Style/EmptyLiteral:
2526
Enabled: false
2627

28+
# allow String.new to create mutable strings
29+
Style/HashSyntax:
30+
Exclude:
31+
- 'Rakefile'
32+
2733
# allow using %r{} for regexes
2834
Style/RegexpLiteral:
2935
Enabled: false

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Version 0.9.3
2+
------
3+
* Rebased to master
4+
* Removed auto-generated files from builds directory
5+
6+
Version 0.9.2
7+
------
8+
* Rebased to master, to pull in 7+ Pull Requests
9+
* Updates to dependencies to package files (updated Ruby version)
10+
11+
Version 0.9.1
12+
------
13+
* Updated required Ruby version for the CLI
14+
* Minor fixes for the build / release process
15+
16+
Version 0.9.0
17+
------
18+
* Initial test release of gem-based CLI
File renamed without changes.

RELEASING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Releasing Shopify CLI
2+
3+
1. Check the Semantic Versioning page for info on how to version the new release: http://semver.org
4+
5+
2. Create a branch named `release_X_Y_Z` (replacing `X_Y_Z` with the intended release version)
6+
```
7+
$ git checkout -b release_X_Y_Z
8+
```
9+
10+
3. Update the version of Shopify CLI in `lib/shopify-cli/version.rb`
11+
12+
4. Add an entry for the new release to `CHANGELOG.md`
13+
14+
5. Commit the changes with a commit message like "Packaging for release X.Y.Z"
15+
```
16+
$ git commit -am "Packaging for release vX.Y.Z"
17+
```
18+
19+
6. Push out the changes
20+
```
21+
$ git push -u origin release_X_Y_Z
22+
```
23+
24+
7. Open a PR for the branch, get necessary approvals from code owners and merge into main branch. Note that the PR title will be the release note in Shipit, so make sure it mentions the release
25+
26+
8. Deploy using Shipit
27+
28+
9. On local machine and _AFTER_ gem has been published to https://rubygems.org, run
29+
```
30+
$ rake package
31+
```
32+
This will generate the `.deb`, `.rpm` and brew formula files, which will be located in `packaging/builds/X.Y.Z/`.
33+
34+
10. Clone the `Shopify/homebrew-shopify` repository (if not already cloned), and then
35+
* create a branch named `release_X_Y_Z_of_shopify-cli`
36+
* update the brew formula in `shopify-cli.rb` with the generated formula in `packaging/builds/X.Y.Z/` in the `Shopify/shopify-app-cli` repo (from step 9)
37+
* commit the change and create a PR on the [Shopify Homebrew repository](https://github.com/Shopify/homebrew-shopify)
38+
* when PR is approved, merge into main branch
39+
40+
11. Go to [releases](https://github.com/Shopify/shopify-app-cli/releases) page of `Shopify/shopify-app-cli` repo and create a new release:
41+
* use the tag created in step 8 by Shipit (should be "vX.Y.Z")
42+
* release title = "Version X.Y.Z"
43+
* description should be
44+
```
45+
Release of version X.Y.Z of Shopify App CLI
46+
47+
Please refer to [CHANGELOG](https://github.com/Shopify/shopify-app-cli/blob/master/CHANGELOG.md) for details.
48+
```
49+
* upload the `.deb` and `.rpm` files from `packaging/builds/X.Y.Z/` (generated in step 9)
50+
* if it's a pre-release version, select the "This is a pre-release" checkbox
51+
* and click "Publish release".

Rakefile

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
require_relative 'bin/support/load_shopify'
1+
require_relative 'bin/load_shopify'
22
require 'rake/testtask'
33
require 'rubocop/rake_task'
4+
require 'bundler/gem_tasks'
45

56
Rake::TestTask.new do |t|
67
t.libs += %w(test)
@@ -15,7 +16,7 @@ task(default: [:test, :rubocop])
1516

1617
desc("Start up irb with cli loaded")
1718
task :console do
18-
exec('irb', '-r', './bin/support/load_shopify.rb', '-r', 'byebug')
19+
exec('irb', '-r', './bin/load_shopify.rb', '-r', 'byebug')
1920
end
2021

2122
namespace :rdoc do
@@ -69,3 +70,27 @@ end
6970

7071
desc("Generate markdown documentation and update the wiki")
7172
task(rdoc: 'rdoc:all')
73+
74+
namespace :package do
75+
require 'shopify-cli/packager'
76+
77+
task all: [:debian, :rpm, :homebrew]
78+
79+
desc("Builds a Debian package of the CLI")
80+
task :debian do
81+
ShopifyCli::Packager.new.build_debian
82+
end
83+
84+
desc("Builds an RPM package of the CLI")
85+
task :rpm do
86+
ShopifyCli::Packager.new.build_rpm
87+
end
88+
89+
desc("Builds a Homebrew package of the CLI")
90+
task :homebrew do
91+
ShopifyCli::Packager.new.build_homebrew
92+
end
93+
end
94+
95+
desc("Builds all distribution packages of the CLI")
96+
task(package: 'package:all')
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#!/usr/bin/ruby --disable-gems
1+
#!/usr/bin/env ruby --disable=gems
22

3-
lib_path = File.expand_path("../../../lib", __FILE__)
3+
lib_path = File.expand_path("../../lib", __FILE__)
44
$LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
55

66
ENV['SHELLPID'] ||= Process.ppid.to_s

bin/shopify

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/ruby --disable-gems
1+
#!/usr/bin/env ruby --disable=gems
22

33
module Kernel
44
# make an alias of the original require
@@ -10,28 +10,22 @@ module Kernel
1010
rescue LoadError => e
1111
# Special case for psych (yaml), which rescues this itself
1212
raise if name == "#{RUBY_VERSION[/\d+\.\d+/]}/psych.so"
13-
STDERR.puts "[Note] You cannot use gems in shopify-cli."
13+
STDERR.puts "[Note] You cannot use gems with Shopify App CLI."
1414
STDERR.puts "[LoadError] #{e.message}"
1515
if ENV['DEBUG']
1616
STDERR.puts e.backtrace
1717
STDERR.puts "\n"
1818
end
1919
STDERR.puts " They are disabled."
20-
STDERR.puts " If you are modifying /opt/shopify-cli, please don't."
21-
STDERR.puts " TODO with contribution instructions"
20+
STDERR.puts " Please don't modify the CLI locally."
21+
STDERR.puts " If you would like to contribute to the CLI project, please refer to"
22+
STDERR.puts " https://github.com/Shopify/shopify-app-cli/blob/master/.github/CONTRIBUTING.md"
2223
STDERR.puts "\n"
2324
raise
2425
end
2526
end
2627

27-
require_relative 'support/load_shopify'
28-
29-
# before we've loaded any gems, unset the GEM_HOME etc.
30-
# this is important because we're specifically using /usr/bin/ruby.
31-
# Though we don't use gems here, it's not uncommon for other rubies
32-
# to install alternative json or yaml libraries that take precedence,
33-
# but don't have binary compatibility with this ruby version.
34-
# Dev::Helpers::ChrubyReset.call(ENV)
28+
require_relative './load_shopify'
3529

3630
exit(ShopifyCli::ErrorHandler.call do
3731
ShopifyCli::Core::EntryPoint.call(ARGV.dup)

bin/shopify-cli-shell-support

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)