Class: D3::PuppyTime::PendingPuppy

Inherits:
Object
  • Object
show all
Includes:
Basename
Defined in:
lib/d3/puppytime/pending_puppy.rb

Overview

PendingPuppy - a d3 pkg awaiting installation during puppytime.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ PendingPuppy

We don’t need much data about the pkg to be installed These are required in the args:

:basename
:version
:revision
:admin
:status

These are optional:

:force - use force when installing

Raises:

  • (JSS::MissingDataError)


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/d3/puppytime/pending_puppy.rb', line 65

def initialize (args = {})
  raise JSS::MissingDataError, "Puppies need a :basename" unless args[:basename]
  raise JSS::MissingDataError, "Puppies need a :version" unless args[:version]
  raise JSS::MissingDataError, "Puppies need a :revision" unless args[:revision]
  raise JSS::MissingDataError, "Puppies need an :admin" unless args[:admin]
  raise JSS::MissingDataError, "Puppies need an :status" unless args[:status]

  @basename = args[:basename]
  @version = args[:version]
  @revision = args[:revision]
  @admin = args[:admin]
  @custom_expiration = args[:custom_expiration]
  @status = args[:status]

  @id = D3::Package.ids_to_editions.invert[edition]

  raise JSS::InvalidDataError, "Edition #{edition} doesn't exist in d3." unless @id

  @force = args[:force]
end

Instance Attribute Details

#adminString (readonly) Originally defined in module Basename

Returns who’s uploading, releasing, installing, or archiving this thing?.

Returns:

  • (String)

    who’s uploading, releasing, installing, or archiving this thing?

#basenameString (readonly) Originally defined in module Basename

Returns the basname of the thing installed.

Returns:

  • (String)

    the basname of the thing installed

#custom_expirationInteger (readonly)

Returns the expiration period for this app.

Returns:

  • (Integer)

    the expiration period for this app



51
52
53
# File 'lib/d3/puppytime/pending_puppy.rb', line 51

def custom_expiration
  @custom_expiration
end

#expirationInteger (readonly) Originally defined in module Basename

Returns the days of disuse before an expirable edition expires. 0=never.

Returns:

  • (Integer)

    the days of disuse before an expirable edition expires. 0=never

#expiration_pathsString (readonly) Originally defined in module Basename

Returns the path to the executable that needs come to the foreground to prevent expiration.

Returns:

  • (String)

    the path to the executable that needs come to the foreground to prevent expiration

#forceBoolean (readonly)

Returns was this puppy queued with force?.

Returns:

  • (Boolean)

    was this puppy queued with force?



45
46
47
# File 'lib/d3/puppytime/pending_puppy.rb', line 45

def force
  @force
end

#idInteger (readonly) Originally defined in module Basename

Returns the JSS id of this package.

Returns:

  • (Integer)

    the JSS id of this package

#package_typeSymbol (readonly) Originally defined in module Basename

Returns Is this package a .dmg or .pkg?.

Returns:

  • (Symbol)

    Is this package a .dmg or .pkg?

#prohibiting_processesArray<String> (readonly) Originally defined in module Basename

Returns an array of Strings for matching to the output lines of ‘/bin/ps -A -c -o comm’. If there’s a match, this pkg won’t be installed or uninstalled without a graceful quit.

Returns:

  • (Array<String>)

    an array of Strings for matching to the output lines of ‘/bin/ps -A -c -o comm’. If there’s a match, this pkg won’t be installed or uninstalled without a graceful quit

#queued_atTime

Returns when was this puppy added to the queue.

Returns:

  • (Time)

    when was this puppy added to the queue



48
49
50
# File 'lib/d3/puppytime/pending_puppy.rb', line 48

def queued_at
  @queued_at
end

#revisionInteger (readonly) Originally defined in module Basename

Returns the d3 release number of the thing installed.

Returns:

  • (Integer)

    the d3 release number of the thing installed

#statusSymbol Originally defined in module Basename

Returns whats the d3 status of this package? One of the values of D3::Basename::STATUSES.

Returns:

  • (Symbol)

    whats the d3 status of this package? One of the values of D3::Basename::STATUSES

#versionString (readonly) Originally defined in module Basename

Returns the version of the thing installed.

Returns:

  • (String)

    the version of the thing installed

Instance Method Details

#<=>(other) ⇒ Object Originally defined in module Basename

Use comparable to give sortability and equality.

#deleted?Boolean Originally defined in module Basename

Is the status :deleted?

Returns:

  • (Boolean)

#deprecated?Boolean Originally defined in module Basename

Is the status :deprecated?

Returns:

  • (Boolean)

#editionString Originally defined in module Basename

While several packages can have the same basename, the combination of basename, version, and revision (called the ‘edition’) must be unique among the d3 packages.

Returns:

  • (String)

    the basename, version ,and revision of this package, joined with hyphens

#expiration_paths_match?(other_exp_paths) ⇒ Boolean Originally defined in module Basename

Does a given array of pathnames have the same elements as This is generally used to compare two @expiration_paths arrays for “equality”

Parameters:

  • other_exp_paths (Array)

    An array if Pathnames to compare to @expiration_paths

Returns:

  • (Boolean)

    Are they the same aside from order?

#installvoid

This method returns an undefined value.

Install this puppy



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/d3/puppytime/pending_puppy.rb', line 90

def install

  begin # for ensure

    install_args = {:puppywalk => true, :admin => @admin, :force => @force}
    install_args[:expiration] =  @custom_expiration if @custom_expiration

    # install it  - this will remove it from the queue if successful
    D3::Package.fetch(:edition => edition).install(install_args)
  ensure
    # but we need to remove it even if not successfull, so it doesn't
    # keep trying and failing (and reminding the users)
    D3::PuppyTime::PuppyQueue.instance - self
  end
end

#live?Boolean Originally defined in module Basename

Is the status :live?

Returns:

  • (Boolean)

#missing?Boolean Originally defined in module Basename

Is the status :missing?

Returns:

  • (Boolean)

#pilot?Boolean Originally defined in module Basename

Is the status :pilot?

Returns:

  • (Boolean)

#saved?Boolean Originally defined in module Basename

Is the status :saved?

Returns:

  • (Boolean)

#skipped?Boolean Originally defined in module Basename

Returns Is this pkg skipped? See Database::PACKAGE_STATUSES for details.

Returns:

  • (Boolean)

    Is this pkg skipped? See Database::PACKAGE_STATUSES for details