Sha256: 14adb4c953f9c3bddb2f0ac7e4ab424d9c3bcafa788a1a06e139dc9e6bb9bdcf

Contents?: true

Size: 1.62 KB

Versions: 33

Compression:

Stored size: 1.62 KB

Contents

require 'simp/rake/build/constants'

module Simp; end
module Simp::Rake; end
module Simp::Rake::Build

  class Spec < ::Rake::TaskLib
    include Simp::Rake::Build::Constants

    def initialize( base_dir )
      init_member_vars( base_dir )
      @mock = ENV['mock'] || '/usr/bin/mock'
      define_tasks
    end

    def define_tasks
      namespace :spec do

        desc "Bump spec files. Bump all spec files' release numbers up by one.
       * :list - Flag to just print the current version numbers."
        task :bump,[:list] do |t,args|
          (
            Dir.glob("#{@spec_dir}/*.spec") +
            Dir.glob("#{@src_dir}/puppet/modules/*/pkg/pupmod-*.spec")
          ).each do |spec|
            if args.list then
              File.open(spec).each do |line|
                if line =~ /Name:\s*(.*)/ then
                  print $1.chomp + ' -> '
                  next
                elsif line =~ /Version:\s*(.*)/ then
                  print $1.chomp + '-'
                  next
                elsif line =~ /Release:\s*(.*)/ then
                  puts $1.chomp
                  next
                end
              end
            else
              tmpfile = File.open("#{@spec_dir}/~#{File.basename(spec)}","w+")
              File.open(spec).each do |line|
                if line =~ /Release:/ then
                  tmpfile.puts "Release: #{line.split(/\s/)[1].to_i + 1}"
                else
                  tmpfile.puts line.chomp
                end
              end
              tmpfile.close
              mv(tmpfile.path,spec)
            end
          end
        end # End of bump task
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
simp-rake-helpers-2.1.3 lib/simp/rake/build/spec.rb
simp-rake-helpers-2.1.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-2.1.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-2.0.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-2.0.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-2.0.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.3.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.2.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.2.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.1.3 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.1.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.1.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-1.1.0 lib/simp/rake/build/spec.rb