summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-20 16:35:14 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-11-20 18:54:33 +0000
commit9b73d0d77c65aeb8f529e1289276c90cf6944d9d (patch)
tree4aa5d737b4276788387e14e9b43ab225fbb1ee7f
parent167588df5c3c3be54439da2068f23dca754ae831 (diff)
downloadimport-9b73d0d77c65aeb8f529e1289276c90cf6944d9d.tar.gz
rubygems: Allow specifying which version of a Gem should be imported
You often want the latest stable rather than whatever is Git master, which usually doesn't even import cleanly!
-rw-r--r--baserockimport/app.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/baserockimport/app.py b/baserockimport/app.py
index 921d822..6f4d7c3 100644
--- a/baserockimport/app.py
+++ b/baserockimport/app.py
@@ -81,7 +81,7 @@ class BaserockImportApplication(cliapp.Application):
self.add_subcommand('omnibus', self.import_omnibus,
arg_synopsis='REPO PROJECT_NAME SOFTWARE_NAME')
self.add_subcommand('rubygems', self.import_rubygems,
- arg_synopsis='GEM_NAME')
+ arg_synopsis='GEM_NAME [GEM_VERSION]')
self.stdout_has_colours = self._stream_has_colours(sys.stdout)
@@ -170,12 +170,16 @@ class BaserockImportApplication(cliapp.Application):
def import_rubygems(self, args):
'''Import one or more RubyGems.'''
- if len(args) != 1:
+ if len(args) not in [1, 2]:
raise cliapp.AppException(
- 'Please pass the name of a RubyGem on the commandline.')
+ 'Please pass the name and version of a RubyGem on the '
+ 'commandline.')
+
+ goal_name = args[0]
+ goal_version = args[1] if len(args) == 2 else 'master'
loop = baserockimport.mainloop.ImportLoop(
app=self,
- goal_kind='rubygems', goal_name=args[0], goal_version='master')
+ goal_kind='rubygems', goal_name=goal_name, goal_version=goal_version)
loop.enable_importer('rubygems')
loop.run()