Permalink
Browse files

some tidying up before next release

  • Loading branch information...
1 parent c901bf5 commit b60faf5c1f7665f59e5695b171440554c7199124 sshaw committed Sep 22, 2012
View
@@ -1,4 +1,4 @@
-v0.0.2 2012-09-XX
+v0.0.2 2012-09-22
--------------------
Enhancements:
* `itms` added --no-config option
@@ -12,13 +12,13 @@ Gem::Specification.new do |s|
s.authors = ["Skye Shaw"]
s.email = "sshaw@lucas.cis.temple.edu"
s.executables << "itms"
- s.files = Dir["lib/**/*.rb", "README.rdoc"]
- s.test_files = Dir["spec/**/*.rb"]
+ s.test_files = Dir["spec/**/*.*"]
+ s.extra_rdoc_files = %w[README.rdoc Changes]
+ s.files = Dir["lib/**/*.rb"] + s.test_files + s.extra_rdoc_files
s.homepage = "http://github.com/sshaw/itunes_store_transporter"
s.license = "MIT"
s.add_dependency "childprocess", "~> 0.3.2"
s.add_dependency "optout", "~> 0.0.2"
s.add_development_dependency "rake", "~> 0.9.2"
- s.add_development_dependency "rspec", "~> 2.9"
- s.extra_rdoc_files = ["README.rdoc"]
+ s.add_development_dependency "rspec", "~> 2.9", "< 3"
end
@@ -62,16 +62,16 @@ def handle_success(stdout_lines, stderr_lines, options)
end
def handle_error(stdout_lines, stderr_lines, options, exitcode)
- parser = Transporter::OutputParser.new(stderr_lines)
+ parser = OutputParser.new(stderr_lines)
errors = parser.errors.any? ? parser.errors : [ TransporterMessage.new(stderr_lines.join) ]
- raise ITunes::Store::Transporter::ExecutionError.new(errors, exitcode)
+ raise ExecutionError.new(errors, exitcode)
end
def create_transporter_options(optz)
optz[:windows] = "true" if Transporter::Shell.windows?
options.argv(optz)
rescue Optout::OptionError => e
- raise ITunes::Store::Transporter::OptionError, e.message
+ raise OptionError, e.message
end
end
@@ -34,13 +34,13 @@ def handle_success(stdout_lines, stderr_lines, options)
path = File.join(options[:destination], "#{id}.itmsp", "metadata.xml")
if !File.exists?(path)
- raise ITunes::Store::Transporter::TransporterError, "No metadata file exists at #{path}"
+ raise TransporterError, "No metadata file exists at #{path}"
end
begin
metadata = File.read(path)
rescue StandardError => e
- raise ITunes::Store::Transporter::TransporterError, "Failed to read metadata file #{path}: #{e}"
+ raise TransporterError, "Failed to read metadata file #{path}: #{e}"
end
metadata
@@ -28,9 +28,9 @@ def create_transporter_options(optz)
# Verify mode returns 0 if there are no packages to verify but will emit an error message about the lack of packages
def handle_success(stdout_lines, stderr_lines, options)
- parser = Transporter::OutputParser.new(stderr_lines)
+ parser = OutputParser.new(stderr_lines)
if parser.errors.any?
- raise ITunes::Store::Transporter::ExecutionError.new(parser.errors, 0)
+ raise ExecutionError.new(parser.errors, 0)
else
true
end
@@ -1,4 +1,5 @@
require "childprocess"
+require "itunes/store/transporter/errors"
module ITunes
module Store
@@ -35,6 +36,8 @@ def initialize(path = nil)
end
def exec(argv, &block)
+ raise ArgumentError, "block required" unless block_given?
+
begin
process = ChildProcess.build(path, *argv)
@@ -54,7 +57,7 @@ def exec(argv, &block)
poll(stdout[0], stderr[0], &block)
rescue ChildProcess::Error, SystemCallError => e
- raise ITunes::Store::Transporter::TransporterError, e.message
+ raise TransporterError, e.message
ensure
process.wait if process.alive?
[ stdout, stderr ].flatten.each { |io| io.close if !io.closed? }
@@ -68,6 +71,7 @@ def poll(stdout, stderr)
read = [ stdout, stderr ]
loop do
+ # TODO: Not working on jruby
if ready = select(read, nil, nil, 1)
ready.each do |set|
next unless set.any?
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,9 +34,16 @@
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:\\" }
+
it "selects the Windows executable" do
described_class.stub(:windows? => true)
described_class.new.path.should match /#{described_class::WINDOWS_EXE}\Z/

0 comments on commit b60faf5

Please sign in to comment.