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

Commit

Permalink
shopify-extensions version
Browse files Browse the repository at this point in the history
The version is now stored in a plain text file instead of being part of
the Ruby code. This makes updating the contents a little easier.
  • Loading branch information
t6d committed Sep 17, 2021
1 parent b804cbb commit 5673c91
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
10 changes: 2 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ namespace :extensions do
task :update do
version = ENV.fetch("VERSION").strip
error("Invalid version") unless /^v\d+\.\d+\.\d+/.match(version)
extconf = Paths.extension("extconf.rb")
File.open(extconf) do |f|
IO.write(extconf, f.read.gsub(/(?<=version: ")(.*?)(?=")/, version))
end
File.write(Paths.extension("version"), version)
end

task :symlink do
Expand All @@ -134,10 +131,7 @@ namespace :extensions do
target = Paths.extension("shopify-extensions")
require_relative Paths.extension("shopify_extensions.rb")
File.delete(target) if File.exist?(target)
ShopifyExtensions.install(
version: "v0.1.0",
target: target
)
ShopifyExtensions.install(target: target)
end

module Paths
Expand Down
1 change: 0 additions & 1 deletion ext/shopify-extensions/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

begin
ShopifyExtensions.install(
version: "v0.1.0",
target: File.join(File.dirname(__FILE__), "shopify-extensions")
)
rescue ShopifyExtensions::InstallationError => error
Expand Down
6 changes: 5 additions & 1 deletion ext/shopify-extensions/shopify_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ def self.call(platform: Platform.new, **args)
new.call(platform: platform, **args)
end

def call(platform:, version:, target:)
def self.version
File.read(File.expand_path("../version", __FILE__)).strip
end

def call(platform:, version: self.class.version, target:)
target = platform.format_path(target.to_s)

asset = Asset.new(
Expand Down
1 change: 1 addition & 0 deletions ext/shopify-extensions/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.1.0

0 comments on commit 5673c91

Please sign in to comment.