Class: Fig::Command::Action::Publish

Inherits:
Object
  • Object
show all
Includes:
Fig::Command::Action, Role::HasNoSubAction, Role::Publish
Defined in:
lib/fig/command/action/publish.rb

Constant Summary

Constants included from Fig::Command::Action

EXIT_FAILURE, EXIT_SUCCESS

Instance Attribute Summary

Attributes included from Fig::Command::Action

#execution_context

Instance Method Summary collapse

Methods included from Role::Publish

#allow_both_descriptor_and_file?, #apply_base_config?, #apply_config?, #base_package_can_come_from_descriptor?, #cares_about_asset_options?, #configure, #derive_publish_statements_from_environment_statements, #descriptor_requirement, #load_base_package?, #modifies_repository?, #publish?, #publish_preflight, #register_base_package?

Methods included from Role::HasNoSubAction

#sub_action?

Methods included from Fig::Command::Action

#allow_both_descriptor_and_file?, #apply_base_config?, #apply_config?, #base_package_can_come_from_descriptor?, #cares_about_asset_options?, #configure, #descriptor_requirement, #execute_immediately_after_command_line_parse?, #list_dependencies?, #list_variables?, #load_base_package?, #modifies_repository?, #prepare_repository, #primary_option, #publish?, #register_base_package?, #reset_environment?, #retrieves_should_happen?

Instance Method Details

#executeObject


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fig/command/action/publish.rb', line 26

def execute()
  publish_preflight()

  Fig::Logging.info "Checking status of #{@descriptor.to_string()}..."

  package_description =
    Fig::PackageDescriptor.format(@descriptor.name, @descriptor.version, nil)
  if @execution_context.repository.list_remote_packages.include?(
    package_description
  )
    Fig::Logging.info "#{@descriptor.to_string()} has already been published."

    if not @force
      raise Fig::UserInputError.new(
        'Use the --force option if you really want to overwrite.'
      )
    else
      Fig::Logging.info 'Overwriting...'
    end
  end

  Fig::Logging.info "Publishing #{@descriptor.to_string()}."
  @execution_context.repository.publish_package(
    @publish_statements,
    @descriptor,
    false,
    @execution_context.base_package,
    @force
  )

  return EXIT_SUCCESS
end

#optionsObject


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

def options()
  return %w<--publish>
end

#remote_operation_necessary?Boolean

Returns:

  • (Boolean)

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

def remote_operation_necessary?()
  return true
end