Module: Hawk::Builder

Defined in:
lib/hawk/builder.rb

Defined Under Namespace

Modules: DSL

Instance Method Summary collapse

Instance Method Details

#app_nameObject



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

def app_name
  info_plist_property('CFBundleDisplayName')
end

#app_versionObject



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

def app_version
  info_plist_property('CFBundleVersion')
end

#build_plistObject



65
66
67
# File 'lib/hawk/builder.rb', line 65

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

#build_webpageObject



77
78
79
# File 'lib/hawk/builder.rb', line 77

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

#bundle_identifierObject



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

def bundle_identifier
  info_plist_property('CFBundleIdentifier')
end

#escaped_ipa_urlObject



73
74
75
# File 'lib/hawk/builder.rb', line 73

def escaped_ipa_url
  CGI.escapeHTML(ipa_url)
end

#ipa_fileObject



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

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
  FileUtils.copy(@ipa_file, Dir.pwd) if @options[:preserve_ipa]
  @ipa_file
end

#itms_urlObject



69
70
71
# File 'lib/hawk/builder.rb', line 69

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

#repo_versionObject



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

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