package_manager 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/package_manager/base.rb +7 -6
- data/lib/package_manager.rb +1 -1
- metadata +31 -31
data/lib/package_manager/base.rb
CHANGED
@@ -47,21 +47,18 @@ module PackageManager
|
|
47
47
|
|
48
48
|
# Returns true if the package installed successfully
|
49
49
|
def install( package )
|
50
|
-
|
51
|
-
$?.exitstatus == 0
|
50
|
+
exec_command( 'sudo ' + install_command, [ package ], { :echo_output => true } )
|
52
51
|
end
|
53
52
|
|
54
53
|
# Returns true if the package installed successfully
|
55
54
|
def install_file( file )
|
56
55
|
raise "The file '#{ file }' does not exist" if ! File.exist?( file )
|
57
|
-
|
58
|
-
$?.exitstatus == 0
|
56
|
+
exec_command( 'sudo ' + install_file_command, [ file ], { :echo_output => true } )
|
59
57
|
end
|
60
58
|
|
61
59
|
# Returns true if the package uninstalled successfully
|
62
60
|
def uninstall( package )
|
63
|
-
|
64
|
-
$?.exitstatus == 0
|
61
|
+
exec_command( 'sudo ' + uninstall_command, [ package ], { :echo_output => true } )
|
65
62
|
end
|
66
63
|
|
67
64
|
# Returns the package name if found, or an empty string
|
@@ -85,6 +82,10 @@ module PackageManager
|
|
85
82
|
out.chomp
|
86
83
|
end
|
87
84
|
|
85
|
+
def exec_command( command, args, options = {} )
|
86
|
+
exec "#{ command } #{ args.join( ' ' ) }"
|
87
|
+
end
|
88
|
+
|
88
89
|
def self.guess_package_manager
|
89
90
|
os = operating_system
|
90
91
|
case os
|
data/lib/package_manager.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: package_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joe Yates
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-23 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -37,53 +37,53 @@ dependencies:
|
|
37
37
|
description: Unifies the command interface for using yum and apt on Linux, Fink and MacPorts on OS X
|
38
38
|
email: joe.g.yates@gmail.com
|
39
39
|
executables:
|
40
|
-
- pkg-provides
|
41
|
-
- pkg-list-contents
|
42
|
-
- pkg-install-file
|
43
|
-
- pkg-uninstall
|
44
|
-
- pkg-install
|
45
40
|
- pkg-find-available
|
46
41
|
- pkg-find-installed
|
42
|
+
- pkg-install
|
43
|
+
- pkg-install-file
|
44
|
+
- pkg-list-contents
|
45
|
+
- pkg-provides
|
46
|
+
- pkg-uninstall
|
47
47
|
extensions: []
|
48
48
|
|
49
49
|
extra_rdoc_files:
|
50
50
|
- README.rdoc
|
51
|
-
- bin/pkg-provides
|
52
|
-
- bin/pkg-list-contents
|
53
|
-
- bin/pkg-install-file
|
54
|
-
- bin/pkg-uninstall
|
55
|
-
- bin/pkg-install
|
56
51
|
- bin/pkg-find-available
|
57
52
|
- bin/pkg-find-installed
|
58
|
-
-
|
59
|
-
-
|
53
|
+
- bin/pkg-install
|
54
|
+
- bin/pkg-install-file
|
55
|
+
- bin/pkg-list-contents
|
56
|
+
- bin/pkg-provides
|
57
|
+
- bin/pkg-uninstall
|
58
|
+
- lib/package_manager/apt.rb
|
60
59
|
- lib/package_manager/base.rb
|
60
|
+
- lib/package_manager/dpkg.rb
|
61
61
|
- lib/package_manager/fink.rb
|
62
62
|
- lib/package_manager/port.rb
|
63
|
-
- lib/package_manager/apt.rb
|
64
63
|
- lib/package_manager/rpm.rb
|
65
|
-
- lib/package_manager/
|
64
|
+
- lib/package_manager/yum.rb
|
65
|
+
- lib/package_manager.rb
|
66
66
|
files:
|
67
67
|
- Rakefile
|
68
68
|
- README.rdoc
|
69
|
-
- bin/pkg-provides
|
70
|
-
- bin/pkg-list-contents
|
71
|
-
- bin/pkg-install-file
|
72
|
-
- bin/pkg-uninstall
|
73
|
-
- bin/pkg-install
|
74
69
|
- bin/pkg-find-available
|
75
70
|
- bin/pkg-find-installed
|
76
|
-
-
|
77
|
-
-
|
71
|
+
- bin/pkg-install
|
72
|
+
- bin/pkg-install-file
|
73
|
+
- bin/pkg-list-contents
|
74
|
+
- bin/pkg-provides
|
75
|
+
- bin/pkg-uninstall
|
76
|
+
- lib/package_manager/apt.rb
|
78
77
|
- lib/package_manager/base.rb
|
78
|
+
- lib/package_manager/dpkg.rb
|
79
79
|
- lib/package_manager/fink.rb
|
80
80
|
- lib/package_manager/port.rb
|
81
|
-
- lib/package_manager/apt.rb
|
82
81
|
- lib/package_manager/rpm.rb
|
83
|
-
- lib/package_manager/
|
84
|
-
-
|
85
|
-
- spec/script_methods_spec.rb
|
82
|
+
- lib/package_manager/yum.rb
|
83
|
+
- lib/package_manager.rb
|
86
84
|
- spec/platform_spec.rb
|
85
|
+
- spec/script_methods_spec.rb
|
86
|
+
- spec/subclasses_spec.rb
|
87
87
|
- spec/version_spec.rb
|
88
88
|
has_rdoc: true
|
89
89
|
homepage: http://github.com/joeyates/package_manager
|
@@ -123,7 +123,7 @@ signing_key:
|
|
123
123
|
specification_version: 3
|
124
124
|
summary: A package manager abstraction
|
125
125
|
test_files:
|
126
|
-
- spec/subclasses_spec.rb
|
127
|
-
- spec/script_methods_spec.rb
|
128
126
|
- spec/platform_spec.rb
|
127
|
+
- spec/script_methods_spec.rb
|
128
|
+
- spec/subclasses_spec.rb
|
129
129
|
- spec/version_spec.rb
|