Class: Ramaze::Gems::GemStone

Inherits:
Object
  • Object
show all
Defined in:
lib/ramaze/contrib/gems.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ GemStone

Returns a new instance of GemStone.



36
37
38
39
40
# File 'lib/ramaze/contrib/gems.rb', line 36

def initialize(name, options = {})
  @name, @options = name, options
  require 'rubygems/dependency_installer'
  @installer = Gem::DependencyInstaller.new(@options)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



34
35
36
# File 'lib/ramaze/contrib/gems.rb', line 34

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



34
35
36
# File 'lib/ramaze/contrib/gems.rb', line 34

def options
  @options
end

Instance Method Details

#installObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/ramaze/contrib/gems.rb', line 52

def install
  if extconf = (options[:extconf] || Gems.options[:extconf])
    old_argv = ARGV.clone
    ARGV.replace extconf.split(' ')
  end

  print "Installing #{name}..."
  @installer.install name, options[:version]
  puts "done.\n\n"
ensure
  ARGV.replace old_argv if extconf
end

#setup(ran = false) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/ramaze/contrib/gems.rb', line 42

def setup(ran = false)
  Gem.activate(name, *[options[:version]].compact)
  require options[:lib] || name
rescue LoadError => error
  puts error
  return if ran
  install
  setup(ran = true)
end