Sha256: 816ca2ca98eb8759f2039b0d21777db00be75fe01ec11f2ebdb5ca6521a8c164

Contents?: true

Size: 1.69 KB

Versions: 35

Compression:

Stored size: 1.69 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
          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

35 entries across 35 versions & 1 rubygems

Version Path
simp-rake-helpers-5.12.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.6 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.5 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.4 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.3 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.11.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.10.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.10.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.9.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.9.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.8.3 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.8.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.8.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.8.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.7.1 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.7.0 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.6.2 lib/simp/rake/build/spec.rb
simp-rake-helpers-5.6.1 lib/simp/rake/build/spec.rb