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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7f6c6be4a207dbcac06fb28e99713849a3db1c2
4
- data.tar.gz: a2390b68d68f1702fde29f9df87249e1f013cc86
3
+ metadata.gz: ff7c171ee1d5f139c92dad250d90f467cd7edca5
4
+ data.tar.gz: 85e014e747a9e859e4de9fb3a80e19358417357c
5
5
  SHA512:
6
- metadata.gz: 569cc0e35313ec492d1f5eef8fe50bbc01eb1528ed96f4e21ec47de842e46521059b15f4f0334eb5b40cfc5a63053dee6df7cfbe1cb0ce43f2a489cebb2ae54c
7
- data.tar.gz: c26896d6bd2f4a67ca844a8663506d8eadf895d5ecfc8c6661487607155f6eea22f6895b3281a2a9f4e9c500284c5a59f0594b3dabb310b58a736b28b572536f
6
+ metadata.gz: 830ac07df7bf4e6b0cc3c7f995241c80c58c5bb6ab4b85b989c611c3b46e862990ef8d21efcfb030f795d0fcd0493dfb8d9768ef8e747d42166489d35e23c2ec
7
+ data.tar.gz: 53a089e4b87f12ed9ad4506f68f0248396b97311842abee95a1167a4865cdb5bf5bde04da8d20647e6547228b685b7b48660564157df4040afc8ac668f758922
data/CHANGELOG CHANGED
@@ -1,2 +1,5 @@
1
+ 2015-05-07 Release 0.2.0
2
+ - Keep two latest kernels instead of just one
3
+
1
4
  2015-04-01 Release 0.1.0
2
5
  - Initial release ported from internal repository
@@ -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
- packages.reject! { |package|
18
- package =~ /\b#{Regexp.escape(current)}\b/ ||
19
- package =~ /\b#{Regexp.escape(latest)}\b/
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
@@ -1,3 +1,3 @@
1
1
  module UbuntuUnusedKernels
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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/latest' do
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.1.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-04-13 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler