diff --git a/README.rdoc b/README.rdoc
index e57f88e..c96a34e 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -83,7 +83,7 @@ This can be fixed by modifying +iTMSTransporter.CMD+ (note that the following do
Note that options with a value must contain the equals character ("="
).
The format is --option=value
and not --option value
.
-==== Examples:
+==== Examples
itms upload --username=sshaw --password=w3cAllYoU --transport=aspera a_package.itmsp
itms version
diff --git a/lib/itunes/store/transporter/command/status.rb b/lib/itunes/store/transporter/command/status.rb
index d678a9d..bb75177 100644
--- a/lib/itunes/store/transporter/command/status.rb
+++ b/lib/itunes/store/transporter/command/status.rb
@@ -4,18 +4,18 @@ module ITunes
module Store
module Transporter
module Command # :nodoc:
-
+
##
# Retrieve the status of a previously uploaded package
#
class Status < Mode
def initialize(*config)
- super
+ super
options.on *VENDOR_ID
end
- protected
- def handle_success(stdout_lines, stderr_lines, options)
+ protected
+ def handle_success(stdout_lines, stderr_lines, options)
status = {}
while line = stdout_lines.shift
next unless line =~ /\S+/
@@ -33,7 +33,7 @@ def handle_success(stdout_lines, stderr_lines, options)
end
end
status
- end
+ end
def parse_line(line)
key, value = line.split(/:\s+/, 2).map(&:strip)
@@ -41,7 +41,7 @@ def parse_line(line)
key.downcase!
[key.to_sym, value]
end
- end
+ end
end
end
end
diff --git a/lib/itunes/store/transporter/command/upload.rb b/lib/itunes/store/transporter/command/upload.rb
index 1845298..eb54ab6 100644
--- a/lib/itunes/store/transporter/command/upload.rb
+++ b/lib/itunes/store/transporter/command/upload.rb
@@ -17,7 +17,8 @@ def initialize(*config)
options.on *SUCCESS
options.on *FAILURE
options.on :delete, "-delete", Optout::Boolean
- options.on :rate, "-k", Integer # Required if TRANSPORT is Aspera or Signiant
+ options.on :rate, "-k", Integer # Required if TRANSPORT is Aspera or Signiant
+ options.on :streams, "-numStreams", Integer # Only valid if TRANSPORT is Signiant
options.on :log_history, "-loghistory", Optout::Dir.exists
end
end
diff --git a/lib/itunes/store/transporter/itms_transporter.rb b/lib/itunes/store/transporter/itms_transporter.rb
index 326eaa5..33a4113 100644
--- a/lib/itunes/store/transporter/itms_transporter.rb
+++ b/lib/itunes/store/transporter/itms_transporter.rb
@@ -1,46 +1,46 @@
module ITunes
- module Store
+ module Store
module Transporter
##
# Upload and manage your assets in the iTunes Store using the iTunes Store's Transporter (+iTMSTransporter+).
class ITMSTransporter
-
+
##
- # === Arguments
+ # === Arguments
#
# [options (Hash)] Transporter options
#
# === Options
- #
+ #
# Options given here will be used as defaults for all subsequent method calls. Thus you can set method specific options here but, if you call a method that does not accept one of these options, an OptionError will be raised.
- #
- # See specific methods for a list of options.
+ #
+ # See specific methods for a list of options.
#
# [:username (String)] Your username
# [:password (String)] Your password
# [:shortname (String)] Your shortname. Optional, not every iTunes account has one
# [:path (String)] The path to the +iTMSTransporter+. Optional.
- # [:print_stdout (Boolean)] Print +iTMSTransporter+'s stdout to your stdout. Defaults to +false+.
- # [:print_stderr (Boolean)] Print +iTMSTransporter+'s stderr to your stderr. Defaults to +false+.
+ # [:print_stdout (Boolean)] Print +iTMSTransporter+'s stdout to your stdout. Defaults to +false+.
+ # [:print_stderr (Boolean)] Print +iTMSTransporter+'s stderr to your stderr. Defaults to +false+.
#
def initialize(options = nil)
@defaults = create_options(options)
- @config = {
+ @config = {
:path => @defaults.delete(:path),
- :print_stdout => @defaults.delete(:print_stdout),
- :print_stderr => @defaults.delete(:print_stderr),
- }
+ :print_stdout => @defaults.delete(:print_stdout),
+ :print_stderr => @defaults.delete(:print_stderr),
+ }
end
-
+
##
# :method: lookup
- # :call-seq:
+ # :call-seq:
# lookup(options = {})
- #
- # Retrieve the metadata for a previously delivered package.
#
- # === Arguments
+ # Retrieve the metadata for a previously delivered package.
+ #
+ # === Arguments
#
# [options (Hash)] Transporter options
#
@@ -55,15 +55,15 @@ def initialize(options = nil)
# === Returns
#
# [String] The metadata
-
+
##
# :method: providers
- # :call-seq:
+ # :call-seq:
# providers(options = {})
#
# List of Providers for whom your account is authorzed to deliver for.
#
- # === Arguments
+ # === Arguments
#
# [options (Hash)] Transporter options
#
@@ -74,15 +74,15 @@ def initialize(options = nil)
# === Returns
#
# [Array] Each element is a +Hash+ with two keys: +:shortname+ and +:longname+ representing the given provider's long and short names
-
+
##
# :method: schema
- # :call-seq:
+ # :call-seq:
# schema(options = {})
#
# Download a RelaxNG schema file for a particular metadata specification.
- #
- # === Arguments
+ #
+ # === Arguments
#
# [options (Hash)] Transporter options
#
@@ -93,24 +93,24 @@ def initialize(options = nil)
#
# === Errors
#
- # TransporterError, OptionError, ExecutionError
+ # TransporterError, OptionError, ExecutionError
#
# === Returns
#
# [String] The schema
-
+
##
# :method: status
- # :call-seq:
+ # :call-seq:
# status(options = {})
#
# Retrieve the status of a previously uploaded package.
- #
- # === Arguments
+ #
+ # === Arguments
#
# [options (Hash)] Transporter options
#
- # === Options
+ # === Options
#
# [:vendor_id (String)] ID of the package you want status info on
#
@@ -121,44 +121,45 @@ def initialize(options = nil)
# === Returns
#
# [Hash] Descibes various facets of the package's status.
-
+
##
# :method: upload
- # :call-seq:
+ # :call-seq:
# upload(package, options = {})
#
# Upload a package to the iTunes Store.
#
# === Arguments
- #
+ #
# [package (String)] The path to the package directory to upload. Package names must end in +.itmsp+.
# [options (Hash)] Transporter options
- #
+ #
# === Options
#
# [:transport (String)] The method/protocol used to upload your package. Optional. Can be one of: "Aspera"
, "Signiant"
, or "DEV"
. By default +iTMSTransporter+ automatically selects the transport.
- # [:rate (Integer)] Target bitrate in Kbps. Optional, only used with +Aspera+ and +Signiant+
+ # [:rate (Integer)] Target bitrate in Kbps. Optional, only used with +Aspera+ and +Signiant+
# [:success (String)] A directory to move the package to if the upload succeeds
# [:failure (String)] A directory to move the package to if the upload fails
# [:delete (Boolean)] Delete the package if the upload succeeds. Defaults to +false+.
# [:log_history (String)] Write an +iTMSTransporter+ log to this directory. Off by default.
+ # [:streams (Integer)] Number of data streams to use. Optional, only used with +Signiant+
#
# === Errors
#
# TransporterError, OptionError, ExecutionError
#
# === Returns
- #
+ #
# +true+ if the upload was successful.
-
+
##
- # :method: verify
- # :call-seq:
+ # :method: verify
+ # :call-seq:
# verify(package, options = {})
- #
- # Validate the contents of a package's metadata and assets.
#
- # If verification fails an ExecutionError containing the errors will be raised.
+ # Validate the contents of a package's metadata and assets.
+ #
+ # If verification fails an ExecutionError containing the errors will be raised.
# Each error message is an instance of TransporterMessage.
#
# === Arguments
@@ -175,12 +176,12 @@ def initialize(options = nil)
# TransporterError, OptionError, ExecutionError
#
# === Returns
- #
+ #
# +true+ if the package was verified.
-
+
##
# :method: version
- # :call-seq:
+ # :call-seq:
# version
#
# Return the underlying +iTMSTransporter+ version.
@@ -188,31 +189,30 @@ def initialize(options = nil)
# === Returns
#
# [String] The version number
-
+
%w|upload verify|.each do |command|
- define_method(command) do |package, *options|
+ define_method(command) do |package, *options|
cmd_options = create_options(options.first)
cmd_options[:package] = package
run_command(command, cmd_options)
end
end
-
+
%w|lookup providers schema status version|.each do |command|
define_method(command) { |*options| run_command(command, options.shift) }
- end
-
- private
- def run_command(name, options)
+ end
+
+ private
+ def run_command(name, options)
Command.const_get(name.capitalize).new(@config, @defaults).run(create_options(options))
end
-
+
def create_options(options)
options ||= {}
raise ArgumentError, "options must be a Hash" unless Hash === options
options.dup
end
- end
+ end
end
end
end
-