class Locomotive::Wagon::CloneCommand

Public Class Methods

clone(name, path, options, shell) click to toggle source
# File lib/locomotive/wagon/commands/clone_command.rb, line 8
def self.clone(name, path, options, shell)
  new(name, path, options, shell).clone
end

Public Instance Methods

clone() click to toggle source
# File lib/locomotive/wagon/commands/clone_command.rb, line 12
def clone
  # create an empty site with the minimal settings
  create_site

  # pull the pages, content_types, basically any resources from the remote site
  pull_site
end
connection_info() click to toggle source
# File lib/locomotive/wagon/commands/clone_command.rb, line 20
def connection_info
  options.symbolize_keys.slice(:host, :handle, :email, :api_key, :password)
end

Private Instance Methods

create_site() click to toggle source
# File lib/locomotive/wagon/commands/clone_command.rb, line 26
def create_site
  require 'locomotive/wagon/generators/site'
  generator = Locomotive::Wagon::Generators::Site::Cloned
  generator.start [name, path, connection_info]
end
pull_site() click to toggle source
# File lib/locomotive/wagon/commands/clone_command.rb, line 32
def pull_site
  Locomotive::Wagon.pull('production', File.join(path, name), options.symbolize_keys, shell)
end