Module: Fig::Command::Action

Included in:
Clean, DumpPackageDefinitionForCommandLine, DumpPackageDefinitionParsed, DumpPackageDefinitionText, Get, Help, HelpLong, ListConfigs, ListDependencies, ListDependencies::AllConfigs, ListDependencies::Default, ListDependencies::Graphviz, ListDependencies::GraphvizAllConfigs, ListDependencies::JSON, ListDependencies::JSONAllConfigs, ListDependencies::Tree, ListDependencies::TreeAllConfigs, ListDependencies::YAML, ListDependencies::YAMLAllConfigs, ListLocal, ListRemote, ListVariables, ListVariables::AllConfigs, ListVariables::Default, ListVariables::Graphviz, ListVariables::GraphvizAllConfigs, ListVariables::JSON, ListVariables::JSONAllConfigs, ListVariables::Tree, ListVariables::TreeAllConfigs, ListVariables::YAML, ListVariables::YAMLAllConfigs, Options, Publish, PublishLocal, RunCommandLine, RunCommandStatement, SourcePackage, Update, UpdateIfMissing, Version, VersionPlain
Defined in:
lib/fig/command/action.rb,
lib/fig/command/action/get.rb,
lib/fig/command/action/help.rb,
lib/fig/command/action/clean.rb,
lib/fig/command/action/update.rb,
lib/fig/command/action/options.rb,
lib/fig/command/action/publish.rb,
lib/fig/command/action/version.rb,
lib/fig/command/action/help_long.rb,
lib/fig/command/action/list_local.rb,
lib/fig/command/action/list_remote.rb,
lib/fig/command/action/role/update.rb,
lib/fig/command/action/list_configs.rb,
lib/fig/command/action/role/publish.rb,
lib/fig/command/action/publish_local.rb,
lib/fig/command/action/version_plain.rb,
lib/fig/command/action/list_variables.rb,
lib/fig/command/action/source_package.rb,
lib/fig/command/action/run_command_line.rb,
lib/fig/command/action/list_dependencies.rb,
lib/fig/command/action/role/list_as_json.rb,
lib/fig/command/action/role/list_as_yaml.rb,
lib/fig/command/action/update_if_missing.rb,
lib/fig/command/action/list_variables/json.rb,
lib/fig/command/action/list_variables/tree.rb,
lib/fig/command/action/list_variables/yaml.rb,
lib/fig/command/action/role/has_sub_action.rb,
lib/fig/command/action/role/list_all_configs.rb,
lib/fig/command/action/role/list_as_graphviz.rb,
lib/fig/command/action/role/list_base_config.rb,
lib/fig/command/action/run_command_statement.rb,
lib/fig/command/action/list_dependencies/json.rb,
lib/fig/command/action/list_dependencies/tree.rb,
lib/fig/command/action/list_dependencies/yaml.rb,
lib/fig/command/action/list_variables/default.rb,
lib/fig/command/action/role/has_no_sub_action.rb,
lib/fig/command/action/list_variables/graphviz.rb,
lib/fig/command/action/list_dependencies/default.rb,
lib/fig/command/action/list_dependencies/graphviz.rb,
lib/fig/command/action/list_variables/all_configs.rb,
lib/fig/command/action/role/list_dependencies_flat.rb,
lib/fig/command/action/dump_package_definition_text.rb,
lib/fig/command/action/list_dependencies/all_configs.rb,
lib/fig/command/action/role/list_from_data_structure.rb,
lib/fig/command/action/role/list_variables_in_a_tree.rb,
lib/fig/command/action/dump_package_definition_parsed.rb,
lib/fig/command/action/list_variables/json_all_configs.rb,
lib/fig/command/action/list_variables/tree_all_configs.rb,
lib/fig/command/action/list_variables/yaml_all_configs.rb,
lib/fig/command/action/role/list_variables_as_graphviz.rb,
lib/fig/command/action/role/list_dependencies_in_a_tree.rb,
lib/fig/command/action/role/list_walking_dependency_tree.rb,
lib/fig/command/action/list_dependencies/json_all_configs.rb,
lib/fig/command/action/list_dependencies/tree_all_configs.rb,
lib/fig/command/action/list_dependencies/yaml_all_configs.rb,
lib/fig/command/action/role/list_dependencies_as_graphviz.rb,
lib/fig/command/action/list_variables/graphviz_all_configs.rb,
lib/fig/command/action/list_dependencies/graphviz_all_configs.rb,
lib/fig/command/action/role/list_variables_from_data_structure.rb,
lib/fig/command/action/dump_package_definition_for_command_line.rb,
lib/fig/command/action/role/list_dependencies_from_data_structure.rb

Overview

One of the main activities Fig should do as part of the current run.

This exists because the code used to have complicated logic about whether a package.fig should be read, whether the Package object should be loaded, should a config be applied, when should some activity happen, etc. Now, we let the Action object say what it wants in terms of setup and then tell it to do whatever it needs to.

Defined Under Namespace

Modules: Role Classes: Clean, DumpPackageDefinitionForCommandLine, DumpPackageDefinitionParsed, DumpPackageDefinitionText, Get, Help, HelpLong, ListConfigs, ListDependencies, ListLocal, ListRemote, ListVariables, Options, Publish, PublishLocal, RunCommandLine, RunCommandStatement, SourcePackage, Update, UpdateIfMissing, Version, VersionPlain

Constant Summary collapse

EXIT_SUCCESS =
0
EXIT_FAILURE =
1

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#execution_context=(value) ⇒ Object (writeonly)

Sets the attribute execution_context

Parameters:

  • value

    the value to set the attribute execution_context to.


17
18
19
# File 'lib/fig/command/action.rb', line 17

def execution_context=(value)
  @execution_context = value
end

Instance Method Details

#allow_both_descriptor_and_file?Boolean

Returns:

  • (Boolean)

42
43
44
# File 'lib/fig/command/action.rb', line 42

def allow_both_descriptor_and_file?()
  return false
end

#apply_base_config?Boolean

true, false, or nil if don't care.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

87
88
89
90
91
# File 'lib/fig/command/action.rb', line 87

def apply_base_config?()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#apply_config?Boolean

true, false, or nil if don't care.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

80
81
82
83
84
# File 'lib/fig/command/action.rb', line 80

def apply_config?()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#base_package_can_come_from_descriptor?Boolean

Returns:

  • (Boolean)

68
69
70
# File 'lib/fig/command/action.rb', line 68

def base_package_can_come_from_descriptor?()
  return true
end

#cares_about_asset_options?Boolean

Does the action care about command-line options that affect package contents, i.e. –resource/–archive?

Returns:

  • (Boolean)

48
49
50
# File 'lib/fig/command/action.rb', line 48

def cares_about_asset_options?()
  return false
end

#configure(options) ⇒ Object

Slurp data out of command-line options.


127
128
129
130
# File 'lib/fig/command/action.rb', line 127

def configure(options)
  # Do nothing by default.
  return
end

#descriptor_requirementObject

Raises:

  • (NotImplementedError)

36
37
38
39
40
# File 'lib/fig/command/action.rb', line 36

def descriptor_requirement()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#executeObject

Raises:

  • (NotImplementedError)

132
133
134
135
136
# File 'lib/fig/command/action.rb', line 132

def execute()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#execute_immediately_after_command_line_parse?Boolean

Is this a special Action that should just be run on its own without looking at other Actions? Note that anything that returns true won't get an execution context.

Returns:

  • (Boolean)

32
33
34
# File 'lib/fig/command/action.rb', line 32

def execute_immediately_after_command_line_parse?
  return false
end

#list_dependencies?Boolean

Is this –list-dependencies?

Returns:

  • (Boolean)

102
103
104
# File 'lib/fig/command/action.rb', line 102

def list_dependencies?()
  return false
end

#list_variables?Boolean

Is this –list-variables?

Returns:

  • (Boolean)

107
108
109
# File 'lib/fig/command/action.rb', line 107

def list_variables?()
  return false
end

#load_base_package?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

62
63
64
65
66
# File 'lib/fig/command/action.rb', line 62

def load_base_package?()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#modifies_repository?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

52
53
54
55
56
# File 'lib/fig/command/action.rb', line 52

def modifies_repository?()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#optionsObject

Raises:

  • (NotImplementedError)

23
24
25
26
27
# File 'lib/fig/command/action.rb', line 23

def options()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#prepare_repository(repository) ⇒ Object


58
59
60
# File 'lib/fig/command/action.rb', line 58

def prepare_repository(repository)
  return # Nothing by default.
end

#primary_optionObject


19
20
21
# File 'lib/fig/command/action.rb', line 19

def primary_option()
  return options()[0]
end

#publish?Boolean

Is this a publish action?

Returns:

  • (Boolean)

112
113
114
# File 'lib/fig/command/action.rb', line 112

def publish?()
  return false
end

#register_base_package?Boolean

true, false, or nil if don't care.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

73
74
75
76
77
# File 'lib/fig/command/action.rb', line 73

def register_base_package?()
  raise NotImplementedError.new(
    "#{__callee__}() not implemented on #{self.class}."
  )
end

#remote_operation_necessary?Boolean

Returns:

  • (Boolean)

93
94
95
# File 'lib/fig/command/action.rb', line 93

def remote_operation_necessary?()
  return false
end

#reset_environment?Boolean

Answers whether we should reset the environment to nothing, sort of like the standardized environment that cron(1) creates. At present, we're only setting this when we're listing variables. One could imagine allowing this to be set by a command-line option in general; if we do this, the RuntimeEnvironment class will need to be changed to support deletion of values from ENV.

Returns:

  • (Boolean)

122
123
124
# File 'lib/fig/command/action.rb', line 122

def reset_environment?()
  return false
end

#retrieves_should_happen?Boolean

Returns:

  • (Boolean)

97
98
99
# File 'lib/fig/command/action.rb', line 97

def retrieves_should_happen?()
  return false
end