Class: Mineshaft::Environment
- Inherits:
-
Object
- Object
- Mineshaft::Environment
- Defined in:
- lib/mineshaft/environment.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(dir, options) ⇒ Environment
constructor
A new instance of Environment.
- #use ⇒ Object
Constructor Details
#initialize(dir, options) ⇒ Environment
Returns a new instance of Environment.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mineshaft/environment.rb', line 16 def initialize(dir, ) if [:global] @dir = File.join(Dir.home, ".mineshaft", dir) else @dir = dir end @options = @versions = YAML.load_file(File.join(File.dirname(File.(__FILE__)), '../../versions/versions.yaml')) @version = @options[:version] ? @options[:version] : Mineshaft::Constants::RUBY_VERSION_STABLE end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
14 15 16 |
# File 'lib/mineshaft/environment.rb', line 14 def dir @dir end |
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/mineshaft/environment.rb', line 27 def create FileUtils::mkdir_p(@dir) install_ruby if @options[:global] set_new_global @dir else create_template end end |
#use ⇒ Object
37 38 39 40 |
# File 'lib/mineshaft/environment.rb', line 37 def use set_new_global puts "Now using the environment at: #@dir" end |