-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Post bundle install script to setup the gems from github branches
Signed-off-by: Ashique Saidalavi <[email protected]>
- Loading branch information
Showing
3 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env ruby | ||
|
||
gem_home = Gem.paths.home | ||
|
||
puts "fixing bundle installed gems in #{gem_home}" | ||
|
||
# Install gems from git repos. This makes the assumption that there is a <gem_name>.gemspec and | ||
# you can simply gem build + gem install the resulting gem, so nothing fancy. This does not use | ||
# rake install since we need --conservative --minimal-deps in order to not install duplicate gems. | ||
# | ||
# | ||
puts "gem path #{gem_home}" | ||
|
||
Dir["#{gem_home}/bundler/gems/*"].each do |gempath| | ||
puts "#{gempath}" | ||
matches = File.basename(gempath).match(/.*-[A-Fa-f0-9]{12}/) | ||
next unless matches | ||
|
||
gem_name = File.basename(Dir["#{gempath}/*.gemspec"].first, ".gemspec") | ||
# FIXME: should strip any valid ruby platform off of the gem_name if it matches | ||
|
||
next unless gem_name | ||
|
||
puts "re-installing #{gem_name}..." | ||
|
||
Dir.chdir(gempath) do | ||
system("gem build #{gem_name}.gemspec") or raise "gem build failed" | ||
system("gem install #{gem_name}*.gem --conservative --minimal-deps --no-document") or raise "gem install failed" | ||
end | ||
end |