lib/shaddox/shadow.rb in shaddox-0.0.14 vs lib/shaddox/shadow.rb in shaddox-0.0.15
- old
+ new
@@ -51,11 +51,19 @@
def mkdir(path)
info "Ensuring directory '#{path}' exists", 1 if @verbose
FileUtils::mkdir_p(path.exp_path)
end
+ def ensure_git()
+ unless @git_installed
+ install 'git'
+ @git_installed = true
+ end
+ end
+
def repo_clone(repo_key, path)
+ ensure_git()
repo = @repos[repo_key]
cd path do
case repo.vcs
when :git
sh "git clone #{repo.url}"
@@ -76,16 +84,18 @@
end
puts "-------------------"
end
raise "No installer specified for this target!" unless @installer
info "Ensuring #{package} is installed with #{@installer}", 1 if @verbose
- unless system("type #{package} >/dev/null 2>&1")
+ package_installed = lambda { system("type #{package} >/dev/null 2>&1") }
+ unless package_installed.call()
case @installer
when :apt
sh "sudo apt-get install -y #{package}"
when :brew
sh "brew install #{package}"
end
end
+ raise "#{package} could not be installed." unless package_installed.call()
end
end
end