Sha256: 977fdce8f49bbdb55a22507cfbe507b154e230614c2c56712782b7465ee2e31a

Contents?: true

Size: 1.72 KB

Versions: 16

Compression:

Stored size: 1.72 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
        task :prep do
          if $simp6
            @build_dir = $simp6_build_dir
          end
        end


        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] => [:prep] do |t,args|
          (
            Dir.glob("#{@spec_dir}/*.spec") +
            Dir.glob("#{@src_dir}/puppet/modules/*/pkg/pupmod-*.spec")
          ).each do |spec|
            if args.list
              File.open(spec).each do |line|
                if line =~ /Name:\s*(.*)/
                  print $1.chomp + ' -> '
                  next
                elsif line =~ /Version:\s*(.*)/
                  print $1.chomp + '-'
                  next
                elsif line =~ /Release:\s*(.*)/
                  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:/
                  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

16 entries across 16 versions & 1 rubygems

Version Path
simp-rake-helpers-4.1.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-4.1.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-4.0.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-4.0.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.7.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.6.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.5.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.5.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.4.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.3.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.2.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.1.4 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.1.3 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.1.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.1.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-3.1.0 lib/simp/rake/build/spec.rb