Class: D3::PuppyTime::PendingPuppy
- Inherits:
-
Object
- Object
- D3::PuppyTime::PendingPuppy
- Includes:
- Basename
- Defined in:
- lib/d3/puppytime/pending_puppy.rb
Overview
PendingPuppy - a d3 pkg awaiting installation during puppytime.
Instance Attribute Summary collapse
-
#admin ⇒ String
included
from Basename
readonly
Who’s uploading, releasing, installing, or archiving this thing?.
-
#basename ⇒ String
included
from Basename
readonly
The basname of the thing installed.
-
#custom_expiration ⇒ Integer
readonly
The expiration period for this app.
-
#expiration ⇒ Integer
included
from Basename
readonly
The days of disuse before an expirable edition expires.
-
#expiration_paths ⇒ String
included
from Basename
readonly
The path to the executable that needs come to the foreground to prevent expiration.
-
#force ⇒ Boolean
readonly
Was this puppy queued with force?.
-
#id ⇒ Integer
included
from Basename
readonly
The JSS id of this package.
-
#package_type ⇒ Symbol
included
from Basename
readonly
Is this package a .dmg or .pkg?.
-
#prohibiting_processes ⇒ Array<String>
included
from Basename
readonly
An array of Strings for matching to the output lines of ‘/bin/ps -A -c -o comm’.
-
#queued_at ⇒ Time
When was this puppy added to the queue.
-
#revision ⇒ Integer
included
from Basename
readonly
The d3 release number of the thing installed.
-
#status ⇒ Symbol
included
from Basename
readonly
Whats the d3 status of this package? One of the values of D3::Basename::STATUSES.
-
#version ⇒ String
included
from Basename
readonly
The version of the thing installed.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
included
from Basename
Use comparable to give sortability and equality.
-
#deleted? ⇒ Boolean
included
from Basename
Is the status :deleted?.
-
#deprecated? ⇒ Boolean
included
from Basename
Is the status :deprecated?.
-
#edition ⇒ String
included
from 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.
-
#expiration_paths_match?(other_exp_paths) ⇒ Boolean
included
from Basename
Does a given array of pathnames have the same elements as This is generally used to compare two @expiration_paths arrays for “equality”.
-
#initialize(args = {}) ⇒ PendingPuppy
constructor
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.
-
#install ⇒ void
Install this puppy.
-
#live? ⇒ Boolean
included
from Basename
Is the status :live?.
-
#missing? ⇒ Boolean
included
from Basename
Is the status :missing?.
-
#pilot? ⇒ Boolean
included
from Basename
Is the status :pilot?.
-
#saved? ⇒ Boolean
included
from Basename
Is the status :saved?.
-
#skipped? ⇒ Boolean
included
from Basename
Is this pkg skipped? See Database::PACKAGE_STATUSES for details.
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
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
#admin ⇒ String (readonly) Originally defined in module Basename
Returns who’s uploading, releasing, installing, or archiving this thing?.
#basename ⇒ String (readonly) Originally defined in module Basename
Returns the basname of the thing installed.
#custom_expiration ⇒ Integer (readonly)
Returns the expiration period for this app.
51 52 53 |
# File 'lib/d3/puppytime/pending_puppy.rb', line 51 def custom_expiration @custom_expiration end |
#expiration ⇒ Integer (readonly) Originally defined in module Basename
Returns the days of disuse before an expirable edition expires. 0=never.
#expiration_paths ⇒ String (readonly) Originally defined in module Basename
Returns the path to the executable that needs come to the foreground to prevent expiration.
#force ⇒ Boolean (readonly)
Returns was this puppy queued with force?.
45 46 47 |
# File 'lib/d3/puppytime/pending_puppy.rb', line 45 def force @force end |
#id ⇒ Integer (readonly) Originally defined in module Basename
Returns the JSS id of this package.
#package_type ⇒ Symbol (readonly) Originally defined in module Basename
Returns Is this package a .dmg or .pkg?.
#prohibiting_processes ⇒ Array<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.
#queued_at ⇒ Time
Returns 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 |
#revision ⇒ Integer (readonly) Originally defined in module Basename
Returns the d3 release number of the thing installed.
#status ⇒ Symbol Originally defined in module Basename
Returns whats the d3 status of this package? One of the values of D3::Basename::STATUSES.
#version ⇒ String (readonly) Originally defined in module Basename
Returns 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?
#deprecated? ⇒ Boolean Originally defined in module Basename
Is the status :deprecated?
#edition ⇒ String 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.
#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”
#install ⇒ void
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?
#missing? ⇒ Boolean Originally defined in module Basename
Is the status :missing?
#pilot? ⇒ Boolean Originally defined in module Basename
Is the status :pilot?
#saved? ⇒ Boolean Originally defined in module Basename
Is the status :saved?
#skipped? ⇒ Boolean Originally defined in module Basename
Returns Is this pkg skipped? See Database::PACKAGE_STATUSES for details.