Module: Fig::Command::Action

Included in:
Clean, DumpPackageDefinitionParsed, DumpPackageDefinitionText, Get, Help, HelpLong, ListConfigs, ListDependencies, ListDependencies::AllConfigs, ListDependencies::Default, ListDependencies::Tree, ListDependencies::TreeAllConfigs, ListLocal, ListRemote, ListVariables, ListVariables::AllConfigs, ListVariables::Default, ListVariables::Tree, ListVariables::TreeAllConfigs, Options, Publish, PublishLocal, RunCommandLine, RunCommandStatement, Update, UpdateIfMissing, Version
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/list_variables.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_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_dependencies/default.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_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

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, DumpPackageDefinitionParsed, DumpPackageDefinitionText, Get, Help, HelpLong, ListConfigs, ListDependencies, ListLocal, ListRemote, ListVariables, Options, Publish, PublishLocal, RunCommandLine, RunCommandStatement, Update, UpdateIfMissing, Version

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.



15
16
17
# File 'lib/fig/command/action.rb', line 15

def execution_context=(value)
  @execution_context = value
end

Instance Method Details

#allow_both_descriptor_and_file?Boolean

Returns:

  • (Boolean)


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

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)


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

def apply_base_config?()
  raise NotImplementedError
end

#apply_config?Boolean

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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

def apply_config?()
  raise NotImplementedError
end

#base_package_can_come_from_descriptor?Boolean

Returns:

  • (Boolean)


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

def base_package_can_come_from_descriptor?()
  return true
end

#cares_about_package_content_options?Boolean

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

Returns:

  • (Boolean)


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

def cares_about_package_content_options?()
  return false
end

#configure(options) ⇒ Object

Slurp data out of command-line options.



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

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

#descriptor_requirementObject

Raises:

  • (NotImplementedError)


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

def descriptor_requirement()
  raise NotImplementedError
end

#executeObject

Raises:

  • (NotImplementedError)


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

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)


28
29
30
# File 'lib/fig/command/action.rb', line 28

def execute_immediately_after_command_line_parse?
  return false
end

#load_base_package?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

def load_base_package?()
  raise NotImplementedError
end

#modifies_repository?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/fig/command/action.rb', line 46

def modifies_repository?()
  raise NotImplementedError
end

#optionsObject

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/fig/command/action.rb', line 21

def options()
  raise NotImplementedError
end

#prepare_repository(repository) ⇒ Object



50
51
52
# File 'lib/fig/command/action.rb', line 50

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

#primary_optionObject



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

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

#register_base_package?Boolean

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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

def register_base_package?()
  raise NotImplementedError
end

#remote_operation_necessary?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/fig/command/action.rb', line 77

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)


91
92
93
# File 'lib/fig/command/action.rb', line 91

def reset_environment?()
  return false
end

#retrieves_should_happen?Boolean

Returns:

  • (Boolean)


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

def retrieves_should_happen?()
  return false
end