Class: Fig::Command::Action::SourcePackage

Inherits:
Object
  • Object
show all
Includes:
Fig::Command::Action, Role::HasNoSubAction
Defined in:
lib/fig/command/action/source_package.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::HasNoSubAction

#sub_action?

Methods included from Fig::Command::Action

#allow_both_descriptor_and_file?, #base_package_can_come_from_descriptor?, #cares_about_asset_options?, #execute_immediately_after_command_line_parse?, #list_dependencies?, #list_variables?, #prepare_repository, #primary_option, #publish?, #remote_operation_necessary?, #reset_environment?, #retrieves_should_happen?

Instance Method Details

#apply_base_config?Boolean

Returns:

  • (Boolean)


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

def apply_base_config?()
  return true
end

#apply_config?Boolean

Returns:

  • (Boolean)


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

def apply_config?()
  return true
end

#configure(options) ⇒ Object



40
41
42
# File 'lib/fig/command/action/source_package.rb', line 40

def configure(options)
  @file = options.file_to_find_package_for
end

#descriptor_requirementObject



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

def descriptor_requirement()
  return nil
end

#executeObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fig/command/action/source_package.rb', line 44

def execute()
  if ! File.exist? @file
    $stderr.puts %Q<"#{@file}" does not exist.>
    return EXIT_FAILURE
  end
  if File.directory? @file
    $stderr.puts %Q<"#{@file}" is a directory. Fig does not keep track of directories.>
    return EXIT_FAILURE
  end

  maintainer = @execution_context.working_directory_maintainer
  package_version = maintainer.find_package_version_for_file @file
  if ! package_version
    $stderr.puts %Q<Don't know anything about "#{@file}".>
    return EXIT_FAILURE
  end

  puts package_version

  return EXIT_SUCCESS
end

#load_base_package?Boolean

Returns:

  • (Boolean)


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

def load_base_package?()
  return true
end

#modifies_repository?Boolean

Returns:

  • (Boolean)


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

def modifies_repository?()
  return false
end

#optionsObject



12
13
14
# File 'lib/fig/command/action/source_package.rb', line 12

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

#register_base_package?Boolean

Returns:

  • (Boolean)


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

def register_base_package?()
  return true
end