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

Commit

Permalink
Rake tasks for managing shopify-extensions
Browse files Browse the repository at this point in the history
* Supports updating of shopify-extensions through shopify:extensions:update VERSION=vx.y.Z
* Supports symlinking a local development build through shopify:extensions:symlink
  • Loading branch information
t6d committed Sep 17, 2021
1 parent f7c5190 commit abd7361
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ packaging/debian/shopify-cli.deb
packaging/rpm/build
packaging/rpm/shopify-cli.spec
.byebug_history
ext/shopify-extensions/shopify-extensions
ext/shopify-extensions/shopify-extensions
25 changes: 25 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,28 @@ end

desc("Builds all distribution packages of the CLI")
task(package: "package:all")

namespace :shopify do
namespace :extensions do
task :update do
version = ENV.fetch("VERSION").strip
error("Invalid version") unless /^v\d+\.\d+\.\d+/.match(version)
extconf = File.expand_path("../ext/shopify-extensions/extconf.rb", __FILE__)
File.open(extconf) do |f|
IO.write(extconf, f.read.gsub(/(?<=version: ")(.*?)(?=")/, version))
end
end

task :symlink do
root = File.dirname(__FILE__)
executable = File.expand_path("../shopify-cli-extensions/shopify-extensions", root)
error("Unable to find shopify-extensions executable: #{executable}") unless File.executable?(executable)
File.symlink(executable, File.join(root, "ext/shopify-extensions/shopify-extensions"))
end

def error(message, output: STDERR, code: 1)
output.puts(message)
exit(code)
end
end
end

0 comments on commit abd7361

Please sign in to comment.