Class: Dotsync::PushAction

Inherits:
BaseAction show all
Includes:
MappingsTransfer, OutputSections
Defined in:
lib/dotsync/actions/push_action.rb

Constant Summary

Constants included from MappingsTransfer

MappingsTransfer::DIFFERENCES_LEGEND, MappingsTransfer::MAPPINGS_LEGEND

Constants included from PathUtils

Dotsync::PathUtils::ENV_VARS_COLOR

Instance Attribute Summary

Attributes inherited from BaseAction

#logger

Instance Method Summary collapse

Methods included from OutputSections

#compute_output_sections

Methods included from MappingsTransfer

#show_differences, #show_differences_legend, #show_env_vars, #show_mappings, #show_mappings_legend, #transfer_mappings

Methods included from PathUtils

#colorize_env_vars, #expand_env_vars, #extract_env_vars, #path_is_parent_or_same?, #relative_to_absolute, #sanitize_path, #translate_tmp_path

Methods inherited from BaseAction

#initialize

Constructor Details

This class inherits a constructor from Dotsync::BaseAction

Instance Method Details

#execute(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dotsync/actions/push_action.rb', line 8

def execute(options = {})
  output_sections = compute_output_sections(options)

  show_options(options) if output_sections[:options]
  show_env_vars if output_sections[:env_vars]
  show_mappings_legend if output_sections[:mappings_legend]
  show_mappings if output_sections[:mappings]
  show_differences_legend if has_differences? && output_sections[:differences_legend]
  show_differences if output_sections[:differences]

  return unless options[:apply]

  # Confirmation prompt unless --yes flag is provided or no differences
  if has_differences? && !options[:yes] && !options[:quiet]
    return unless confirm_action
  end

  transfer_mappings
  action("Mappings pushed", icon: :done)
end