Skip to content

Instantly share code, notes, and snippets.

@borgand
Forked from lukeredpath/gist:72511
Created February 1, 2010 10:32

Revisions

  1. borgand revised this gist Feb 1, 2010. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion Rakefile
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ namespace :bump do
    end


    desc "Bumps marketing minor version (e.g. 1.0.1 -> 1.0.2)"
    desc "Bumps marketing minor version (e.g. 1.0.1 -> 1.0.2, 1.1 -> 1.2)"
    # Note: It assumes mvers is handled by agvtool only and is the same across all targets
    # Note 2: It derives the current mvers from the line matching Info.plist (not other target plists)
    task :minor do
    @@ -50,4 +50,22 @@ namespace :bump do
    puts ")"
    `agvtool new-marketing-version #{mvers}`
    end

    desc "Bump marketing major version (1.1 -> 2.0, 1.0.1 -> 1.1)"
    task :major do
    print "* Bumping marketing major version ("
    lines = `agvtool mvers -terse`
    mvers = lines.split.detect{|l| l =~ /Info.plist\"=/}.split(/=/).last
    print mvers
    print " -> "
    mvers = mvers.split(/\./)
    mvers.pop
    mvers.push(mvers.pop.to_i + 1)
    mvers.push 0
    mvers = mvers.join(".")
    print mvers
    puts ")"
    `agvtool new-marketing-version #{mvers}`

    end
    end
  2. borgand revised this gist Feb 1, 2010. 1 changed file with 13 additions and 6 deletions.
    19 changes: 13 additions & 6 deletions Rakefile
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    TARGET_NAME = "Rivals"
    RELEASE_OUTPUT_PATH = File.expand_path("~/releases/#{TARGET_NAME}")
    RELEASE_OUTPUT_PATH = File.expand_path("~/proged/releases/#{TARGET_NAME}")
    CONFIGURATION = ENV['CONFIGURATION'] || "Release"
    SDK_VERSION = ENV['SDK'] || 'iphoneos3.1'

    desc "Build main target and zip the release bundle (also runs bump:all)."
    desc "Build main target and zip the release bundle (also bumps all versions)."
    task :release => ['bump:all'] do

    puts "* Building #{CONFIGURATION} release."
    @@ -22,8 +22,13 @@ task :release => ['bump:all'] do
    end

    namespace :bump do
    desc "Bump all version numbers, including Project and Marketing"
    task :all => [:project, :minor] do
    # nothing to be done here
    end

    desc "Bump current project version in all targets"
    task :all do
    task :project do
    puts "* Bumping build version."
    `agvtool bump -all`
    end
    @@ -33,14 +38,16 @@ namespace :bump do
    # Note: It assumes mvers is handled by agvtool only and is the same across all targets
    # Note 2: It derives the current mvers from the line matching Info.plist (not other target plists)
    task :minor do
    puts "* Bumping marketing minor version"
    print "* Bumping marketing minor version ("
    lines = `agvtool mvers -terse`
    mvers = lines.split.detect{|l| l =~ /Info.plist\"=/}.split(/=/).last
    puts " current: #{mvers}"
    print mvers
    print " -> "
    mvers = mvers.split(/\./)
    mvers.push(mvers.pop.to_i + 1)
    mvers = mvers.join(".")
    puts " new: #{mvers}"
    print mvers
    puts ")"
    `agvtool new-marketing-version #{mvers}`
    end
    end
  3. borgand renamed this gist Feb 1, 2010. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. borgand revised this gist Feb 1, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion iPhone release rakefile with version bumping.
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    TARGET_NAME = "Rivals"
    RELEASE_OUTPUT_PATH = File.expand_path("~/proged/releases/#{TARGET_NAME}")
    RELEASE_OUTPUT_PATH = File.expand_path("~/releases/#{TARGET_NAME}")
    CONFIGURATION = ENV['CONFIGURATION'] || "Release"
    SDK_VERSION = ENV['SDK'] || 'iphoneos3.1'

  5. borgand revised this gist Feb 1, 2010. 2 changed files with 46 additions and 23 deletions.
    23 changes: 0 additions & 23 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,23 +0,0 @@
    RELEASE_OUTPUT_PATH = File.expand_path("~/Projects/releases/Squeemote")
    TARGET_NAME = "Squeemote"
    CONFIGURATION = ENV['CONFIGURATION'] || "Distribution"
    SDK_VERSION = ENV['SDK'] || 'iphoneos2.2'

    task :release do
    puts "* Bumping build version."
    `agvtool bump -all`

    puts "* Building #{CONFIGURATION} release."
    `xcodebuild -target #{TARGET_NAME} -configuration #{CONFIGURATION} -sdk #{SDK_VERSION}`
    build_path = File.join('build', "#{CONFIGURATION}-iphoneos")

    puts "* Creating #{CONFIGURATION} package"
    output_path = File.join(RELEASE_OUTPUT_PATH, `agvtool mvers -terse1`.strip + "-#{CONFIGURATION.downcase}")
    `rm -Rf #{output_path}` if File.exist?(output_path)
    `mkdir #{output_path} && mv #{File.join(build_path, '*')} #{output_path}`

    puts "* Compressing."
    `cd #{output_path} && zip -ry #{TARGET_NAME}.zip #{TARGET_NAME}.app`

    puts "* Done."
    end
    46 changes: 46 additions & 0 deletions iPhone release rakefile with version bumping.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    TARGET_NAME = "Rivals"
    RELEASE_OUTPUT_PATH = File.expand_path("~/proged/releases/#{TARGET_NAME}")
    CONFIGURATION = ENV['CONFIGURATION'] || "Release"
    SDK_VERSION = ENV['SDK'] || 'iphoneos3.1'

    desc "Build main target and zip the release bundle (also runs bump:all)."
    task :release => ['bump:all'] do

    puts "* Building #{CONFIGURATION} release."
    `xcodebuild -target #{TARGET_NAME} -configuration #{CONFIGURATION} -sdk #{SDK_VERSION}`
    build_path = File.join('build', "#{CONFIGURATION}-iphoneos")

    puts "* Creating #{CONFIGURATION} package"
    output_path = File.join(RELEASE_OUTPUT_PATH, `agvtool mvers -terse1`.strip + "-#{CONFIGURATION.downcase}")
    `rm -Rf #{output_path}` if File.exist?(output_path)
    `mkdir #{output_path} && mv #{File.join(build_path, '*')} #{output_path}`

    puts "* Compressing."
    `cd #{output_path} && zip -ry #{TARGET_NAME}.zip #{TARGET_NAME}.app`

    puts "* Done."
    end

    namespace :bump do
    desc "Bump current project version in all targets"
    task :all do
    puts "* Bumping build version."
    `agvtool bump -all`
    end


    desc "Bumps marketing minor version (e.g. 1.0.1 -> 1.0.2)"
    # Note: It assumes mvers is handled by agvtool only and is the same across all targets
    # Note 2: It derives the current mvers from the line matching Info.plist (not other target plists)
    task :minor do
    puts "* Bumping marketing minor version"
    lines = `agvtool mvers -terse`
    mvers = lines.split.detect{|l| l =~ /Info.plist\"=/}.split(/=/).last
    puts " current: #{mvers}"
    mvers = mvers.split(/\./)
    mvers.push(mvers.pop.to_i + 1)
    mvers = mvers.join(".")
    puts " new: #{mvers}"
    `agvtool new-marketing-version #{mvers}`
    end
    end
  6. @lukeredpath lukeredpath revised this gist Mar 1, 2009. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,6 @@
    CONFIGURATION = ENV['CONFIGURATION'] || "Distribution"
    SDK_VERSION = ENV['SDK'] || 'iphoneos2.2'

    task :test do
    system "xcodebuild -target Testing -configuration Development -sdk iphonesimulator2.2"
    end

    task :release do
    puts "* Bumping build version."
    `agvtool bump -all`
  7. @lukeredpath lukeredpath created this gist Mar 1, 2009.
    27 changes: 27 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    RELEASE_OUTPUT_PATH = File.expand_path("~/Projects/releases/Squeemote")
    TARGET_NAME = "Squeemote"
    CONFIGURATION = ENV['CONFIGURATION'] || "Distribution"
    SDK_VERSION = ENV['SDK'] || 'iphoneos2.2'

    task :test do
    system "xcodebuild -target Testing -configuration Development -sdk iphonesimulator2.2"
    end

    task :release do
    puts "* Bumping build version."
    `agvtool bump -all`

    puts "* Building #{CONFIGURATION} release."
    `xcodebuild -target #{TARGET_NAME} -configuration #{CONFIGURATION} -sdk #{SDK_VERSION}`
    build_path = File.join('build', "#{CONFIGURATION}-iphoneos")

    puts "* Creating #{CONFIGURATION} package"
    output_path = File.join(RELEASE_OUTPUT_PATH, `agvtool mvers -terse1`.strip + "-#{CONFIGURATION.downcase}")
    `rm -Rf #{output_path}` if File.exist?(output_path)
    `mkdir #{output_path} && mv #{File.join(build_path, '*')} #{output_path}`

    puts "* Compressing."
    `cd #{output_path} && zip -ry #{TARGET_NAME}.zip #{TARGET_NAME}.app`

    puts "* Done."
    end