fdupes_parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +17 -0
- data/Rakefile +4 -0
- data/lib/fdupes_parser/entry.rb +25 -0
- data/lib/fdupes_parser/error.rb +4 -0
- data/lib/fdupes_parser/version.rb +5 -0
- data/lib/fdupes_parser.rb +15 -0
- data/sig/fdupes_parser.rbs +4 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b22b0d0148482f51baea3a48ef0845ab31c5e76896103ef70404894dfefe9944
|
4
|
+
data.tar.gz: dc0f5aea8a125686479f60279f949a11bc0cf9cba48aa87543f1575f1639d910
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4335ed57ef838bddaa1d0bef2b9a7eeefa8563798928935de77ae03d0b8827e2e1e1fa641900257e55a810bedf0159cd5e653e28902b3457f3bae90b6193c06b
|
7
|
+
data.tar.gz: d5fa56181940643379d37661a3675251bebc53cb4855119a41e7a192baa0692b4aeb0d839fd944d08ec82944020b361bead78b5d4b912b736a5d24ce1a5f4669
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2024 Yuya.Nishida.
|
2
|
+
|
3
|
+
X11 License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# FdupesParser
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
```console
|
6
|
+
$ bundle add fdupes_parser
|
7
|
+
```
|
8
|
+
|
9
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
10
|
+
|
11
|
+
```console
|
12
|
+
$ gem install fdupes_parser
|
13
|
+
```
|
14
|
+
|
15
|
+
## Contributing
|
16
|
+
|
17
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nishidayuya/fdupes_parser .
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "fdupes_parser"
|
2
|
+
|
3
|
+
class FdupesParser::Entry < Data.define(:size, :paths)
|
4
|
+
class << self
|
5
|
+
def parse(s_entry)
|
6
|
+
bytes_each_line, *paths = *s_entry.each_line(chomp: true)
|
7
|
+
md = /\A(?<size>\d+) bytes each:\z/.match(bytes_each_line)
|
8
|
+
if !md
|
9
|
+
raise FdupesParser::Error.new("Malformed line is detected: line=#{bytes_each_line.inspect}")
|
10
|
+
end
|
11
|
+
|
12
|
+
size = md[:size].to_i
|
13
|
+
new(size:, paths:)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
s = +"#{size} bytes each:\n"
|
19
|
+
paths.each do |path|
|
20
|
+
s << path << "\n"
|
21
|
+
end
|
22
|
+
s << "\n"
|
23
|
+
return s
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FdupesParser
|
2
|
+
class << self
|
3
|
+
def each_entry(input)
|
4
|
+
return to_enum(__method__, input) if !block_given?
|
5
|
+
|
6
|
+
input.each_line("", chomp: true).lazy.each do |s_entry|
|
7
|
+
yield(FdupesParser::Entry.parse(s_entry))
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
require "fdupes_parser/entry"
|
14
|
+
require "fdupes_parser/error"
|
15
|
+
require "fdupes_parser/version"
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fdupes_parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuya.Nishida.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- LICENSE.txt
|
20
|
+
- README.md
|
21
|
+
- Rakefile
|
22
|
+
- lib/fdupes_parser.rb
|
23
|
+
- lib/fdupes_parser/entry.rb
|
24
|
+
- lib/fdupes_parser/error.rb
|
25
|
+
- lib/fdupes_parser/version.rb
|
26
|
+
- sig/fdupes_parser.rbs
|
27
|
+
homepage: https://github.com/nishidayuya/fdupes_parser
|
28
|
+
licenses: []
|
29
|
+
metadata:
|
30
|
+
homepage_uri: https://github.com/nishidayuya/fdupes_parser
|
31
|
+
source_code_uri: https://github.com/nishidayuya/fdupes_parser
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.0.0
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubygems_version: 3.5.16
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: A parser for fdupes(1) result
|
51
|
+
test_files: []
|