Class: Gerrit::Command::Clone
Overview
Clone a Gerrit project and set up its remotes to push/pull from Gerrit.
Instance Method Summary collapse
Methods inherited from Base
#execute_command, from_arguments, #initialize, #run
Methods included from Utils
camel_case, commit_hash?, human_time, map_in_parallel, snake_case
Constructor Details
This class inherits a constructor from Gerrit::Command::Base
Instance Method Details
#execute ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gerrit/command/clone.rb', line 4 def execute unless config[:push_remote] raise ConfigurationInvalidError, 'Missing `push_remote` option in your configuration' end unless config[:remotes] raise ConfigurationInvalidError, 'Missing `remotes` option in your configuration' end unless config[:remotes][config[:push_remote]] raise ConfigurationInvalidError, "Missing `#{config[:push_remote]}` remote in your `remotes` configuration" end project_name = project remote_url = config[:remotes][config[:push_remote]]['url'] % { user: config[:user], host: config[:host], port: config[:port], project: project_name, } clone(remote_url, project_name) end |