lib/myosx/config.rb in myosx-0.2.2 vs lib/myosx/config.rb in myosx-0.2.4

- old
+ new

@@ -3,25 +3,24 @@ # require 'yaml' require 'git' class Config - def initialize - config_location = ENV['MYOSX_CONFIG'] || '~/.myosx.cnf' - config_file = File.expand_path(config_location) - raise "Cannot find config file: #{config_file}" unless File.exist?(config_file) - $global_config = YAML.load_file(config_file) - $workspace = workspace_directory + def config_file + ENV["MYOSX_CONFIG"] || File.expand_path('~/.myosx.cnf') end + def global + YAML.load_file(config_file) + end + def workspace_directory - workspace_dir_name = ENV['MYOSX_WORKSPACE'] || '~/.myosx/' - return File.expand_path(workspace_dir_name) + ENV['MYOSX_WORKSPACE'] || File.expand_path('~/.myosx/') end - def create_workspace - unless Dir.exists?($workspace) - puts "Creating workspace: #{workspace_directory}" - Dir.mkdir("#{workspace_directory}", 0750) + def create_workspace(directory) + unless Dir.exists?(directory) + puts "Creating workspace: #{directory}" + Dir.mkdir("#{directory}", 0750) end end end