Class: Ramaze::Gems::GemStone
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ GemStone
constructor
A new instance of GemStone.
- #install ⇒ Object
- #setup(ran = false) ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ GemStone
Returns a new instance of GemStone.
25 26 27 |
# File 'lib/ramaze/contrib/gems.rb', line 25 def initialize(name, = {}) @name, @options = name, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/ramaze/contrib/gems.rb', line 23 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
23 24 25 |
# File 'lib/ramaze/contrib/gems.rb', line 23 def @options end |
Instance Method Details
#install ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ramaze/contrib/gems.rb', line 40 def install require 'rubygems/gem_runner' version, source = .values_at(:version, :source) cmd = %w[install] << name cmd << "--version" << version if version cmd << "--source" << source if source print cmd * ' ' Gem::GemRunner.new.run(cmd) end |
#setup(ran = false) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ramaze/contrib/gems.rb', line 29 def setup(ran = false) Gem.activate(name, *[@options[:version]].compact) require [:lib] || name rescue LoadError => error puts error return if ran puts "attempting install" install setup(ran = true) end |