class Locomotive::Wagon::SyncCommand

Constants

RESOURCES

Public Class Methods

sync(env, path, options, shell) click to toggle source
# File lib/locomotive/wagon/commands/sync_command.rb, line 25
def self.sync(env, path, options, shell)
  self.new(env, path, options, shell).sync
end

Public Instance Methods

sync() click to toggle source
# File lib/locomotive/wagon/commands/sync_command.rb, line 29
def sync
  if options[:verbose]
    SyncLogger.new
    _sync
  else
    show_wait_spinner('Syncing content...') { _sync }
  end
end

Private Instance Methods

_sync() click to toggle source
# File lib/locomotive/wagon/commands/sync_command.rb, line 40
def _sync
  api_client = api_site_client(connection_information)

  site = api_client.current_site.get

  each_resource do |klass|
    klass.sync(api_client, site, path, env)
  end

  print_result_message
end
connection_information() click to toggle source
# File lib/locomotive/wagon/commands/sync_command.rb, line 62
def connection_information
  read_deploy_settings(self.env, self.path)
end
each_resource() { |klass| ... } click to toggle source
# File lib/locomotive/wagon/commands/sync_command.rb, line 52
def each_resource
  RESOURCES.each do |name|
    next if !options[:resources].blank? && !options[:resources].include?(name)

    klass = "Locomotive::Wagon::Sync#{name.camelcase}Command".constantize

    yield klass
  end
end
print_result_message() click to toggle source