Module: Hawk::Builder

Defined in:
lib/hawk/builder.rb

Defined Under Namespace

Modules: DSL

Instance Method Summary collapse

Instance Method Details

#app_nameObject



28
29
30
# File 'lib/hawk/builder.rb', line 28

def app_name
  info_plist_property('CFBundleDisplayName')
end

#app_versionObject



32
33
34
# File 'lib/hawk/builder.rb', line 32

def app_version
  info_plist_property('CFBundleVersion')
end

#build_plistObject



63
64
65
# File 'lib/hawk/builder.rb', line 63

def build_plist
  ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'manifest.plist.erb'))).result(binding)
end

#build_webpageObject



75
76
77
# File 'lib/hawk/builder.rb', line 75

def build_webpage
  ERB.new(File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'install.html.erb'))).result(binding)
end

#bundle_identifierObject



36
37
38
# File 'lib/hawk/builder.rb', line 36

def bundle_identifier
  info_plist_property('CFBundleIdentifier')
end

#escaped_ipa_urlObject



71
72
73
# File 'lib/hawk/builder.rb', line 71

def escaped_ipa_url
  CGI.escapeHTML(ipa_url)
end

#ipa_fileObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/hawk/builder.rb', line 44

def ipa_file
  if (!@ipa_file)
    output_dir = Dir.tmpdir
    product_name = project_property('PRODUCT_NAME')
    @ipa_file = File.join(output_dir, "#{product_name}.ipa")

    the_app_file = app_file # Do this before below so output happens in the right order

    print "Signing app..."
    output = `/usr/bin/xcrun -sdk iphoneos PackageApplication -v -s "#{@signing_identity || "iPhone Distribution"}" -o #{@ipa_file} #{the_app_file} 2>&1`
    if $?.to_i != 0
      puts "error (text follows)"
      abort output
    end
    puts "done"
  end
  @ipa_file
end

#itms_urlObject



67
68
69
# File 'lib/hawk/builder.rb', line 67

def itms_url
  "itms-services://?#{URI.encode_www_form(:action => "download-manifest", :url => plist_url)}"
end

#repo_versionObject



40
41
42
# File 'lib/hawk/builder.rb', line 40

def repo_version
  `git rev-parse --short HEAD`.chomp
end