pawnee 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pawnee/pawnee/actions/package.rb +26 -1
- data/lib/pawnee/pawnee/version.rb +1 -1
- metadata +4 -4
@@ -74,8 +74,33 @@ module Pawnee
|
|
74
74
|
# === Parameters
|
75
75
|
# packages<Array>:: An array of strings of package names
|
76
76
|
def install_packages(*package_names)
|
77
|
+
packages = nil
|
78
|
+
as_root do
|
79
|
+
exec('apt-get -y update')
|
80
|
+
packages = exec("dpkg -l")
|
81
|
+
end
|
82
|
+
|
83
|
+
installed_package_names = []
|
84
|
+
packages.split(/\n/).grep(/^ii /).each do |package|
|
85
|
+
_, name, version = package.split(/\s+/)
|
86
|
+
installed_package_names << name
|
87
|
+
end
|
88
|
+
|
89
|
+
need_to_install_packages = []
|
90
|
+
|
77
91
|
package_names.flatten.each do |package_name|
|
78
|
-
|
92
|
+
if installed_package_names.include?(package_name)
|
93
|
+
say_status "package already installed", package_name, :blue
|
94
|
+
else
|
95
|
+
need_to_install_packages << package_name
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if need_to_install_packages.size > 0
|
100
|
+
as_root do
|
101
|
+
say_status "installing packages", need_to_install_packages.join(', ')
|
102
|
+
exec("apt-get -y install #{need_to_install_packages.join(' ')}")
|
103
|
+
end
|
79
104
|
end
|
80
105
|
end
|
81
106
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pawnee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -307,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
307
307
|
version: '0'
|
308
308
|
segments:
|
309
309
|
- 0
|
310
|
-
hash:
|
310
|
+
hash: 4305242221210104072
|
311
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
312
|
none: false
|
313
313
|
requirements:
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
version: '0'
|
317
317
|
segments:
|
318
318
|
- 0
|
319
|
-
hash:
|
319
|
+
hash: 4305242221210104072
|
320
320
|
requirements: []
|
321
321
|
rubyforge_project:
|
322
322
|
rubygems_version: 1.8.22
|