Class: Scoop
- Inherits:
-
PackageManager
- Object
- PackageManager
- Scoop
- Defined in:
- lib/atk/package_managers.rb
Class Method Summary collapse
- .add_bucket(bucket_name, bucket_location = nil) ⇒ Object
- .app_dir(app_name, global = false) ⇒ Object
- .apps_dir(global = false) ⇒ Object
- .base_dir(global = false) ⇒ Object
- .install(app_name, version = nil) ⇒ Object
-
.installed?(app_name, version = nil) ⇒ Boolean
Overriden Methods.
- .switch_app_version(app_name, version = nil) ⇒ Object
- .uninstall(app_name, version = nil) ⇒ Object
- .update_app(app_name) ⇒ Object
Class Method Details
.add_bucket(bucket_name, bucket_location = nil) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/atk/package_managers.rb', line 38 def self.add_bucket(bucket_name, bucket_location=nil) if (bucket_location == nil) `scoop bucket add #{bucket_name}` else `scoop bucket add #{bucket_name} #{bucket_location}` end end |
.app_dir(app_name, global = false) ⇒ Object
33 34 35 36 |
# File 'lib/atk/package_managers.rb', line 33 def self.app_dir(app_name, global=false) root = apps_dir(global) return '#{root}/#{app_name}' end |
.apps_dir(global = false) ⇒ Object
28 29 30 31 |
# File 'lib/atk/package_managers.rb', line 28 def self.apps_dir(global=false) root = base_dir(global) return '#{root}/apps' end |
.base_dir(global = false) ⇒ Object
24 25 26 |
# File 'lib/atk/package_managers.rb', line 24 def self.base_dir(global=false) return global ? @@scoop_global_dir : @@scoop_dir end |
.install(app_name, version = nil) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/atk/package_managers.rb', line 66 def self.install(app_name, version=nil) if(installed?(app_name)) puts 'You already have #{app_name} installed' return end if(version == nil) `scoop install #{app_name}` else `scoop install #{app_name}@#{version}` end end |
.installed?(app_name, version = nil) ⇒ Boolean
Overriden Methods
56 57 58 59 60 61 62 63 64 |
# File 'lib/atk/package_managers.rb', line 56 def self.installed?(app_name, version=nil) # if(global == nil) { return (installed?(app_name, true) or installed? (app_name, false)) } # Dependencies of the format "bucket/dependency" install in a directory of form # "dependency". So we need to extract the bucket from the name and only give the app # name to is_directory # TODO: add support for checking if version is installed app_name = app_name.split("/")[-1] return File.directory?(File.(app_dir(app_name))) end |
.switch_app_version(app_name, version = nil) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/atk/package_managers.rb', line 46 def self.switch_app_version(app_name, version=nil) if(version == nil) `scoop reset #{app_name}` else `scoop reset #{app_name}@#{version}` end end |
.uninstall(app_name, version = nil) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/atk/package_managers.rb', line 79 def self.uninstall(app_name, version=nil) if(app_name == 'scoop') puts 'You are trying to uninstall scoop which is a dependency for ATK. We will not let you uninstall Scoop through ATK' return end if(version == nil) `scoop uninstall #{app_name}` else `scoop uninstall #{app_name}@#{version}` end end |
.update_app(app_name) ⇒ Object
92 93 94 |
# File 'lib/atk/package_managers.rb', line 92 def self.update_app(app_name) `scoop update #{app_name}` end |