lvmsync 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,67 @@
1
+ module VgCfgBackup
2
+ class Node < Treetop::Runtime::SyntaxNode
3
+ end
4
+
5
+ class Group < Node
6
+ def name
7
+ self.elements[0].text_value
8
+ end
9
+
10
+ def variables
11
+ self.elements[3].elements.select { |e| e.is_a? Variable }
12
+ end
13
+
14
+ def variable_value(name)
15
+ self.variables.find { |v| v.name == name }.value rescue nil
16
+ end
17
+
18
+ def groups
19
+ self.elements[3].elements.select { |e| e.is_a? Group }.inject({}) { |h,v| h[v.name] = v; h }
20
+ end
21
+ end
22
+
23
+ class Config < Group
24
+ def name
25
+ nil
26
+ end
27
+
28
+ def variables
29
+ self.elements.select { |e| e.is_a? Variable }
30
+ end
31
+
32
+ def groups
33
+ self.elements.select { |e| e.is_a? Group }.inject({}) { |h,v| h[v.name] = v; h }
34
+ end
35
+ end
36
+
37
+ class Variable < Node
38
+ def name
39
+ self.elements[0].text_value
40
+ end
41
+
42
+ def value
43
+ self.elements[2].value
44
+ end
45
+ end
46
+
47
+ class VariableName < Node
48
+ end
49
+
50
+ class Integer < Node
51
+ def value
52
+ self.text_value.to_i
53
+ end
54
+ end
55
+
56
+ class String < Node
57
+ def value
58
+ self.elements[1].text_value
59
+ end
60
+ end
61
+
62
+ class List < Node
63
+ def value
64
+ self.elements.find { |e| e.is_a?(String) }.map { |e| e.value }
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,37 @@
1
+ grammar VgCfgBackup
2
+ rule config
3
+ (variable / group / space / comment)+ <Config>
4
+ end
5
+
6
+ rule variable
7
+ variable_name " = " (integer / string / list) <Variable>
8
+ end
9
+
10
+ rule variable_name
11
+ [a-z0-9_]+ <VariableName>
12
+ end
13
+
14
+ rule group
15
+ variable_name space "{" (variable / group / space / comment)+ "}" <Group>
16
+ end
17
+
18
+ rule integer
19
+ [1-9] [0-9]* <Integer> / "0" <Integer>
20
+ end
21
+
22
+ rule string
23
+ '"' [^"]* '"' <String>
24
+ end
25
+
26
+ rule list
27
+ "[" space? ((string / integer) ", " / (string / integer))* space? "]" <List>
28
+ end
29
+
30
+ rule space
31
+ [\s]+
32
+ end
33
+
34
+ rule comment
35
+ "#" [^\n]*
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,240 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lvmsync
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matt Palmer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-05-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: git-version-bump
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: treetop
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: guard-spork
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard-rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: plymouth
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry-debugger
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rake
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rb-inotify
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: '0.9'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: '0.9'
158
+ - !ruby/object:Gem::Dependency
159
+ name: rdoc
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: rspec
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ description:
191
+ email:
192
+ executables:
193
+ - lvmsync
194
+ extensions: []
195
+ extra_rdoc_files:
196
+ - README.md
197
+ files:
198
+ - README.md
199
+ - LICENCE
200
+ - bin/lvmsync
201
+ - lib/lvm.rb
202
+ - lib/lvm/lv_config.rb
203
+ - lib/lvm/thin_snapshot.rb
204
+ - lib/lvm/snapshot.rb
205
+ - lib/lvm/vg_config.rb
206
+ - lib/lvm/helpers.rb
207
+ - lib/lvm/pv_config.rb
208
+ - lib/vgcfgbackup.treetop
209
+ - lib/vgcfgbackup.rb
210
+ homepage: http://theshed.hezmatt.org/lvmsync
211
+ licenses: []
212
+ post_install_message:
213
+ rdoc_options: []
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ segments:
223
+ - 0
224
+ hash: -3927931017616602686
225
+ required_rubygems_version: !ruby/object:Gem::Requirement
226
+ none: false
227
+ requirements:
228
+ - - ! '>='
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ segments:
232
+ - 0
233
+ hash: -3927931017616602686
234
+ requirements: []
235
+ rubyforge_project:
236
+ rubygems_version: 1.8.23
237
+ signing_key:
238
+ specification_version: 3
239
+ summary: Efficiently transfer changes in LVM snapshots
240
+ test_files: []