cfa_grub2 0.4.1 → 0.5.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/lib/cfa/grub2/device_map.rb +1 -1
- data/lib/cfa/grub2/grub_cfg.rb +25 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccccf211949a0bf114cf88bd50b2b83982cd90bf
|
4
|
+
data.tar.gz: 00dd35c6483ed401514bd4add453b4871aa1af79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22589c1d3c5eea5f6d21df02d80defce53ae4c8565ac6dbc8024eed4b67adc47f2c3369dc9f3b01539e2f939ff8709b546b09e6c89c6a6718092cd21ea851ed5
|
7
|
+
data.tar.gz: 6630dfc137338357da5b8c6238fba6eeee116b804182d3a7fc1771ef668d4aaa60c2fc6de88c1aaa2c32bf229d0ca1284c95a2da1bd766ec660061fa9c5bbdc9
|
data/lib/cfa/grub2/device_map.rb
CHANGED
data/lib/cfa/grub2/grub_cfg.rb
CHANGED
@@ -12,8 +12,14 @@ module CFA
|
|
12
12
|
# @private only internal parser
|
13
13
|
class Parser
|
14
14
|
def self.parse(string)
|
15
|
-
|
16
|
-
|
15
|
+
submenu = ""
|
16
|
+
string.lines.each_with_object([]) do |line, result|
|
17
|
+
case line
|
18
|
+
when /menuentry\s*'/ then result << parse_entry(line, submenu)
|
19
|
+
when /^}\s*\n/ then submenu = ""
|
20
|
+
when /submenu\s/ then submenu = line[/\s*submenu\s+'([^']+)'.*/, 1]
|
21
|
+
end
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
def self.serialize(_string)
|
@@ -24,6 +30,15 @@ module CFA
|
|
24
30
|
def self.empty
|
25
31
|
[]
|
26
32
|
end
|
33
|
+
|
34
|
+
def self.parse_entry(line, submenu)
|
35
|
+
entry = line[/\s*menuentry\s+'([^']+)'.*/, 1]
|
36
|
+
{
|
37
|
+
title: entry,
|
38
|
+
path: submenu.empty? ? entry : "#{submenu}>#{entry}"
|
39
|
+
}
|
40
|
+
end
|
41
|
+
private_class_method :parse_entry
|
27
42
|
end
|
28
43
|
|
29
44
|
def initialize(file_handler: nil)
|
@@ -31,7 +46,15 @@ module CFA
|
|
31
46
|
end
|
32
47
|
|
33
48
|
# @return [Array<String>] sections from grub.cfg in order as they appear
|
49
|
+
# @deprecated use instead boot_entries
|
34
50
|
def sections
|
51
|
+
data.map { |p| p[:title] }
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [Array<Hash>] return boot entries containing `title:` as shown
|
55
|
+
# on screen and `path:` whole path usable for grub2-set-default including
|
56
|
+
# also submenu part of path
|
57
|
+
def boot_entries
|
35
58
|
data
|
36
59
|
end
|
37
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfa_grub2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfa
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
version: 1.3.6
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.4.5.1
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: Models for GRUB2 configuration files.
|