From ca6b95b19c7456994cf51c47bdb9a4ce00e81b74 Mon Sep 17 00:00:00 2001 From: Craig Tracey Date: Mon, 14 May 2012 18:09:01 -0400 Subject: [PATCH] Add support for alternative modulepath --- Rakefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index 9ef7ff1..ff31fcd 100644 --- a/Rakefile +++ b/Rakefile @@ -7,22 +7,25 @@ require 'puppet' -repo_file = 'other_repos.yaml' +repo_file = 'other_repos.yaml' +default_modulepath = '/etc/puppet/modules' namespace :modules do desc 'clone all required modules' task :clone do repo_hash = YAML.load_file(File.join(File.dirname(__FILE__), repo_file)) repos = (repo_hash['repos'] || {}) + modulepath = (repo_hash['modulepath'] || default_modulepath) repos_to_clone = (repos['repo_paths'] || {}) branches_to_checkout = (repos['checkout_branches'] || {}) repos_to_clone.each do |remote, local| # I should check to see if the file is there? - output = `git clone #{remote} #{local}` + outpath = File.join(modulepath, local) + output = `git clone #{remote} #{outpath}` Puppet.debug(output) end branches_to_checkout.each do |local, branch| - Dir.chdir(local) do + Dir.chdir(File.join(modulepath, local)) do output = `git checkout #{branch}` end # Puppet.debug(output) @@ -33,14 +36,15 @@ namespace :modules do task 'status' do repo_hash = YAML.load_file(File.join(File.dirname(__FILE__), repo_file)) repos = (repo_hash['repos'] || {}) + modulepath = (repo_hash['modulepath'] || default_modulepath) repos_to_clone = (repos['repo_paths'] || {}) branches_to_checkout = (repos['checkout_branches'] || {}) repos_to_clone.each do |remote, local| # I should check to see if the file is there? - Dir.chdir(local) do + Dir.chdir(File.join(modulepath, local)) do puts "Checking status of #{local}" puts `git status` end end end -end +end