Class: Locomotive::Wagon::PushCommand

Inherits:
Struct
  • Object
show all
Includes:
ApiConcern, DeployFileConcern, InstrumentationConcern, NetrcConcern, SpinnerConcern, SteamConcern
Defined in:
lib/locomotive/wagon/commands/push_command.rb

Constant Summary collapse

RESOURCES =
%w(site content_types content_entries pages snippets sections theme_assets translations).freeze
RESOURCES_WITH_CONTENT =
%w(content_entries translations).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SpinnerConcern

#show_wait_spinner

Methods included from InstrumentationConcern

#instrument, #instrument_scope_name

Methods included from SteamConcern

#steam_services

Methods included from DeployFileConcern

#deploy_file, #read_deploy_settings, #write_deploy_settings

Methods included from NetrcConcern

#read_credentials_from_netrc, #write_credentials_to_netrc

Methods included from ApiConcern

#api_client, #api_credentials, #api_host, #api_site_client, #connection_information_from_env_and_path

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



28
29
30
# File 'lib/locomotive/wagon/commands/push_command.rb', line 28

def credentials
  @credentials
end

#envObject

Returns the value of attribute env

Returns:

  • (Object)

    the current value of env



15
16
17
# File 'lib/locomotive/wagon/commands/push_command.rb', line 15

def env
  @env
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



15
16
17
# File 'lib/locomotive/wagon/commands/push_command.rb', line 15

def options
  @options
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



15
16
17
# File 'lib/locomotive/wagon/commands/push_command.rb', line 15

def path
  @path
end

#platform_urlObject

Returns the value of attribute platform_url.



28
29
30
# File 'lib/locomotive/wagon/commands/push_command.rb', line 28

def platform_url
  @platform_url
end

#shellObject

Returns the value of attribute shell

Returns:

  • (Object)

    the current value of shell



15
16
17
# File 'lib/locomotive/wagon/commands/push_command.rb', line 15

def shell
  @shell
end

Class Method Details

.push(env, path, options, shell) ⇒ Object



30
31
32
# File 'lib/locomotive/wagon/commands/push_command.rb', line 30

def self.push(env, path, options, shell)
  self.new(env, path, options, shell).push
end

Instance Method Details

#pushObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/locomotive/wagon/commands/push_command.rb', line 34

def push
  require 'haml'

  Locomotive::Wagon.require_misc_gems

  api_client = build_api_site_client(connection_information)

  return if api_client.nil?

  # Ask for a confirmation (Warning) if we deploy with the -d option
  # since it alters content on the remote engine
  if options[:data]
    return unless ask_for_performing("Warning! You're about to deploy data which will alter the content of your site.")
  end

  if options[:verbose]
    PushLogger.new
    _push(api_client)
  else
    show_wait_spinner('Deploying...') { _push(api_client) }
  end
end