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

Commit

Permalink
rake extensions:install & disable auto install
Browse files Browse the repository at this point in the history
  • Loading branch information
t6d committed Sep 17, 2021
1 parent e3890eb commit a8d12cb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
45 changes: 26 additions & 19 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,27 +112,34 @@ 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
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
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
task :install do
ruby_extension_dir = File.join(File.dirname(__FILE__), "ext", "shopify-extensions")
require_relative File.join(ruby_extension_dir, "shopify_extensions.rb")
ShopifyExtensions.install(
version: "v0.1.0",
target: File.join(ruby_extension_dir, "shopify-extensions")
)
end
end

def error(message, output: STDERR, code: 1)
output.puts(message)
exit(code)
end
2 changes: 1 addition & 1 deletion shopify-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
end
spec.bindir = "bin"
spec.require_paths = ["lib", "vendor"]
spec.extensions = ["ext/shopify-cli/extconf.rb", "ext/shopify-extensions/extconf.rb"]
spec.extensions = ["ext/shopify-cli/extconf.rb"]
# Do NOT include `shopify` as a listed executable via `spec.executables`.
# `ext/shopify-cli/extconf.rb` will dynamically create a script and soft-link
# `/usr/local/bin/shopify` to that script, in order to "lock" the Ruby used to
Expand Down

0 comments on commit a8d12cb

Please sign in to comment.