Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

upgrade rubygems/setup code

  • Loading branch information...
commit 9c23f10a5ab5d08cf3b085a927b17b317454b8a2 1 parent 58fd5b6
@mpapis mpapis authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 lib/shoes/setup.rb
View
20 lib/shoes/setup.rb
@@ -24,12 +24,13 @@ class Shoes::Setup
def self.init
gem_reset
- install_sources if Gem.source_index.find_name('sources').empty?
+ Gem::Specification.find_by_name('sources')
+ rescue Gem::LoadError
+ install_sources
end
def self.gem_reset
Gem.use_paths(GEM_DIR, [GEM_DIR, GEM_CENTRAL_DIR])
- Gem.source_index.refresh!
end
def self.setup_app(setup)
@@ -97,11 +98,9 @@ def no_steps?
def gem name, version = nil
arg = "#{name} #{version}".strip
name, version = arg.split(/\s+/, 2)
- if Gem.source_index.find_name(name, version).empty?
- @steps << [:gem, arg]
- else
- activate_gem(name, version)
- end
+ Gem::Specification.find_by_name(name, version)
+ rescue Gem::LoadError
+ @steps << [:gem, arg]
end
def source uri
@@ -109,8 +108,7 @@ def source uri
end
def activate_gem(name, version)
- gem = Gem.source_index.find_name(name, version).first
- Gem.activate(gem.name, "= #{gem.version}")
+ Gem::Specification.find_by_name(name, version).activate
end
def start(app)
@@ -125,7 +123,9 @@ def start(app)
name, version = arg.split(/\s+/, 2)
count += 1
ui.say "Looking for #{name}"
- if Gem.source_index.find_name(name, version).empty?
+ begin
+ Gem::Specification.find_by_name(name, version)
+ rescue Gem::LoadError
ui.title "Installing #{name}"
installer = Gem::DependencyInstaller.new
begin
Please sign in to comment.
Something went wrong with that request. Please try again.