refactoring the clone command (WIP)
did
committed Jul 19, 2015
commit ac56e4c2bb88d9f71ddb87fc9f3c934045389ec6
Showing 3
changed files with
21 additions
and 3 deletions
locomotive/wagon.rb b/lib/locomotive/wagon.rb
+5
-2
| @@ | @@ -104,8 +104,11 @@ module Locomotive |
| # @param [ Hash ] connection_info The host, email and password needed to access the remote engine | |
| # @param [ Hash ] options The options for the API reader | |
| # | |
| - | def self.clone(name, path, connection_info, options = {}) |
| - | raise 'TODO' |
| + | def self.clone(name, path, options, shell) |
| + | require_relative 'wagon/commands/clone_command' |
| + | Locomotive::Wagon::CloneCommand.clone(name, path, options, shell) |
| + | |
| + | # raise 'TODO' |
| # target_path = File.expand_path(File.join(path, name)) | |
| # if File.exists?(target_path) | |
locomotive/wagon/cli.rb b/lib/locomotive/wagon/cli.rb
+1
-1
| @@ | @@ -221,7 +221,7 @@ module Locomotive |
| method_option :api_key, aliases: '-a', desc: 'api key of an administrator account' | |
| def clone(name, host, path = '.') | |
| begin | |
| - | if Locomotive::Wagon.clone(name, path, { host: host }.merge(options)) |
| + | if Locomotive::Wagon.clone(name, path, { host: host }.merge(options), shell) |
| self.print_next_instructions_when_site_created(name, path) | |
| end | |
| rescue Exception => e | |
locomotive/wagon/commands/clone_command.rb b/lib/locomotive/wagon/commands/clone_command.rb
+15
-0
| @@ | @@ -0,0 +1,15 @@ |
| + | module Locomotive::Wagon |
| + | |
| + | class CloneCommand < Struct.new(:name, :path, :options, :shell) |
| + | |
| + | def self.clone(name, path, options, shell) |
| + | new(name, path, options, shell).clone |
| + | end |
| + | |
| + | def clone |
| + | # TODO |
| + | end |
| + | |
| + | end |
| + | |
| + | end |