Class: Kmc::Package
- Inherits:
-
Object
- Object
- Kmc::Package
- Extended by:
- PackageAttrs, PackageUtils
- Includes:
- PackageDsl
- Defined in:
- lib/kmc/package.rb
Class Attribute Summary collapse
-
.do_not_unzip ⇒ Object
readonly
Returns the value of attribute do_not_unzip.
-
.download_dir ⇒ Object
readonly
Returns the value of attribute download_dir.
-
.ksp_path ⇒ Object
readonly
Returns the value of attribute ksp_path.
Class Method Summary collapse
- .do_not_unzip! ⇒ Object
- .download! ⇒ Object
- .download_and_unzip! ⇒ Object
-
.inherited(package) ⇒ Object
a callback for when a subclass of this class is created.
-
.install!(ksp_path, caveats) ⇒ Object
Internal version of the ‘install` method.
-
.install_packages!(ksp_path, packages) ⇒ Object
Installs a list of packages, and outputs caveats when it’s done.
- .load_packages! ⇒ Object
- .packages ⇒ Object
Methods included from PackageAttrs
aliases, names, postrequisites, prerequisites, resolve_postrequisites, resolve_prerequisites, title, url
Methods included from PackageUtils
find, normalize_for_find, normalized_title, search
Methods included from PackageDsl
#merge_directory, #remove_filepath
Class Attribute Details
.do_not_unzip ⇒ Object (readonly)
Returns the value of attribute do_not_unzip.
16 17 18 |
# File 'lib/kmc/package.rb', line 16 def do_not_unzip @do_not_unzip end |
.download_dir ⇒ Object (readonly)
Returns the value of attribute download_dir.
16 17 18 |
# File 'lib/kmc/package.rb', line 16 def download_dir @download_dir end |
.ksp_path ⇒ Object (readonly)
Returns the value of attribute ksp_path.
16 17 18 |
# File 'lib/kmc/package.rb', line 16 def ksp_path @ksp_path end |
Class Method Details
.do_not_unzip! ⇒ Object
64 65 66 |
# File 'lib/kmc/package.rb', line 64 def do_not_unzip! @do_not_unzip = true end |
.download! ⇒ Object
60 61 62 |
# File 'lib/kmc/package.rb', line 60 def download! PackageDownloads.download_package(self) end |
.download_and_unzip! ⇒ Object
56 57 58 |
# File 'lib/kmc/package.rb', line 56 def download_and_unzip! PackageDownloads.download_and_unzip_package(self) end |
.inherited(package) ⇒ Object
a callback for when a subclass of this class is created
69 70 71 |
# File 'lib/kmc/package.rb', line 69 def inherited(package) (@@packages ||= []) << package end |
.install!(ksp_path, caveats) ⇒ Object
Internal version of the ‘install` method. Handles:
* Pre- and post-requisites
* Version control
* Post-processors
* Calling a package's #install method
* Building up caveats
The caveats argument is expected to be a hash going from Packages to caveat messages and will be modified in-place.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/kmc/package.rb', line 34 def install!(ksp_path, caveats) return if Versioner.already_installed?(ksp_path, self) Util.log "Installing package #{self.title}" prepare_for_install(ksp_path, caveats) Util.log "Saving your work before installing ..." Versioner.mark_preinstall(ksp_path, self) Util.log "Installing #{title} ..." self.new.install Util.log "Cleaning up ..." Util.run_post_processors!(ksp_path) Versioner.mark_postinstall(ksp_path, self) Util.log "Done!" install_postrequisites!(caveats) end |
.install_packages!(ksp_path, packages) ⇒ Object
Installs a list of packages, and outputs caveats when it’s done.
19 20 21 22 23 |
# File 'lib/kmc/package.rb', line 19 def install_packages!(ksp_path, packages) caveats = {} packages.each { |package| package.install!(ksp_path, caveats) } log_caveats(caveats) end |
.load_packages! ⇒ Object
77 78 79 80 81 |
# File 'lib/kmc/package.rb', line 77 def load_packages! Dir[File.join(Configuration.packages_path, '*.rb')].each do |file| require file end end |
.packages ⇒ Object
73 74 75 |
# File 'lib/kmc/package.rb', line 73 def packages @@packages end |