ubuntu_unused_kernels 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/ubuntu_unused_kernels.rb +5 -4
- data/lib/ubuntu_unused_kernels/version.rb +1 -1
- data/spec/ubuntu_unused_kernels_spec.rb +19 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff7c171ee1d5f139c92dad250d90f467cd7edca5
|
4
|
+
data.tar.gz: 85e014e747a9e859e4de9fb3a80e19358417357c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 830ac07df7bf4e6b0cc3c7f995241c80c58c5bb6ab4b85b989c611c3b46e862990ef8d21efcfb030f795d0fcd0493dfb8d9768ef8e747d42166489d35e23c2ec
|
7
|
+
data.tar.gz: 53a089e4b87f12ed9ad4506f68f0248396b97311842abee95a1167a4865cdb5bf5bde04da8d20647e6547228b685b7b48660564157df4040afc8ac668f758922
|
data/CHANGELOG
CHANGED
@@ -12,11 +12,12 @@ module UbuntuUnusedKernels
|
|
12
12
|
|
13
13
|
latest = packages.map { |package|
|
14
14
|
package.match(VERSION_REGEX)[0]
|
15
|
-
}.sort.last
|
15
|
+
}.uniq.sort.last(2)
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
[current, latest].flatten.each { |version|
|
18
|
+
packages.reject! { |package|
|
19
|
+
package =~ /\b#{Regexp.escape(version)}\b/
|
20
|
+
}
|
20
21
|
}
|
21
22
|
|
22
23
|
return packages
|
@@ -19,6 +19,22 @@ describe UbuntuUnusedKernels do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
describe 'two kernels installed, one is current and latest' do
|
23
|
+
it 'should return nothing' do
|
24
|
+
allow(subject).to receive(:get_current).with(no_args).and_return('3.13.0-43')
|
25
|
+
allow(subject).to receive(:get_installed).with(no_args).and_return(%w{
|
26
|
+
linux-headers-3.13.0-42
|
27
|
+
linux-headers-3.13.0-42-generic
|
28
|
+
linux-headers-3.13.0-43
|
29
|
+
linux-headers-3.13.0-43-generic
|
30
|
+
linux-image-3.13.0-42-generic
|
31
|
+
linux-image-3.13.0-43-generic
|
32
|
+
})
|
33
|
+
|
34
|
+
expect(subject.to_remove).to eq([])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
22
38
|
describe 'five kernels installed' do
|
23
39
|
let(:installed) {
|
24
40
|
%w{
|
@@ -41,7 +57,7 @@ describe UbuntuUnusedKernels do
|
|
41
57
|
}
|
42
58
|
|
43
59
|
describe 'current is latest' do
|
44
|
-
it 'should return everything except current
|
60
|
+
it 'should return everything except two latest (which includes current)' do
|
45
61
|
allow(subject).to receive(:get_current).with(no_args).and_return('3.13.0-43')
|
46
62
|
allow(subject).to receive(:get_installed).with(no_args).and_return(installed)
|
47
63
|
|
@@ -52,18 +68,15 @@ describe UbuntuUnusedKernels do
|
|
52
68
|
linux-headers-3.13.0-40-generic
|
53
69
|
linux-headers-3.13.0-41
|
54
70
|
linux-headers-3.13.0-41-generic
|
55
|
-
linux-headers-3.13.0-42
|
56
|
-
linux-headers-3.13.0-42-generic
|
57
71
|
linux-image-3.13.0-39-generic
|
58
72
|
linux-image-3.13.0-40-generic
|
59
73
|
linux-image-3.13.0-41-generic
|
60
|
-
linux-image-3.13.0-42-generic
|
61
74
|
})
|
62
75
|
end
|
63
76
|
end
|
64
77
|
|
65
78
|
describe 'current is not latest' do
|
66
|
-
it 'should return everything except current and latest' do
|
79
|
+
it 'should return everything except current and two latest' do
|
67
80
|
allow(subject).to receive(:get_current).with(no_args).and_return('3.13.0-41')
|
68
81
|
allow(subject).to receive(:get_installed).with(no_args).and_return(installed)
|
69
82
|
|
@@ -72,17 +85,14 @@ describe UbuntuUnusedKernels do
|
|
72
85
|
linux-headers-3.13.0-39-generic
|
73
86
|
linux-headers-3.13.0-40
|
74
87
|
linux-headers-3.13.0-40-generic
|
75
|
-
linux-headers-3.13.0-42
|
76
|
-
linux-headers-3.13.0-42-generic
|
77
88
|
linux-image-3.13.0-39-generic
|
78
89
|
linux-image-3.13.0-40-generic
|
79
|
-
linux-image-3.13.0-42-generic
|
80
90
|
})
|
81
91
|
end
|
82
92
|
end
|
83
93
|
|
84
94
|
describe 'unsorted list of kernels' do
|
85
|
-
it 'should return everything except current and latest' do
|
95
|
+
it 'should return everything except current and two latest' do
|
86
96
|
allow(subject).to receive(:get_current).with(no_args).and_return('3.13.0-41')
|
87
97
|
allow(subject).to receive(:get_installed).with(no_args).and_return(installed.shuffle)
|
88
98
|
|
@@ -91,11 +101,8 @@ describe UbuntuUnusedKernels do
|
|
91
101
|
linux-headers-3.13.0-39-generic
|
92
102
|
linux-headers-3.13.0-40
|
93
103
|
linux-headers-3.13.0-40-generic
|
94
|
-
linux-headers-3.13.0-42
|
95
|
-
linux-headers-3.13.0-42-generic
|
96
104
|
linux-image-3.13.0-39-generic
|
97
105
|
linux-image-3.13.0-40-generic
|
98
|
-
linux-image-3.13.0-42-generic
|
99
106
|
})
|
100
107
|
end
|
101
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ubuntu_unused_kernels
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Carley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|