Module: Fig::Command::Action

Included in:
Clean, DumpPackageDefinitionForCommandLine, DumpPackageDefinitionParsed, DumpPackageDefinitionText, Get, Help, HelpLong, ListConfigs, ListDependencies, ListDependencies::AllConfigs, ListDependencies::Default, ListDependencies::Graphviz, ListDependencies::GraphvizAllConfigs, ListDependencies::Tree, ListDependencies::TreeAllConfigs, ListLocal, ListRemote, ListVariables, ListVariables::AllConfigs, ListVariables::Default, ListVariables::Graphviz, ListVariables::GraphvizAllConfigs, ListVariables::Tree, ListVariables::TreeAllConfigs, 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/update_if_missing.rb,
lib/fig/command/action/list_variables/tree.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/tree.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_variables_in_a_tree.rb,
lib/fig/command/action/dump_package_definition_parsed.rb,
lib/fig/command/action/list_variables/tree_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/tree_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/dump_package_definition_for_command_line.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)


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

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)


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

def apply_base_config?()
  raise NotImplementedError
end

#apply_config?Boolean

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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/fig/command/action.rb', line 70

def apply_config?()
  raise NotImplementedError
end

#base_package_can_come_from_descriptor?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/fig/command/action.rb', line 60

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)


44
45
46
# File 'lib/fig/command/action.rb', line 44

def cares_about_asset_options?()
  return false
end

#configure(options) ⇒ Object

Slurp data out of command-line options.



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

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

#descriptor_requirementObject

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/fig/command/action.rb', line 34

def descriptor_requirement()
  raise NotImplementedError
end

#executeObject

Raises:

  • (NotImplementedError)


118
119
120
# File 'lib/fig/command/action.rb', line 118

def execute()
  raise NotImplementedError
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)


30
31
32
# File 'lib/fig/command/action.rb', line 30

def execute_immediately_after_command_line_parse?
  return false
end

#list_dependencies?Boolean

Is this –list-dependencies?

Returns:

  • (Boolean)


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

def list_dependencies?()
  return false
end

#list_variables?Boolean

Is this –list-variables?

Returns:

  • (Boolean)


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

def list_variables?()
  return false
end

#load_base_package?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/fig/command/action.rb', line 56

def load_base_package?()
  raise NotImplementedError
end

#modifies_repository?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

def modifies_repository?()
  raise NotImplementedError
end

#optionsObject

Raises:

  • (NotImplementedError)


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

def options()
  raise NotImplementedError
end

#prepare_repository(repository) ⇒ Object



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

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)


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

def publish?()
  return false
end

#register_base_package?Boolean

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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/fig/command/action.rb', line 65

def register_base_package?()
  raise NotImplementedError
end

#remote_operation_necessary?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/fig/command/action.rb', line 79

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)


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

def reset_environment?()
  return false
end

#retrieves_should_happen?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/fig/command/action.rb', line 83

def retrieves_should_happen?()
  return false
end