|
47 | 47 |
|
48 | 48 | namespace :pl_ci do
|
49 | 49 | desc 'Build puppet gems'
|
50 |
| - task :gem_build do |
51 |
| - stdout, stderr, status = Open3.capture3('gem build puppet.gemspec --platform x86-mingw32 && gem build puppet.gemspec --platform x64-mingw32 && gem build puppet.gemspec --platform universal-darwin && gem build puppet.gemspec') |
| 50 | + task :gem_build, [:gemspec] do |t, args| |
| 51 | + args.with_defaults(gemspec: 'puppet.gemspec') |
| 52 | + stdout, stderr, status = Open3.capture3(<<~END) |
| 53 | + gem build #{args.gemspec} --platform x86-mingw32 && \ |
| 54 | + gem build #{args.gemspec} --platform x64-mingw32 && \ |
| 55 | + gem build #{args.gemspec} --platform universal-darwin && \ |
| 56 | + gem build #{args.gemspec} |
| 57 | + END |
52 | 58 | if !status.exitstatus.zero?
|
53 |
| - puts "Error building facter.gemspec \n#{stdout} \n#{stderr}" |
| 59 | + puts "Error building #{args.gemspec}\n#{stdout} \n#{stderr}" |
54 | 60 | exit(1)
|
55 | 61 | else
|
56 | 62 | puts stdout
|
57 | 63 | end
|
58 | 64 | end
|
| 65 | + |
| 66 | + desc 'build the nightly puppet gems' |
| 67 | + task :nightly_gem_build do |
| 68 | + # this is taken from `rake package:nightly_gem` |
| 69 | + extended_dot_version = %x{git describe --tags --dirty --abbrev=7}.chomp.tr('-', '.') |
| 70 | + |
| 71 | + # we must create tempfile in the same directory as puppetg.gemspec, since |
| 72 | + # it uses __dir__ to determine which files to include |
| 73 | + require 'tempfile' |
| 74 | + Tempfile.create('gemspec', __dir__) do |dst| |
| 75 | + File.open('puppet.gemspec', 'r') do |src| |
| 76 | + src.readlines.each do |line| |
| 77 | + if line.match?(/version\s*=\s*['"][0-9.]+['"]/) |
| 78 | + line = "spec.version = '#{extended_dot_version}'" |
| 79 | + end |
| 80 | + dst.puts line |
| 81 | + end |
| 82 | + end |
| 83 | + dst.flush |
| 84 | + Rake::Task['pl_ci:gem_build'].invoke(dst.path) |
| 85 | + end |
| 86 | + end |
59 | 87 | end
|
60 | 88 |
|
61 | 89 | task :spec do
|
|
0 commit comments