Sha256: 40c7600b1a67552d4eb7151ae7fc6b10ddbe654b088d8ba669243f8b88593e8a

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

module Pione
  module Command
    # `PionePackageUpdate` is a subcommand that updates PIONE package.
    class PionePackageUpdate < BasicCommand
      #
      # informations
      #

      define(:name, "update")
      define(:desc, "Update the package to package database")

      #
      # arguments
      #

      argument(:location) do |item|
        item.type    = :location
        item.desc    = "the package location that you want to update"
        item.missing = "There are no PIONE documents or packages."
      end

      #
      # options
      #

      option CommonOption.color
      option CommonOption.debug

      option(:force) do |item|
        item.type    = :boolean
        item.long    = "--force"
        item.desc    = "update pacakge info files"
        item.default = true
      end

      #
      # command lifecycle: execution phase
      #

      phase(:execution) do |seq|
        seq << :update
      end

      execution(:update) do |item|
        item.desc = "Update update info files"

        item.process do
          Package::PackageHandler.write_info_files(model[:location], force: model[:force])
        end

        item.exception(Package::InvalidScenario) do |e|
          cmd.abort(e)
        end
      end
    end

    PionePackage.define_subcommand("update", PionePackageUpdate)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pione-0.4.1 lib/pione/command/pione-package-update.rb
pione-0.4.0 lib/pione/command/pione-package-update.rb