Module: Fig::Command::Action::Role::Publish
- Included in:
- Publish, PublishLocal
- Defined in:
- lib/fig/command/action/role/publish.rb
Instance Method Summary collapse
- #allow_both_descriptor_and_file? ⇒ Boolean
- #apply_base_config? ⇒ Boolean
- #apply_config? ⇒ Boolean
- #base_package_can_come_from_descriptor? ⇒ Boolean
- #cares_about_asset_options? ⇒ Boolean
- #configure(options) ⇒ Object
- #derive_publish_statements_from_environment_statements ⇒ Object
- #descriptor_requirement ⇒ Object
- #load_base_package? ⇒ Boolean
- #modifies_repository? ⇒ Boolean
-
#publish? ⇒ Boolean
Is this a publish action?.
- #publish_preflight ⇒ Object
- #register_base_package? ⇒ Boolean
Instance Method Details
#allow_both_descriptor_and_file? ⇒ Boolean
16 17 18 19 20 |
# File 'lib/fig/command/action/role/publish.rb', line 16 def allow_both_descriptor_and_file?() # Actually, publishing requires a descriptor and another source of the base # package. return true end |
#apply_base_config? ⇒ Boolean
46 47 48 |
# File 'lib/fig/command/action/role/publish.rb', line 46 def apply_base_config?() return nil # don't care end |
#apply_config? ⇒ Boolean
42 43 44 |
# File 'lib/fig/command/action/role/publish.rb', line 42 def apply_config?() return true end |
#base_package_can_come_from_descriptor? ⇒ Boolean
34 35 36 |
# File 'lib/fig/command/action/role/publish.rb', line 34 def base_package_can_come_from_descriptor?() return false end |
#cares_about_asset_options? ⇒ Boolean
22 23 24 |
# File 'lib/fig/command/action/role/publish.rb', line 22 def () return true end |
#configure(options) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/fig/command/action/role/publish.rb', line 55 def configure() @descriptor = .descriptor @environment_statements = .environment_statements @asset_statements = .asset_statements @force = .force? return end |
#derive_publish_statements_from_environment_statements ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/fig/command/action/role/publish.rb', line 93 def derive_publish_statements_from_environment_statements if @execution_context.package_loaded_from_path = 'Cannot publish based upon both a package definition file (' << @execution_context.package_loaded_from_path << ') and --set/--append options.' if @execution_context.package_source_description == Fig::Command::PackageLoader::DEFAULT_PACKAGE_FILE || @execution_context.package_source_description == Fig::Command::PackageLoader::DEFAULT_APPLICATION_FILE || << "\n\n" << 'You can avoid loading ' << @execution_context.package_source_description << ' by using the --no-file option.' end raise Fig::UserInputError.new() end @publish_statements = @asset_statements + [ Fig::Statement::Configuration.new( nil, nil, Fig::Package::DEFAULT_CONFIG, @environment_statements ) ] return end |
#descriptor_requirement ⇒ Object
12 13 14 |
# File 'lib/fig/command/action/role/publish.rb', line 12 def descriptor_requirement() return :required end |
#load_base_package? ⇒ Boolean
30 31 32 |
# File 'lib/fig/command/action/role/publish.rb', line 30 def load_base_package?() return true end |
#modifies_repository? ⇒ Boolean
26 27 28 |
# File 'lib/fig/command/action/role/publish.rb', line 26 def modifies_repository?() return true end |
#publish? ⇒ Boolean
Is this a publish action?
51 52 53 |
# File 'lib/fig/command/action/role/publish.rb', line 51 def publish?() return true end |
#publish_preflight ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/fig/command/action/role/publish.rb', line 64 def publish_preflight() if @descriptor.name.nil? || @descriptor.version.nil? raise Fig::UserInputError.new( 'Please specify a package name and a version name.' ) end if @descriptor.name == '_meta' raise Fig::UserInputError.new( %q<Due to implementation issues, cannot create a package named "_meta".> ) end if not @environment_statements.empty? derive_publish_statements_from_environment_statements elsif not @asset_statements.empty? raise Fig::UserInputError.new( '--resource/--archive options were specified, but no --set/--append option was given. Will not publish.' ) else if not @execution_context.base_package.statements.empty? @publish_statements = @execution_context.base_package.statements else raise Fig::UserInputError.new('Nothing to publish.') end end return end |
#register_base_package? ⇒ Boolean
38 39 40 |
# File 'lib/fig/command/action/role/publish.rb', line 38 def register_base_package?() return false end |