Update version according to OSCI-883
[packages/precise/mcollective.git] / ext / packaging.rake
1 build_defs_file = File.join(RAKE_ROOT, 'ext', 'build_defaults.yaml')
2 if File.exist?(build_defs_file)
3   begin
4     require 'yaml'
5     @build_defaults ||= YAML.load_file(build_defs_file)
6   rescue Exception => e
7     STDERR.puts "Unable to load yaml from #{build_defs_file}:"
8     raise e
9   end
10   @packaging_url  = @build_defaults['packaging_url']
11   @packaging_repo = @build_defaults['packaging_repo']
12   raise "Could not find packaging url in #{build_defs_file}" if @packaging_url.nil?
13   raise "Could not find packaging repo in #{build_defs_file}" if @packaging_repo.nil?
14
15   namespace :package do
16     desc "Bootstrap packaging automation, e.g. clone into packaging repo"
17     task :bootstrap do
18       if File.exist?(File.join(RAKE_ROOT, "ext", @packaging_repo))
19         puts "It looks like you already have ext/#{@packaging_repo}. If you don't like it, blow it away with package:implode."
20       else
21         cd File.join(RAKE_ROOT, 'ext') do
22           %x{git clone #{@packaging_url}}
23         end
24       end
25     end
26     desc "Remove all cloned packaging automation"
27     task :implode do
28       rm_rf File.join(RAKE_ROOT, "ext", @packaging_repo)
29     end
30   end
31 end
32
33 begin
34   load File.join(RAKE_ROOT, 'ext', 'packaging', 'packaging.rake')
35 rescue LoadError
36 end