class XCJobs::InfoPlist::Version

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/xcjobs/info_plist.rb, line 58
def initialize()
  yield self if block_given?
  define
end

Public Instance Methods

define() click to toggle source
# File lib/xcjobs/info_plist.rb, line 71
def define
  namespace :version do
    desc 'Print the current version'
    task :current do
      puts InfoPlist.marketing_and_build_version
    end

    desc 'Sets build version to last git commit hash'
    task :set_build_version do
      rev = %x[git rev-parse --short HEAD].strip
      puts "Setting build version to: #{rev}"
      InfoPlist.build_version = rev
    end

    desc 'Sets build version to number of commits'
    task :set_build_number do
      rev = %x[git rev-list --count HEAD].strip
      puts "Setting build version to: #{rev}"
      InfoPlist.build_version = rev
    end

    namespace :bump do
      desc 'Bump patch version (0.0.X)'
      task :patch do
        InfoPlist.bump_marketing_version_segment(2)
      end

      desc 'Bump minor version (0.X.0)'
      task :minor do
        InfoPlist.bump_marketing_version_segment(1)
      end

      desc 'Bump major version (X.0.0)'
      task :major do
        InfoPlist.bump_marketing_version_segment(0)
      end
    end
  end

  desc 'Print the current version'
  task :version => 'version:current'
end
path() click to toggle source
# File lib/xcjobs/info_plist.rb, line 63
def path
  InfoPlist.path
end
path=(path) click to toggle source
# File lib/xcjobs/info_plist.rb, line 67
def path=(path)
  InfoPlist.path = path
end