Permalink
Browse files

0.0.2 release

  • Loading branch information...
1 parent b60faf5 commit 194d5ba76d9799282eb9d34708e5efe7bc7fb78e sshaw committed Sep 23, 2012
View
@@ -1,13 +1,12 @@
v0.0.2 2012-09-22
--------------------
Enhancements:
- * `itms` added --no-config option
- * `itms` allow boolean options to be set to false via --no-XXXX, e.g., --no-print-stderr
+* `itms` added --no-config option
+* `itms` allow boolean options to be set to false via --no-XXXX, e.g., --no-print-stderr
-Bug Fixes:
+Bug Fixes:
* `itms status` passed the wrong arguments to the underlying method
* `itms` failed when the config file was empty
* Verify command :verify_assets => true would disable asset verification
* Status command ignored multiple status lines
* Lookup command failed to create tempdir
-
View
@@ -39,7 +39,7 @@ supports the following operations:
* List providers
* Retrieve iTunes metadata schemas
-It also includes +itms+, an executable that's sorta like using +iTMSTransporter+ directly, except
+It also includes +itms+, an executable that's sorta like using +iTMSTransporter+ directly except
that it can send email notifications and allows one to set global/per-command defaults via <code>$HOME/.itms</code>.
=== Requirements
@@ -50,7 +50,7 @@ that it can send email notifications and allows one to set global/per-command de
=== Running on Windows
On Windows +iTMSTransporter+ is called via the +iTMSTransporter.CMD+ batch file. This file does not handle the
-+iTMSTransporter+'s exit status correctly, causing <code>iTunes::Store::Transporter</code> to report everything as a success.
++iTMSTransporter+'s exit status correctly, causing <code>iTunes::Store::Transporter</code> to report everything as a success.
This can be fixed by modifying +iTMSTransporter.CMD+ (note that the following does not mimic the batch file exactly):
@@ -71,18 +71,18 @@ This can be fixed by modifying +iTMSTransporter.CMD+ (note that the following do
<code>itms COMMAND [OPTIONS]</code>
* +COMMAND+ - The command (<code>iTunes::Store::Transporter</code> method) to run
-* +OPTIONS+ - These are equivalent to the given +COMMAND+'s options except they must be given in long option format. For example <code>:apple_id => "X123"</code> would be <code>--apple-id=X123</code>.
+* +OPTIONS+ - These are quivalent to the given +COMMAND+'s options except they must be given in long option format. For example <code>:apple_id => "X123"</code> would be <code>--apple-id=X123</code>. Boolean options can be negated with the <code>--no-</code> prefix.
==== Config file
-Default options and email notifications can be placed in a YAML file at <code>$HOME/.itms</code>. To skip loading the config file use the `--no-config` option.
+Default options and email notifications can be placed in a YAML file at <code>$HOME/.itms</code>. To skip loading the config file use the <code>--no-config</code>` option.
# Global command defaults
path: /usr/bin
username: sshaw
password: Pa55W0rd!
- # Global email defaults
+ # Global email defaults
email:
to: everyone@example.com
from: no-reply@example.com
@@ -102,22 +102,25 @@ Default options and email notifications can be placed in a YAML file at <code>$H
success:
cc: assets@example.com
subject: iTunes Upload <%= @apple_id %>
- message: |
+ message: |
<%= @username %> uploaded it using <%= @transport %>
Bye!
failure:
to: support@example.com
subject: Upload Failed!
message: |
- Here's the problem:
+ Here's the problem:
- <%= @error %>
+ <%= @error %>
Fix it!
+As you can see, command options are turned into template variables.
+
=== More Info
+* Docs: http://ruby-doc.org/gems/docs/i/itunes_store_transporter-0.0.2/README_rdoc.html
* Bugs: http://github.com/sshaw/itunes_store_transporter/issues
* Source Code: http://github.com/sshaw/itunes_store_transporter
* Web Based GUI: http://github.com/sshaw/itunes_store_transporter_web
View
@@ -140,7 +140,7 @@ class Email
def send(params = {})
to = @config["to"].to_s.split /,/
host = @config["host"] || "localhost"
- from = @config["from"] || "#{ENV["USER"]}@#{host}"
+ from = @config["from"] || "#{user}@#{host}"
params = params.merge(@config)
message = ::ERB.new(build_template).def_class(Binding).new(params).result
@@ -151,6 +151,10 @@ class Email
end
protected
+ def user
+ ENV["USER"] || ENV["USERNAME"]
+ end
+
def build_template
%w[to from subject cc bcc].inject("") do |t, key|
t << "#{key}: #{@config[key]}\n" if @config[key]
@@ -1,4 +1,3 @@
-require "itunes/store/transporter/command"
require "itunes/store/transporter/command/lookup"
require "itunes/store/transporter/command/providers"
require "itunes/store/transporter/command/schema"
@@ -1,5 +1,4 @@
require "optout"
-require "itunes/store/transporter"
require "itunes/store/transporter/shell"
require "itunes/store/transporter/errors"
require "itunes/store/transporter/output_parser"
@@ -68,7 +67,7 @@ def handle_error(stdout_lines, stderr_lines, options, exitcode)
end
def create_transporter_options(optz)
- optz[:windows] = "true" if Transporter::Shell.windows?
+ optz[:windows] = "true" if Shell.windows?
options.argv(optz)
rescue Optout::OptionError => e
raise OptionError, e.message
@@ -5,77 +5,77 @@ module Store
class Transporter
class OutputParser
- ##
- # This class extracts error and warning messages output by +iTMSTransporter+. For each message
- # is creates an instance of ITunes::Store::Transporter::TransporterMessage
- #
+ ##
+ # This class extracts error and warning messages output by +iTMSTransporter+. For each message
+ # is creates an instance of ITunes::Store::Transporter::TransporterMessage
+ #
- attr :errors
- attr :warnings
+ attr :errors
+ attr :warnings
- ERROR_LINE = />\s+ERROR:\s+(.+)/
- WARNING_LINE = />\s+WARN:\s+(.+)/
+ ERROR_LINE = />\s+ERROR:\s+(.+)/
+ WARNING_LINE = />\s+WARN:\s+(.+)/
- # Generic messages we want to ignore.
- SKIP_ERRORS = [ /\boperation was not successful/i,
+ # Generic messages we want to ignore.
+ SKIP_ERRORS = [ /\boperation was not successful/i,
/\bunable to verify the package/i,
/\bwill NOT be verified/,
/^an error has occurred/i,
/^an error occurred while/i,
/^unknown operation/i,
- /\bunable to authenticate the package/i ]
+ /\bunable to authenticate the package/i ]
- ##
- # === Arguments
- #
- # [output (Array)] +iTMSTransporter+ output
- #
- def initialize(output)
- @errors = []
- @warnings = []
- parse_output(output) if Array === output
- end
+ ##
+ # === Arguments
+ #
+ # [output (Array)] +iTMSTransporter+ output
+ #
+ def initialize(output)
+ @errors = []
+ @warnings = []
+ parse_output(output) if Array === output
+ end
- private
- def parse_output(output)
- output.each do |line|
- if line =~ ERROR_LINE
- error = $1
- next if SKIP_ERRORS.any? { |skip| error =~ skip }
- errors << create_message(error)
- elsif line =~ WARNING_LINE
- warnings << create_message($1)
- end
- end
+ private
+ def parse_output(output)
+ output.each do |line|
+ if line =~ ERROR_LINE
+ error = $1
+ next if SKIP_ERRORS.any? { |skip| error =~ skip }
+ errors << create_message(error)
+ elsif line =~ WARNING_LINE
+ warnings << create_message($1)
+ end
+ end
# Unique messages only. The block form of uniq() is not available on Ruby < 1.9.2
[errors, warnings].each do |e|
next if e.empty?
uniq = {}
- e.replace(e.select { |m| uniq.include?(m.message) ? false : uniq[m.message] = true })
+ e.replace(e.select { |m| uniq.include?(m.message) ? false : uniq[m.message] = true })
end
- end
+ end
- def create_message(line)
- case line
- when /^(?:ERROR|WARNING)\s+ITMS-(\d+):\s+(.+)/
- code = $1
- message = $2
- when /(.+)\s+\((\d+)\)$/,
+ def create_message(line)
+ case line
+ when /^(?:ERROR|WARNING)\s+ITMS-(\d+):\s+(.+)/
+ code = $1
+ message = $2
+ when /(.+)\s+\((\d+)\)$/,
# Is this correct?
- /(.+)\s+errorCode\s+=\s+\((\d+)\)$/
- message = $1
- code = $2
- else
- message = line
- code = nil
- end
+ /(.+)\s+errorCode\s+=\s+\((\d+)\)$/
+ message = $1
+ code = $2
+ else
+ message = line
+ code = nil
+ end
- message.gsub! /^"/, ""
+ message.gsub! /^"/, ""
message.gsub! /"(?: at .+)?$/, ""
- TransporterMessage.new(message, code ? code.to_i : nil)
- end
+ TransporterMessage.new(message, code ? code.to_i : nil)
+ end
end
end
end
View
@@ -1,7 +1,7 @@
require "spec_helper"
require "rbconfig"
-describe ITunes::Store::Transporter::Shell do
+describe ITunes::Store::Transporter::Shell do
it "yields stdout and stderr as they become available" do
ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
temp = Tempfile.new ""
@@ -34,13 +34,13 @@
output.should == expect
end
-
+
describe "#exec" do
it "requires a block" do
lambda { described_class.new.exec([]) }.should raise_exception(ArgumentError, "block required")
end
end
-
+
context "when on Windows" do
before(:all) { ENV["PROGRAMFILES"] = "C:\\" }

0 comments on commit 194d5ba

Please sign in to comment.