summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-21 11:23:24 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-21 11:40:58 +0100
commitf9c68e022952307b51efb9fd6badeb6c44d3de0c (patch)
tree54f59059007a07eb3362ff890196e8f57cd3e0db
parentf1bd4797c310d64d6cca3ebb12163fa355cd0c18 (diff)
downloadimport-f9c68e022952307b51efb9fd6badeb6c44d3de0c.tar.gz
Tidy up Ruby code
Use \ for multiline strings in Ruby instead of +. Change 'raise Exception' to just 'raise', because Exception is the default type.
-rw-r--r--importer_bundler_extensions.rb10
-rw-r--r--importer_omnibus_extensions.rb13
-rwxr-xr-xrubygems.find_deps4
-rwxr-xr-xrubygems.to_chunk6
4 files changed, 15 insertions, 18 deletions
diff --git a/importer_bundler_extensions.rb b/importer_bundler_extensions.rb
index 90a5ae4..034b3c2 100644
--- a/importer_bundler_extensions.rb
+++ b/importer_bundler_extensions.rb
@@ -53,11 +53,9 @@ module Importer
def get_spec_for_gem(specs, gem_name)
found = specs[gem_name].select {|s| Gem::Platform.match(s.platform)}
if found.empty?
- raise Exception,
- "No Gemspecs found matching '#{gem_name}'"
+ raise "No Gemspecs found matching '#{gem_name}'"
elsif found.length != 1
- raise Exception,
- "Unsure which Gem to use for #{gem_name}, got #{found}"
+ raise "Unsure which Gem to use for #{gem_name}, got #{found}"
end
found[0]
end
@@ -71,7 +69,7 @@ module Importer
def validate_spec(spec, source_dir_name, expected_version)
if not spec_is_from_current_source_tree(spec, source_dir_name)
- error "Specified gem '#{spec.name}' doesn't live in the source in " +
+ error "Specified gem '#{spec.name}' doesn't live in the source in " \
"'#{source_dir_name}'"
log.debug "SPEC: #{spec.inspect} #{spec.source}"
exit 1
@@ -80,7 +78,7 @@ module Importer
if expected_version != nil && spec.version != expected_version
# This check is brought to you by Coderay, which changes its version
# number based on an environment variable. Other Gems may do this too.
- error "Source in #{source_dir_name} produces #{spec.full_name}, but " +
+ error "Source in #{source_dir_name} produces #{spec.full_name}, but " \
"the expected version was #{expected_version}."
exit 1
end
diff --git a/importer_omnibus_extensions.rb b/importer_omnibus_extensions.rb
index ce0d780..2286d35 100644
--- a/importer_omnibus_extensions.rb
+++ b/importer_omnibus_extensions.rb
@@ -38,8 +38,8 @@ class Omnibus::Builder
def gemspec_path(args)
handle_options args
if options[:args].length != 1
- raise Exception, "Invalid `gem build` commandline: 1 argument " +
- "expected, got #{options[:args]}."
+ raise "Invalid `gem build` commandline: 1 argument expected, got " \
+ "#{options[:args]}."
end
options[:args][0]
end
@@ -67,11 +67,10 @@ class Omnibus::Builder
parser = GemBuildCommandParser.new
args = Shellwords.split(command).drop(1)
if built_gemspec != nil
- raise Exception, "More than one `gem build` command was run as part " +
- "of the build process. The 'rubygems.to_chunk' " +
- "program currently supports only one .gemspec " +
- "build per chunk, so this can't be processed " +
- "automatically."
+ raise "More than one `gem build` command was run as part f the build " \
+ "process. The 'rubygems.to_chunk' program currently supports " \
+ "only one .gemspec build per chunk, so this can't be " \
+ "processed automatically."
end
@built_gemspec = parser.gemspec_path(args)
elsif command.start_with? 'install'
diff --git a/rubygems.find_deps b/rubygems.find_deps
index a9f4f08..228c88b 100755
--- a/rubygems.find_deps
+++ b/rubygems.find_deps
@@ -70,8 +70,8 @@ class RubyGemDependencyFinder < Importer::Base
def run
source_dir_name, gem_name, expected_version = parse_options(ARGV)
- log.info("Finding dependencies for #{gem_name} based on " +
- "source code in #{source_dir_name}")
+ log.info("Finding dependencies for #{gem_name} based on source code in " \
+ "#{source_dir_name}")
resolved_specs = Dir.chdir(source_dir_name) do
definition = create_bundler_definition_for_gemspec(gem_name)
diff --git a/rubygems.to_chunk b/rubygems.to_chunk
index e1f7132..c1a3e7c 100755
--- a/rubygems.to_chunk
+++ b/rubygems.to_chunk
@@ -121,7 +121,7 @@ class RubyGemChunkMorphologyGenerator < Importer::Base
# control the build and deployment environment, and we obviously can't
# provide the private key of the Gem's maintainer.
configure_commands <<
- "sed -e '/cert_chain\\s*=/d' -e '/signing_key\\s*=/d' -i " +
+ "sed -e '/cert_chain\\s*=/d' -e '/signing_key\\s*=/d' -i " \
"#{spec.name}.gemspec"
end
@@ -131,7 +131,7 @@ class RubyGemChunkMorphologyGenerator < Importer::Base
install_commands = [
"mkdir -p #{gem_dir}",
- "gem install --install-dir #{gem_dir} --bindir #{bin_dir} " +
+ "gem install --install-dir #{gem_dir} --bindir #{bin_dir} " \
"--ignore-dependencies --local ./#{spec.full_name}.gem"
]
@@ -150,7 +150,7 @@ class RubyGemChunkMorphologyGenerator < Importer::Base
def run
source_dir_name, gem_name, expected_version = parse_options(ARGV)
- log.info("Creating chunk morph for #{gem_name} based on " +
+ log.info("Creating chunk morph for #{gem_name} based on " \
"source code in #{source_dir_name}")
resolved_specs = Dir.chdir(source_dir_name) do