Class: Shenzhen::Plugins::ITunesConnect::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/shenzhen/plugins/itunesconnect.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ipa, apple_id, sdk, account, password, params = []) ⇒ Client

Returns a new instance of Client.


13
14
15
16
17
18
19
20
21
# File 'lib/shenzhen/plugins/itunesconnect.rb', line 13

def initialize(ipa, apple_id, sdk, , password, params = [])
  @ipa = ipa
  @apple_id = apple_id
  @sdk = sdk
  @account = 
  @password = password
  @params = params
  @filename = File.basename(@ipa).tr(" ", "_")
end

Instance Attribute Details

#ipaObject (readonly)

Returns the value of attribute ipa


11
12
13
# File 'lib/shenzhen/plugins/itunesconnect.rb', line 11

def ipa
  @ipa
end

#paramsObject (readonly)

Returns the value of attribute params


11
12
13
# File 'lib/shenzhen/plugins/itunesconnect.rb', line 11

def params
  @params
end

#sdkObject (readonly)

Returns the value of attribute sdk


11
12
13
# File 'lib/shenzhen/plugins/itunesconnect.rb', line 11

def sdk
  @sdk
end

Instance Method Details

#upload_build!Object


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/shenzhen/plugins/itunesconnect.rb', line 23

def upload_build!
  size = File.size(@ipa)
  checksum = Digest::MD5.file(@ipa)

  begin
    FileUtils.mkdir_p("Package.itmsp")
    FileUtils.copy_entry(@ipa, "Package.itmsp/#{@filename}")

    File.write("Package.itmsp/metadata.xml", (@apple_id, checksum, size))

    raise if /(error)|(fail)/i === transport
  rescue
    say_error "An error occurred when trying to upload the build to iTunesConnect.\nRun with --verbose for more info." and abort
  ensure
    FileUtils.rm_rf("Package.itmsp", :secure => true)
  end
end