Module: Hawk::Builder

Defined in:
lib/hawk/builder.rb

Defined Under Namespace

Modules: DSL

Instance Method Summary collapse

Instance Method Details

#app_nameObject



45
46
47
# File 'lib/hawk/builder.rb', line 45

def app_name
  info_plist_property('CFBundleDisplayName')
end

#app_versionObject



49
50
51
# File 'lib/hawk/builder.rb', line 49

def app_version
  info_plist_property('CFBundleVersion')
end

#build_plistObject



105
106
107
# File 'lib/hawk/builder.rb', line 105

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

#build_webpageObject



117
118
119
# File 'lib/hawk/builder.rb', line 117

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

#bundle_identifierObject



53
54
55
56
57
58
59
# File 'lib/hawk/builder.rb', line 53

def bundle_identifier
  if @bundle_id_fix
    info_plist_property('CFBundleIdentifier') + '.ios8fix'
  else
    info_plist_property('CFBundleIdentifier')
  end
end

#escaped_fullsize_image_urlObject



81
82
83
# File 'lib/hawk/builder.rb', line 81

def escaped_fullsize_image_url
  (fullsize_image_path)? CGI.escapeHTML(fullsize_image_url) : 'https://raw.githubusercontent.com/mtrudel/hawk/master/templates/fullsize_image.png'
end

#escaped_icon_urlObject



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

def escaped_icon_url
  (icon_path)? CGI.escapeHTML(icon_url) : 'https://raw.githubusercontent.com/mtrudel/hawk/master/templates/icon.png'
end

#escaped_ipa_urlObject



113
114
115
# File 'lib/hawk/builder.rb', line 113

def escaped_ipa_url
  CGI.escapeHTML(ipa_url)
end

#fullsize_image_pathObject



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

def fullsize_image_path
  @fullsize_image_path
end

#icon_pathObject



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

def icon_path
  @icon_path
end

#ipa_fileObject



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/hawk/builder.rb', line 85

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



109
110
111
# File 'lib/hawk/builder.rb', line 109

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

#repo_versionObject



61
62
63
# File 'lib/hawk/builder.rb', line 61

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

#vendor_nameObject



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

def vendor_name
  @vendor_name
end