Class: Fig::RepositoryPackagePublisher

Inherits:
Object
  • Object
show all
Defined in:
lib/fig/repository_package_publisher.rb

Overview

Handles package publishing for the Repository.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRepositoryPackagePublisher

Returns a new instance of RepositoryPackagePublisher.


47
48
49
50
51
52
# File 'lib/fig/repository_package_publisher.rb', line 47

def initialize()
  @text_assembler =
    Fig::PackageDefinitionTextAssembler.new :emit_as_to_be_published

  return
end

Instance Attribute Details

#application_configuration=(value) ⇒ Object (writeonly)

Sets the attribute application_configuration

Parameters:

  • value

    the value to set the attribute application_configuration to.


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

def application_configuration=(value)
  @application_configuration = value
end

#base_temp_dir=(value) ⇒ Object (writeonly)

Sets the attribute base_temp_dir

Parameters:

  • value

    the value to set the attribute base_temp_dir to.


39
40
41
# File 'lib/fig/repository_package_publisher.rb', line 39

def base_temp_dir=(value)
  @base_temp_dir = value
end

#descriptor=(value) ⇒ Object (writeonly)

Sets the attribute descriptor

Parameters:

  • value

    the value to set the attribute descriptor to.


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

def descriptor=(value)
  @descriptor = value
end

#local_directory_for_package=(value) ⇒ Object (writeonly)

Sets the attribute local_directory_for_package

Parameters:

  • value

    the value to set the attribute local_directory_for_package to.


41
42
43
# File 'lib/fig/repository_package_publisher.rb', line 41

def local_directory_for_package=(value)
  @local_directory_for_package = value
end

#local_fig_file_for_package=(value) ⇒ Object (writeonly)

Sets the attribute local_fig_file_for_package

Parameters:

  • value

    the value to set the attribute local_fig_file_for_package to.


43
44
45
# File 'lib/fig/repository_package_publisher.rb', line 43

def local_fig_file_for_package=(value)
  @local_fig_file_for_package = value
end

#local_only=(value) ⇒ Object (writeonly)

Sets the attribute local_only

Parameters:

  • value

    the value to set the attribute local_only to.


45
46
47
# File 'lib/fig/repository_package_publisher.rb', line 45

def local_only=(value)
  @local_only = value
end

#operating_system=(value) ⇒ Object (writeonly)

Sets the attribute operating_system

Parameters:

  • value

    the value to set the attribute operating_system to.


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

def operating_system=(value)
  @operating_system = value
end

#options=(value) ⇒ Object (writeonly)

Sets the attribute options

Parameters:

  • value

    the value to set the attribute options to.


33
34
35
# File 'lib/fig/repository_package_publisher.rb', line 33

def options=(value)
  @options = value
end

#publish_listeners=(value) ⇒ Object (writeonly)

Sets the attribute publish_listeners

Parameters:

  • value

    the value to set the attribute publish_listeners to.


35
36
37
# File 'lib/fig/repository_package_publisher.rb', line 35

def publish_listeners=(value)
  @publish_listeners = value
end

#remote_directory_for_package=(value) ⇒ Object (writeonly)

Sets the attribute remote_directory_for_package

Parameters:

  • value

    the value to set the attribute remote_directory_for_package to.


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

def remote_directory_for_package=(value)
  @remote_directory_for_package = value
end

#remote_fig_file_for_package=(value) ⇒ Object (writeonly)

Sets the attribute remote_fig_file_for_package

Parameters:

  • value

    the value to set the attribute remote_fig_file_for_package to.


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

def remote_fig_file_for_package=(value)
  @remote_fig_file_for_package = value
end

#runtime_for_package=(value) ⇒ Object (writeonly)

Sets the attribute runtime_for_package

Parameters:

  • value

    the value to set the attribute runtime_for_package to.


40
41
42
# File 'lib/fig/repository_package_publisher.rb', line 40

def runtime_for_package=(value)
  @runtime_for_package = value
end

#source_package=(value) ⇒ Object (writeonly)

Sets the attribute source_package

Parameters:

  • value

    the value to set the attribute source_package to.


37
38
39
# File 'lib/fig/repository_package_publisher.rb', line 37

def source_package=(value)
  @source_package = value
end

#was_forced=(value) ⇒ Object (writeonly)

Sets the attribute was_forced

Parameters:

  • value

    the value to set the attribute was_forced to.


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

def was_forced=(value)
  @was_forced = value
end

Instance Method Details

#package_statements=(statements) ⇒ Object


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

def package_statements=(statements)
  @text_assembler.add_input(statements)
end

#publish_packageObject


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fig/repository_package_publisher.rb', line 58

def publish_package()
  ()

  temp_dir = publish_temp_dir()
  @operating_system.delete_and_recreate_directory(temp_dir)
  @operating_system.delete_and_recreate_directory(
    @local_directory_for_package
  )
  @operating_system.delete_and_recreate_directory(@runtime_for_package)

  fig_file = File.join(temp_dir, Fig::Repository::PACKAGE_FILE_IN_REPO)
  content, published_package =
    derive_definition_file_and_create_resource_archive
  @operating_system.write(fig_file, content)

  publish_package_contents
  if not @local_only
    @operating_system.upload(fig_file, @remote_fig_file_for_package)
  end
  @operating_system.copy(fig_file, @local_fig_file_for_package)

  notify_listeners

  FileUtils.rm_rf(temp_dir)

  check_published_environment_variables published_package

  return true
end