Class: XCJobs::InfoPlist::Version

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL, XCJobs::InfoPlist
Defined in:
lib/xcjobs/info_plist.rb

Instance Method Summary collapse

Methods included from XCJobs::InfoPlist

#[], #[]=, #build_version, #build_version=, #bump_marketing_version_segment, #marketing_and_build_version, #marketing_version, #marketing_version=, #set

Constructor Details

#initialize {|_self| ... } ⇒ Version

Returns a new instance of Version.

Yields:

  • (_self)

Yield Parameters:



58
59
60
61
# File 'lib/xcjobs/info_plist.rb', line 58

def initialize()
  yield self if block_given?
  define
end

Instance Method Details

#defineObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# 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

#pathObject



63
64
65
# File 'lib/xcjobs/info_plist.rb', line 63

def path
  InfoPlist.path
end

#path=(path) ⇒ Object



67
68
69
# File 'lib/xcjobs/info_plist.rb', line 67

def path=(path)
  InfoPlist.path = path
end