Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
We should be able to install specific versions of gems, and accuratel…
Browse files Browse the repository at this point in the history
…y install the required versions of their dependencies.
  • Loading branch information
lazyatom committed Aug 16, 2009
1 parent a05a836 commit f7c08fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions lib/rip/packages/remote_gem_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def fetch!

Dir.chdir cache_path do
ui.puts "Installing #{source} via Rubygems..."
unless Sh::Gem.fetch(source)
unless Sh::Gem.fetch(source, version)
FileUtils.rm_rf cache_path
ui.abort "Couldn't find gem #{source} in any of your gem sources"
end
Expand All @@ -35,12 +35,16 @@ def dependencies!
end

def version
actual_package ? actual_package.version : super
local_gem ? actual_package.version : @version
end

memoize :actual_package
def actual_package
Package.for(Dir[cache_path + '/*'].first)
Package.for(local_gem)
end

def local_gem
Dir[cache_path + '/*'].first
end
end
end
6 changes: 4 additions & 2 deletions lib/rip/sh/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def exists?(name)
@@exists_cache[name] ||= rgem("search #{name} --remote").split("\n").select { |f| f =~ /^#{name} / }.any?
end

def fetch(name)
rgem("fetch #{name}") =~ /Downloaded (.+)/
def fetch(name, version=nil)
source_string = name
source_string += " --version '#{version}'" if version
rgem("fetch #{source_string}") =~ /Downloaded (.+)/
end

def dependencies(path_to_gem)
Expand Down

0 comments on commit f7c08fb

Please sign in to comment.