class Xcode::Project::Packer
Attributes
project[R]
Public Class Methods
new(project)
click to toggle source
# File lib/xcode/project/packer.rb, line 8 def initialize(project) @project = project end
Public Instance Methods
build()
click to toggle source
# File lib/xcode/project/packer.rb, line 39 def build arguments = %w[xcodebuild] arguments += %W[-project #{project.path}] arguments += %W[-configuration #{project.configuration}] arguments += %w[-nodependencies] arguments += project.variables.map{ |key, value| "#{key}=#{value}" } arguments += %w[clean build] sh *arguments end
pack()
click to toggle source
# File lib/xcode/project/packer.rb, line 50 def pack if pack_path.exist? abort "#{pack_path} already exists" else build arguments = %W[tar -cjf #{pack_path.expand_path}] arguments += product_names Dir.chdir products_dir do sh *arguments end end end
pack_description()
click to toggle source
# File lib/xcode/project/packer.rb, line 20 def pack_description @pack_description ||= "#{project.name} v#{project.version}" end
pack_path()
click to toggle source
# File lib/xcode/project/packer.rb, line 12 def pack_path @pack_path ||= begin pkg_dir = Pathname('pkg') pkg_dir.mkpath pkg_dir + "#{project.name}-#{project.version}.tbz" end end
product_names()
click to toggle source
# File lib/xcode/project/packer.rb, line 24 def product_names [].tap do |names| objects = project.config.root['objects'] objects.each do |_, object| if reference = object['productReference'] names << objects[reference]['path'] end end end end
products_dir()
click to toggle source
# File lib/xcode/project/packer.rb, line 35 def products_dir Pathname('build') + project.configuration end
release()
click to toggle source
# File lib/xcode/project/packer.rb, line 65 def release unless `git remote -v` =~ /git@github\.com:([^\/]+)\/(.+?)\.git/ abort 'can\'t find github remote' else login, repos = $1, $2 token = Keychain.items.find{ |item| item.label[/^github.com/] && item.account == "#{login}/token" }.password pack uploader = Net::GitHub::Upload.new(:login => login, :token => token) uploader.upload(:repos => repos, :file => pack_path.to_s, :description => pack_description) end end