Module: D3::Basename
- Includes:
- Comparable
- Included in:
- Client::Receipt, Package, PuppyTime::PendingPuppy
- Defined in:
- lib/d3/basename.rb
Overview
This mixin module provides attributes and methods for dealing with d3 basenames, i.e. package families. It’s used by the Package, Client::Receipt, and Client::PendingPuppy classes.
Constant Summary collapse
- STATUSES =
The status of D3::Package & D3::Client::Receipt objects, and the integers stored in the DB for each D3::Package
- :unsaved D3::Package: a Ruby object that hasn't yet been created on the server D3::Client::Receipt: a Ruby object that hasn't yet been saved to the local receipt datastore - :pilot D3::Package: on the server, but not yet been made live,1 D3::Client::Receipt: installed when the pkg was in that state. - :live D3::Package: the currently active pkg for a given basename, D3::Client::Receipt: the matching pkg is current live on the server - :deprecated D3::Package: was once live, now superseded by a new version, but still on the server D3::Client::Receipt: the rcpt is older than the currently live pkg & will be upgraded at sync unless it was installed as a pilot - :skipped D3::Package: never made live, but older than the current live installer, still on the server, probably should be deleted - :missing D3::Package: the data is in the D3 Packages table, but the pkg is not in the JSS D3::Client::Receipt: No matching :pilot, :live, or :deprecated pkg on the server - :deleted D3::Package: the matching d3 data has been deleted from the server D3::Client::Receipt: the matching receipt has been deleted from the client
[ :unsaved, :pilot, :live, :deprecated, :skipped, :missing, :deleted ]
- STATUSES_FOR_FILTERS =
When filtering lists of pkgs/rcpts, unsaved and deleted are meaningless, so use this list
[ :pilot, :live, :deprecated, :skipped, :missing ]
Instance Attribute Summary collapse
-
#admin ⇒ String
readonly
Who’s uploading, releasing, installing, or archiving this thing?.
-
#basename ⇒ String
readonly
The basname of the thing installed.
-
#expiration ⇒ Integer
readonly
The days of disuse before an expirable edition expires.
-
#expiration_paths ⇒ String
readonly
The path to the executable that needs come to the foreground to prevent expiration.
-
#id ⇒ Integer
readonly
The JSS id of this package.
-
#package_type ⇒ Symbol
readonly
Is this package a .dmg or .pkg?.
-
#prohibiting_processes ⇒ Array<String>
readonly
An array of Strings for matching to the output lines of ‘/bin/ps -A -c -o comm’.
-
#revision ⇒ Integer
readonly
The d3 release number of the thing installed.
-
#status ⇒ Symbol
readonly
Whats the d3 status of this package? One of the values of D3::Basename::STATUSES.
-
#version ⇒ String
readonly
The version of the thing installed.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Use comparable to give sortability and equality.
-
#deleted? ⇒ Boolean
Is the status :deleted?.
-
#deprecated? ⇒ Boolean
Is the status :deprecated?.
-
#edition ⇒ String
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
Does a given array of pathnames have the same elements as This is generally used to compare two @expiration_paths arrays for “equality”.
-
#live? ⇒ Boolean
Is the status :live?.
-
#missing? ⇒ Boolean
Is the status :missing?.
-
#pilot? ⇒ Boolean
Is the status :pilot?.
-
#saved? ⇒ Boolean
Is the status :saved?.
-
#skipped? ⇒ Boolean
Is this pkg skipped? See Database::PACKAGE_STATUSES for details.
Instance Attribute Details
#admin ⇒ String (readonly)
Returns who’s uploading, releasing, installing, or archiving this thing?.
104 105 106 |
# File 'lib/d3/basename.rb', line 104 def admin @admin end |
#basename ⇒ String (readonly)
Returns the basname of the thing installed.
95 96 97 |
# File 'lib/d3/basename.rb', line 95 def basename @basename end |
#expiration ⇒ Integer (readonly)
Returns the days of disuse before an expirable edition expires. 0=never.
121 122 123 |
# File 'lib/d3/basename.rb', line 121 def expiration @expiration end |
#expiration_paths ⇒ String (readonly)
Returns the path to the executable that needs come to the foreground to prevent expiration.
124 125 126 |
# File 'lib/d3/basename.rb', line 124 def expiration_paths @expiration_paths end |
#id ⇒ Integer (readonly)
Returns the JSS id of this package.
107 108 109 |
# File 'lib/d3/basename.rb', line 107 def id @id end |
#package_type ⇒ Symbol (readonly)
Returns Is this package a .dmg or .pkg?.
113 114 115 |
# File 'lib/d3/basename.rb', line 113 def package_type @package_type end |
#prohibiting_processes ⇒ Array<String> (readonly)
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.
118 119 120 |
# File 'lib/d3/basename.rb', line 118 def prohibiting_processes @prohibiting_processes end |
#revision ⇒ Integer (readonly)
Returns the d3 release number of the thing installed.
101 102 103 |
# File 'lib/d3/basename.rb', line 101 def revision @revision end |
#status ⇒ Symbol
Returns whats the d3 status of this package? One of the values of D3::Basename::STATUSES.
110 111 112 |
# File 'lib/d3/basename.rb', line 110 def status @status end |
#version ⇒ String (readonly)
Returns the version of the thing installed.
98 99 100 |
# File 'lib/d3/basename.rb', line 98 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
Use comparable to give sortability and equality.
144 145 146 |
# File 'lib/d3/basename.rb', line 144 def <=> (other) self.edition <=> other.edition end |
#deleted? ⇒ Boolean
Is the status :deleted?
200 201 202 |
# File 'lib/d3/basename.rb', line 200 def deleted? @status == :deleted end |
#deprecated? ⇒ Boolean
Is the status :deprecated?
183 184 185 |
# File 'lib/d3/basename.rb', line 183 def deprecated? @status == :deprecated end |
#edition ⇒ String
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.
136 137 138 |
# File 'lib/d3/basename.rb', line 136 def edition "#{@basename}-#{@version}-#{@revision}" end |
#expiration_paths_match?(other_exp_paths) ⇒ Boolean
Does a given array of pathnames have the same elements as This is generally used to compare two @expiration_paths arrays for “equality”
214 215 216 217 |
# File 'lib/d3/basename.rb', line 214 def expiration_paths_match?(other_exp_paths) return false unless @expiration_paths and @expiration_paths.length == other_exp_paths.length (@expiration_paths - other_exp_paths).empty? end |
#live? ⇒ Boolean
Is the status :live?
168 169 170 |
# File 'lib/d3/basename.rb', line 168 def live? @status == :live end |
#missing? ⇒ Boolean
Is the status :missing?
192 193 194 |
# File 'lib/d3/basename.rb', line 192 def missing? @status == :missing end |
#pilot? ⇒ Boolean
Is the status :pilot?
160 161 162 |
# File 'lib/d3/basename.rb', line 160 def pilot? @status == :pilot end |
#saved? ⇒ Boolean
Is the status :saved?
152 153 154 |
# File 'lib/d3/basename.rb', line 152 def saved? @status != :unsaved end |
#skipped? ⇒ Boolean
Returns Is this pkg skipped? See Database::PACKAGE_STATUSES for details.
175 176 177 |
# File 'lib/d3/basename.rb', line 175 def skipped? @status == :skipped end |