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

Commit e3dd4ff

Browse files
committed
Automate repacking gems for other platforms
1 parent df34e00 commit e3dd4ff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Rakefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'bundler/setup'
22
require 'rspec/core/rake_task'
3+
require 'tmpdir'
34

45
Bundler::GemHelper.install_tasks
56
RSpec::Core::RakeTask.new :spec
@@ -108,3 +109,22 @@ end
108109

109110
task :default => [:compile, :spec]
110111
task :build => [:clean]
112+
113+
task :repack, [:gemfile, :new_arch] do |t, args|
114+
dir = Dir::mktmpdir
115+
116+
begin
117+
sh "gem unpack #{args[:gemfile]} --target=#{dir}"
118+
sh "gem spec #{args[:gemfile]} --ruby > #{dir}/repack.gemspec"
119+
Dir.chdir(dir) do
120+
sh "sed -i 's/^ s.platform = .*$/ s.platform = \"#{args[:new_arch]}\".freeze/' repack.gemspec"
121+
Dir.chdir(Dir.glob("libv8-*/").first) do
122+
sh 'gem build ../repack.gemspec'
123+
end
124+
end
125+
126+
sh "mv #{dir}/*/*.gem ./pkg/"
127+
ensure
128+
FileUtils.remove_entry_secure dir
129+
end
130+
end

0 commit comments

Comments
 (0)