|
29 | 29 |
|
30 | 30 | namespace :pl_ci do
|
31 | 31 | desc 'Build puppet gems'
|
32 |
| - task :gem_build do |
33 |
| - 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') |
| 32 | + task :gem_build, [:gemspec] do |t, args| |
| 33 | + args.with_defaults(gemspec: 'puppet.gemspec') |
| 34 | + stdout, stderr, status = Open3.capture3(<<~END) |
| 35 | + gem build #{args.gemspec} --platform x86-mingw32 && \ |
| 36 | + gem build #{args.gemspec} --platform x64-mingw32 && \ |
| 37 | + gem build #{args.gemspec} --platform universal-darwin && \ |
| 38 | + gem build #{args.gemspec} |
| 39 | + END |
34 | 40 | if !status.exitstatus.zero?
|
35 |
| - puts "Error building facter.gemspec \n#{stdout} \n#{stderr}" |
| 41 | + puts "Error building #{args.gemspec}\n#{stdout} \n#{stderr}" |
36 | 42 | exit(1)
|
37 | 43 | else
|
38 | 44 | puts stdout
|
39 | 45 | end
|
40 | 46 | end
|
| 47 | + |
| 48 | + desc 'build the nightly puppet gems' |
| 49 | + task :nightly_gem_build do |
| 50 | + # this is taken from `rake package:nightly_gem` |
| 51 | + extended_dot_version = %x{git describe --tags --dirty --abbrev=7}.chomp.tr('-', '.') |
| 52 | + |
| 53 | + # we must create tempfile in the same directory as puppetg.gemspec, since |
| 54 | + # it uses __dir__ to determine which files to include |
| 55 | + require 'tempfile' |
| 56 | + Tempfile.create('gemspec', __dir__) do |dst| |
| 57 | + File.open('puppet.gemspec', 'r') do |src| |
| 58 | + src.readlines.each do |line| |
| 59 | + if line.match?(/version\s*=\s*['"][0-9.]+['"]/) |
| 60 | + line = "spec.version = '#{extended_dot_version}'" |
| 61 | + end |
| 62 | + dst.puts line |
| 63 | + end |
| 64 | + end |
| 65 | + dst.flush |
| 66 | + Rake::Task['pl_ci:gem_build'].invoke(dst.path) |
| 67 | + end |
| 68 | + end |
41 | 69 | end
|
42 | 70 |
|
43 | 71 | task :spec do
|
|
0 commit comments