Sha256: 9f2f32b0683fd96bd22dbd1e34c4e61ae8bda367961ee79d4d9a4adf80ed5391

Contents?: true

Size: 1.71 KB

Versions: 22

Compression:

Stored size: 1.71 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 )

      define_tasks
    end

    def define_tasks
      namespace :spec do
        task :prep do
          if $simp6
            @build_dir = $simp6_build_dir || @distro_build_dir
          end
        end


=begin
        desc "Bump spec files. Bump all spec files' release numbers up by one.
       * :list - Flag to just print the current version numbers."
=end
        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

22 entries across 22 versions & 1 rubygems

Version Path
simp-rake-helpers-5.22.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.22.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.21.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.20.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.19.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.19.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.18.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.17.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.17.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.16.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.15.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.14.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.13.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.13.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.13.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.12.7 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.12.6 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.12.5 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.12.4 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.12.3 lib/simp/rake/build/spec.rb