Skip to content

Commit

Permalink
Make sure that the .sheepsafe dir exists before doing anything.
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed May 9, 2011
1 parent 8987edb commit f68ab47
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/sheepsafe/installer.rb
Expand Up @@ -5,6 +5,7 @@ class Installer
attr_reader :config, :network, :controller

def initialize(config = nil, network = nil, controller = nil)
check_config_path
require 'highline/import'
@config = config || (File.readable?(Sheepsafe::Config::FILE) ? Sheepsafe::Config.new : Sheepsafe::Config.new({}))
@network = network || Sheepsafe::Network.new(@config)
Expand All @@ -22,6 +23,12 @@ def install
announce_done
end

def check_config_path
if !File.directory? "#{ENV['HOME']}/.sheepsafe/"
Dir.mkdir("#{ENV['HOME']}/.sheepsafe/")
end
end

def intro_message
say(<<-MSG)
Welcome to Sheepsafe!
Expand Down

0 comments on commit f68ab47

Please sign in to comment.