mtree 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/ci.yml +50 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +2 -0
- data/Rakefile +20 -2
- data/bin/console +1 -0
- data/exe/mtree +2 -3
- data/lib/mtree/file_specification.rb +13 -10
- data/lib/mtree/parser.tab.rb +38 -34
- data/lib/mtree/version.rb +3 -1
- data/lib/mtree.rb +2 -0
- data/mtree.gemspec +18 -5
- metadata +78 -22
- data/.travis.yml +0 -9
- data/lib/mtree/parser.y +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 314d213f66e3a73b88dfb0e2692c924ea5cec80f6332673e7612e3cc31cab7bc
|
4
|
+
data.tar.gz: 7cfcfeaf8c7aad5954825d9a35cf7e17286e43a7792378fb15ca2f3e77eaba43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdf9ccd76bb58d262555621c76c946d84ec0895ea50c5e7dc40254d6be1e7409a1dbb2dd9afb545cb28691c880b4877dda22945792c60c994ea4b1ed950f83cc
|
7
|
+
data.tar.gz: 81c1c6b709c667ea806fa6862e2ca366efab3637918bcde43b9c8f5252d63ccae4df2266b9ad3efdbbde0c623b0323f5719f426ff56239e7a522d3528ef2b5ca
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @opus-codium/core
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
pull_request:
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
rubocop:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Setup ruby
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 3.0
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Run static code analysis
|
23
|
+
run: bundle exec rubocop
|
24
|
+
unit:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
needs: rubocop
|
27
|
+
strategy:
|
28
|
+
matrix:
|
29
|
+
ruby:
|
30
|
+
- "2.7"
|
31
|
+
- "3.0"
|
32
|
+
- "3.1"
|
33
|
+
name: Ruby ${{ matrix.ruby }}
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- name: Setup ruby
|
37
|
+
uses: ruby/setup-ruby@v1
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby }}
|
40
|
+
bundler-cache: true
|
41
|
+
- name: Run tests without uploading code coverage
|
42
|
+
if: ${{ matrix.ruby != '3.0' }}
|
43
|
+
run: bundle exec rake
|
44
|
+
- name: Run tests and upload coverage to Code Climate
|
45
|
+
if: ${{ matrix.ruby == '3.0' }}
|
46
|
+
uses: paambaati/codeclimate-action@v3.0.0
|
47
|
+
env:
|
48
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
|
49
|
+
with:
|
50
|
+
coverageCommand: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
AllCops:
|
2
2
|
Exclude:
|
3
3
|
- 'lib/mtree/parser.tab.rb'
|
4
|
+
- 'vendor/bundle/**/*'
|
4
5
|
|
5
6
|
Metrics/LineLength:
|
6
7
|
Enabled: false
|
7
8
|
|
8
9
|
Metrics/BlockLength:
|
9
|
-
|
10
|
-
- 'spec/**/*.rb'
|
10
|
+
Enabled: false
|
11
11
|
|
12
12
|
Style/Documentation:
|
13
13
|
Enabled: false
|
14
14
|
|
15
|
+
Style/TrailingCommaInArguments:
|
16
|
+
EnforcedStyleForMultiline: consistent_comma
|
17
|
+
Style/TrailingCommaInArrayLiteral:
|
18
|
+
EnforcedStyleForMultiline: consistent_comma
|
15
19
|
Style/TrailingCommaInHashLiteral:
|
16
|
-
|
20
|
+
EnforcedStyleForMultiline: consistent_comma
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [v1.0.1](https://github.com/opus-codium/mtree/tree/v1.0.1) (2022-10-17)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/opus-codium/mtree/compare/v1.0.0...v1.0.1)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Fix creation of links in place of directories [\#6](https://github.com/opus-codium/mtree/pull/6) ([smortex](https://github.com/smortex))
|
10
|
+
- Fix `mtree --check` [\#4](https://github.com/opus-codium/mtree/pull/4) ([neomilium](https://github.com/neomilium))
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Remove generated parser from the repo [\#7](https://github.com/opus-codium/mtree/pull/7) ([smortex](https://github.com/smortex))
|
15
|
+
- Add a CODEOWNER file [\#5](https://github.com/opus-codium/mtree/pull/5) ([smortex](https://github.com/smortex))
|
16
|
+
- Parser improvements [\#2](https://github.com/opus-codium/mtree/pull/2) ([smortex](https://github.com/smortex))
|
17
|
+
- Add CI [\#1](https://github.com/opus-codium/mtree/pull/1) ([smortex](https://github.com/smortex))
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
5
|
+
require 'github_changelog_generator/task'
|
3
6
|
|
4
7
|
RSpec::Core::RakeTask.new(:spec)
|
5
8
|
|
9
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
10
|
+
config.user = 'opus-codium'
|
11
|
+
config.project = 'mtree'
|
12
|
+
config.exclude_labels = ['skip-changelog']
|
13
|
+
config.future_release = "v#{Mtree::VERSION}"
|
14
|
+
config.since_tag = 'v1.0.0'
|
15
|
+
end
|
16
|
+
|
6
17
|
task default: :spec
|
7
18
|
|
19
|
+
task build: :gen_parser
|
20
|
+
task spec: :gen_parser
|
21
|
+
|
8
22
|
desc "Generate the mtree parser's code"
|
9
|
-
task :
|
10
|
-
|
23
|
+
task gen_parser: [
|
24
|
+
'lib/mtree/parser.tab.rb',
|
25
|
+
]
|
26
|
+
|
27
|
+
file 'lib/mtree/parser.tab.rb' => 'lib/mtree/parser.y' do
|
28
|
+
sh 'racc -S lib/mtree/parser.y'
|
11
29
|
end
|
data/bin/console
CHANGED
data/exe/mtree
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'mtree'
|
4
5
|
|
@@ -82,9 +83,7 @@ options[:user_mapping].each do |from, to|
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
85
|
-
if options[:symlink_to]
|
86
|
-
specifications.symlink_to!(options[:symlink_to])
|
87
|
-
end
|
86
|
+
specifications.symlink_to!(options[:symlink_to]) if options[:symlink_to]
|
88
87
|
|
89
88
|
case options[:action]
|
90
89
|
when :update
|
@@ -1,5 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'etc'
|
4
|
+
|
1
5
|
module Mtree
|
2
|
-
class FileSpecification
|
6
|
+
class FileSpecification # rubocop:disable Metrics/ClassLength
|
3
7
|
# VALID_ATTRIBUTES = %i[cksum device flags gid gname link md5 mode nlink nochange optional rmd160 sha1 sha256 sha384 sha512 size tags time type uid uname].freeze
|
4
8
|
VALID_ATTRIBUTES = %i[gid gname link mode nochange optional type uid uname].freeze
|
5
9
|
|
@@ -13,9 +17,7 @@ module Mtree
|
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
16
|
-
attr_accessor :filename
|
17
|
-
attr_accessor :relative_path
|
18
|
-
attr_accessor :children
|
20
|
+
attr_accessor :filename, :relative_path, :children
|
19
21
|
|
20
22
|
def initialize(filename, attributes = {})
|
21
23
|
@filename = filename
|
@@ -23,11 +25,12 @@ module Mtree
|
|
23
25
|
if (invalid_keys = attributes.keys - VALID_ATTRIBUTES) != []
|
24
26
|
raise "Unsupported attribute: #{invalid_keys.first}"
|
25
27
|
end
|
28
|
+
|
26
29
|
@attributes = attributes
|
27
30
|
@children = []
|
28
31
|
end
|
29
32
|
|
30
|
-
def match?(root)
|
33
|
+
def match?(root) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
31
34
|
res = true
|
32
35
|
problems = []
|
33
36
|
|
@@ -35,9 +38,7 @@ module Mtree
|
|
35
38
|
@attributes.each do |attr, expected|
|
36
39
|
actual = send("current_#{attr}", root)
|
37
40
|
|
38
|
-
if expected != actual
|
39
|
-
problems << { attr: attr, expected: expected, actual: actual }
|
40
|
-
end
|
41
|
+
problems << { attr: attr, expected: expected, actual: actual } if expected != actual
|
41
42
|
end
|
42
43
|
rescue Errno::ENOENT
|
43
44
|
puts "#{relative_path} missing"
|
@@ -85,7 +86,9 @@ module Mtree
|
|
85
86
|
case type
|
86
87
|
when 'dir' then FileUtils.mkdir_p(full_filename(root))
|
87
88
|
when 'file' then FileUtils.touch(full_filename(root))
|
88
|
-
when 'link'
|
89
|
+
when 'link'
|
90
|
+
FileUtils.rm_rf(full_filename(root))
|
91
|
+
FileUtils.ln_s(link, full_filename(root))
|
89
92
|
end
|
90
93
|
update(root)
|
91
94
|
end
|
@@ -134,7 +137,7 @@ module Mtree
|
|
134
137
|
"#{filename} #{attributes}\n#{descendent}..\n"
|
135
138
|
end
|
136
139
|
|
137
|
-
def attributes
|
140
|
+
def attributes # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
138
141
|
parts = []
|
139
142
|
|
140
143
|
parts << format('gid=%d', gid) if gid
|
data/lib/mtree/parser.tab.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.
|
4
|
-
# from Racc
|
3
|
+
# This file is automatically generated by Racc 1.6.0
|
4
|
+
# from Racc grammar file "".
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'racc/parser.rb'
|
@@ -12,7 +12,7 @@ require 'strscan'
|
|
12
12
|
module Mtree
|
13
13
|
class Parser < Racc::Parser
|
14
14
|
|
15
|
-
module_eval(<<'...end parser.y/module_eval...', 'parser.y',
|
15
|
+
module_eval(<<'...end parser.y/module_eval...', 'parser.y', 38)
|
16
16
|
|
17
17
|
attr_accessor :yydebug
|
18
18
|
attr_accessor :defaults
|
@@ -69,17 +69,17 @@ end
|
|
69
69
|
##### State transition tables begin ###
|
70
70
|
|
71
71
|
racc_action_table = [
|
72
|
-
14,
|
72
|
+
14, 8, 12, 16, 17, 18, 19, 20, 21, 22,
|
73
73
|
23, 24, 13, nil, 16, 17, 18, 19, 20, 21,
|
74
74
|
22, 23, 4, 7, 5, 6, 4, 7, 5, 6 ]
|
75
75
|
|
76
76
|
racc_action_check = [
|
77
|
-
10,
|
77
|
+
10, 1, 6, 10, 10, 10, 10, 10, 10, 10,
|
78
78
|
10, 11, 8, nil, 11, 11, 11, 11, 11, 11,
|
79
|
-
11, 11,
|
79
|
+
11, 11, 0, 0, 0, 0, 2, 2, 2, 2 ]
|
80
80
|
|
81
81
|
racc_action_pointer = [
|
82
|
-
|
82
|
+
20, 1, 24, nil, nil, nil, -1, nil, 12, nil,
|
83
83
|
-3, 8, nil, nil, nil, nil, nil, nil, nil, nil,
|
84
84
|
nil, nil, nil, nil, nil ]
|
85
85
|
|
@@ -191,7 +191,7 @@ Racc_debug_parser = false
|
|
191
191
|
|
192
192
|
module_eval(<<'.,.,', 'parser.y', 2)
|
193
193
|
def _reduce_1(val, _values, result)
|
194
|
-
if @path_components.any? then raise 'Malformed specifications' end
|
194
|
+
if @path_components.any? then raise 'Malformed specifications' end
|
195
195
|
result
|
196
196
|
end
|
197
197
|
.,.,
|
@@ -204,93 +204,97 @@ module_eval(<<'.,.,', 'parser.y', 2)
|
|
204
204
|
|
205
205
|
module_eval(<<'.,.,', 'parser.y', 8)
|
206
206
|
def _reduce_5(val, _values, result)
|
207
|
-
@defaults.merge!(val[1])
|
207
|
+
@defaults.merge!(val[1])
|
208
208
|
result
|
209
209
|
end
|
210
210
|
.,.,
|
211
211
|
|
212
|
-
module_eval(<<'.,.,', 'parser.y',
|
212
|
+
module_eval(<<'.,.,', 'parser.y', 10)
|
213
213
|
def _reduce_6(val, _values, result)
|
214
|
-
|
214
|
+
spec = Mtree::FileSpecification.new(val[0], @defaults.merge(val[1]))
|
215
|
+
@specifications ||= spec
|
216
|
+
@path_components.last << spec if @path_components.last
|
217
|
+
@path_components.push(spec)
|
218
|
+
|
215
219
|
result
|
216
220
|
end
|
217
221
|
.,.,
|
218
222
|
|
219
|
-
module_eval(<<'.,.,', 'parser.y',
|
223
|
+
module_eval(<<'.,.,', 'parser.y', 15)
|
220
224
|
def _reduce_7(val, _values, result)
|
221
|
-
@path_components.pop
|
225
|
+
@path_components.pop
|
222
226
|
result
|
223
227
|
end
|
224
228
|
.,.,
|
225
229
|
|
226
230
|
# reduce 8 omitted
|
227
231
|
|
228
|
-
module_eval(<<'.,.,', 'parser.y',
|
232
|
+
module_eval(<<'.,.,', 'parser.y', 18)
|
229
233
|
def _reduce_9(val, _values, result)
|
230
|
-
result = val[0].merge(val[1])
|
234
|
+
result = val[0].merge(val[1])
|
231
235
|
result
|
232
236
|
end
|
233
237
|
.,.,
|
234
238
|
|
235
|
-
module_eval(<<'.,.,', 'parser.y',
|
239
|
+
module_eval(<<'.,.,', 'parser.y', 19)
|
236
240
|
def _reduce_10(val, _values, result)
|
237
|
-
result = {}
|
241
|
+
result = {}
|
238
242
|
result
|
239
243
|
end
|
240
244
|
.,.,
|
241
245
|
|
242
|
-
module_eval(<<'.,.,', 'parser.y',
|
246
|
+
module_eval(<<'.,.,', 'parser.y', 21)
|
243
247
|
def _reduce_11(val, _values, result)
|
244
|
-
result = { gid: Integer(val[0]) }
|
248
|
+
result = { gid: Integer(val[0]) }
|
245
249
|
result
|
246
250
|
end
|
247
251
|
.,.,
|
248
252
|
|
249
|
-
module_eval(<<'.,.,', 'parser.y',
|
253
|
+
module_eval(<<'.,.,', 'parser.y', 22)
|
250
254
|
def _reduce_12(val, _values, result)
|
251
|
-
result = { gname: val[0] }
|
255
|
+
result = { gname: val[0] }
|
252
256
|
result
|
253
257
|
end
|
254
258
|
.,.,
|
255
259
|
|
256
|
-
module_eval(<<'.,.,', 'parser.y',
|
260
|
+
module_eval(<<'.,.,', 'parser.y', 23)
|
257
261
|
def _reduce_13(val, _values, result)
|
258
|
-
result = { mode: Integer(val[0], 8) }
|
262
|
+
result = { mode: Integer(val[0], 8) }
|
259
263
|
result
|
260
264
|
end
|
261
265
|
.,.,
|
262
266
|
|
263
|
-
module_eval(<<'.,.,', 'parser.y',
|
267
|
+
module_eval(<<'.,.,', 'parser.y', 24)
|
264
268
|
def _reduce_14(val, _values, result)
|
265
|
-
result = { nochange: true }
|
269
|
+
result = { nochange: true }
|
266
270
|
result
|
267
271
|
end
|
268
272
|
.,.,
|
269
273
|
|
270
|
-
module_eval(<<'.,.,', 'parser.y',
|
274
|
+
module_eval(<<'.,.,', 'parser.y', 25)
|
271
275
|
def _reduce_15(val, _values, result)
|
272
|
-
result = {}
|
276
|
+
result = {}
|
273
277
|
result
|
274
278
|
end
|
275
279
|
.,.,
|
276
280
|
|
277
|
-
module_eval(<<'.,.,', 'parser.y',
|
281
|
+
module_eval(<<'.,.,', 'parser.y', 26)
|
278
282
|
def _reduce_16(val, _values, result)
|
279
|
-
result = { type: val[0] }
|
283
|
+
result = { type: val[0] }
|
280
284
|
result
|
281
285
|
end
|
282
286
|
.,.,
|
283
287
|
|
284
|
-
module_eval(<<'.,.,', 'parser.y',
|
288
|
+
module_eval(<<'.,.,', 'parser.y', 27)
|
285
289
|
def _reduce_17(val, _values, result)
|
286
|
-
result = { uid: Integer(val[0]) }
|
290
|
+
result = { uid: Integer(val[0]) }
|
287
291
|
result
|
288
292
|
end
|
289
293
|
.,.,
|
290
294
|
|
291
|
-
module_eval(<<'.,.,', 'parser.y',
|
295
|
+
module_eval(<<'.,.,', 'parser.y', 28)
|
292
296
|
def _reduce_18(val, _values, result)
|
293
|
-
result = { uname: val[0] }
|
297
|
+
result = { uname: val[0] }
|
294
298
|
result
|
295
299
|
end
|
296
300
|
.,.,
|
@@ -300,4 +304,4 @@ def _reduce_none(val, _values, result)
|
|
300
304
|
end
|
301
305
|
|
302
306
|
end # class Parser
|
303
|
-
|
307
|
+
end # module Mtree
|
data/lib/mtree/version.rb
CHANGED
data/lib/mtree.rb
CHANGED
data/mtree.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'mtree/version'
|
@@ -12,19 +14,30 @@ Gem::Specification.new do |spec|
|
|
12
14
|
spec.description = 'This is a ruby utility and library providing the mtree(1) features found on BSDs.'
|
13
15
|
spec.homepage = 'https://github.com/opus-codium/mtree'
|
14
16
|
spec.license = 'MIT'
|
17
|
+
spec.required_ruby_version = '>= 2.7'
|
15
18
|
|
16
19
|
# Specify which files should be added to the gem when it is released.
|
17
20
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } -
|
23
|
+
[
|
24
|
+
'lib/mtree/parser.y',
|
25
|
+
] +
|
26
|
+
[
|
27
|
+
'lib/mtree/parser.tab.rb',
|
28
|
+
]
|
20
29
|
end
|
21
30
|
spec.bindir = 'exe'
|
22
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
32
|
spec.require_paths = ['lib']
|
24
33
|
|
25
|
-
spec.add_development_dependency 'bundler'
|
34
|
+
spec.add_development_dependency 'bundler'
|
35
|
+
spec.add_development_dependency 'github_changelog_generator'
|
26
36
|
spec.add_development_dependency 'racc'
|
27
|
-
spec.add_development_dependency 'rake'
|
28
|
-
spec.add_development_dependency 'rspec'
|
37
|
+
spec.add_development_dependency 'rake'
|
38
|
+
spec.add_development_dependency 'rspec'
|
39
|
+
spec.add_development_dependency 'rubocop'
|
40
|
+
spec.add_development_dependency 'rubocop-rake'
|
41
|
+
spec.add_development_dependency 'rubocop-rspec'
|
29
42
|
spec.add_development_dependency 'simplecov'
|
30
43
|
end
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain Tartière
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: github_changelog_generator
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
25
32
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: racc
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,30 +56,72 @@ dependencies:
|
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
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
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: simplecov
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,10 +145,12 @@ executables:
|
|
89
145
|
extensions: []
|
90
146
|
extra_rdoc_files: []
|
91
147
|
files:
|
148
|
+
- ".github/CODEOWNERS"
|
149
|
+
- ".github/workflows/ci.yml"
|
92
150
|
- ".gitignore"
|
93
151
|
- ".rspec"
|
94
152
|
- ".rubocop.yml"
|
95
|
-
-
|
153
|
+
- CHANGELOG.md
|
96
154
|
- CODE_OF_CONDUCT.md
|
97
155
|
- Gemfile
|
98
156
|
- LICENSE.txt
|
@@ -104,14 +162,13 @@ files:
|
|
104
162
|
- lib/mtree.rb
|
105
163
|
- lib/mtree/file_specification.rb
|
106
164
|
- lib/mtree/parser.tab.rb
|
107
|
-
- lib/mtree/parser.y
|
108
165
|
- lib/mtree/version.rb
|
109
166
|
- mtree.gemspec
|
110
167
|
homepage: https://github.com/opus-codium/mtree
|
111
168
|
licenses:
|
112
169
|
- MIT
|
113
170
|
metadata: {}
|
114
|
-
post_install_message:
|
171
|
+
post_install_message:
|
115
172
|
rdoc_options: []
|
116
173
|
require_paths:
|
117
174
|
- lib
|
@@ -119,16 +176,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
176
|
requirements:
|
120
177
|
- - ">="
|
121
178
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
179
|
+
version: '2.7'
|
123
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
181
|
requirements:
|
125
182
|
- - ">="
|
126
183
|
- !ruby/object:Gem::Version
|
127
184
|
version: '0'
|
128
185
|
requirements: []
|
129
|
-
|
130
|
-
|
131
|
-
signing_key:
|
186
|
+
rubygems_version: 3.3.22
|
187
|
+
signing_key:
|
132
188
|
specification_version: 4
|
133
189
|
summary: Manage a directory hierarchy
|
134
190
|
test_files: []
|
data/.travis.yml
DELETED
data/lib/mtree/parser.y
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
class Mtree::Parser
|
2
|
-
rule
|
3
|
-
target: expressions { if @path_components.any? then raise 'Malformed specifications' end }
|
4
|
-
|
|
5
|
-
|
6
|
-
expressions: expressions expression
|
7
|
-
| expression
|
8
|
-
|
9
|
-
expression: SET attributes LINE_BREAK { @defaults.merge!(val[1]) }
|
10
|
-
| IDENTIFIER attributes LINE_BREAK { spec = Mtree::FileSpecification.new(val[0], @defaults.merge(val[1])); if @specifications.nil? then @specifications = spec end; if @path_components.last then @path_components.last << spec end; @path_components.push(spec) } # @path_components.push(val[0]); @specifications.push() }
|
11
|
-
| DOT_DOT LINE_BREAK { @path_components.pop }
|
12
|
-
| LINE_BREAK
|
13
|
-
|
14
|
-
attributes: attributes attribute { result = val[0].merge(val[1]) }
|
15
|
-
| { result = {} }
|
16
|
-
|
17
|
-
attribute: GID { result = { gid: Integer(val[0]) } }
|
18
|
-
| GNAME { result = { gname: val[0] } }
|
19
|
-
| MODE { result = { mode: Integer(val[0], 8) } }
|
20
|
-
| NOCHANGE { result = { nochange: true } }
|
21
|
-
| TAGS { result = {} }
|
22
|
-
| TYPE { result = { type: val[0] } }
|
23
|
-
| UID { result = { uid: Integer(val[0]) } }
|
24
|
-
| UNAME { result = { uname: val[0] } }
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
---- header
|
29
|
-
|
30
|
-
require 'strscan'
|
31
|
-
|
32
|
-
---- inner
|
33
|
-
|
34
|
-
attr_accessor :yydebug
|
35
|
-
attr_accessor :defaults
|
36
|
-
|
37
|
-
attr_reader :specifications
|
38
|
-
|
39
|
-
def initialize
|
40
|
-
super
|
41
|
-
@defaults = {}
|
42
|
-
@path_components = []
|
43
|
-
@specifications = nil
|
44
|
-
end
|
45
|
-
|
46
|
-
def parse(text)
|
47
|
-
s = StringScanner.new(text)
|
48
|
-
|
49
|
-
tokens = []
|
50
|
-
until s.eos? do
|
51
|
-
case
|
52
|
-
when s.scan(/#.*/); # Ignore comment
|
53
|
-
when s.scan(/[[:blank:]]+/); # Ignore blanks
|
54
|
-
when s.scan(/\n/); tokens << [:LINE_BREAK, s.matched]
|
55
|
-
when s.scan(/\.\./); tokens << [:DOT_DOT, s.matched]
|
56
|
-
when s.scan(/\/set\b/); tokens << [:SET, s.matched]
|
57
|
-
when s.scan(/gid=([[:digit:]]+)/); tokens << [:GID, s[1]]
|
58
|
-
when s.scan(/gname=([[:alnum:]]+)/); tokens << [:GNAME, s[1]]
|
59
|
-
when s.scan(/mode=([[:digit:]]+)/); tokens << [:MODE, s[1]]
|
60
|
-
when s.scan(/nochange\b/); tokens << [:NOCHANGE, s[1]]
|
61
|
-
when s.scan(/tags=([[:print:]]+)\b/); tokens << [:TAGS, s[1]]
|
62
|
-
when s.scan(/type=(dir|file)/); tokens << [:TYPE, s[1]]
|
63
|
-
when s.scan(/uid=([[:digit:]]+)/); tokens << [:UID, s[1]]
|
64
|
-
when s.scan(/uname=([[:alnum:]]+)/); tokens << [:UNAME, s[1]]
|
65
|
-
when s.scan(/[^[:space:]]+/); tokens << [:IDENTIFIER, s.matched]
|
66
|
-
else
|
67
|
-
raise "No match: #{s.rest}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
define_singleton_method(:next_token) { tokens.shift }
|
72
|
-
|
73
|
-
tokens << [false, false]
|
74
|
-
|
75
|
-
# tokens.each do |t|
|
76
|
-
# puts t.inspect
|
77
|
-
# end
|
78
|
-
|
79
|
-
do_parse
|
80
|
-
end
|
81
|
-
|
82
|
-
def parse_file(filename)
|
83
|
-
parse(File.read(filename))
|
84
|
-
end
|