dorian-parallel 0.2.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/parallel +11 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d752b46df12975fe4ac0187dece981625a873f9a78b9e9bfc931f09424a9c18
4
- data.tar.gz: 39db3326ee7c02c52966ce7e1572eba0d2d2a5ba08a975f55e52f15837a0700d
3
+ metadata.gz: bfba0dfc150be77a2e94518e0fd646854c99a63e7cc827d09ee7b0fb7b4cc184
4
+ data.tar.gz: 81097441dc78243c09aa0d3e409673cb9a98503162cac668aa850d378d225d2d
5
5
  SHA512:
6
- metadata.gz: 46f45c29851599fd1328c2911fe7190727c397d9fce3e46825ba748e96b6af287cff39c71581bd56947a1cdf0356cdf9bdc790e07e0ac0fcf9dfd3ff1c130a07
7
- data.tar.gz: 35e2b77d9c7743537960e6b71ddb51f6473655a9be2823c594b20917e7d097e3ffffebf472bd27687c8587e079fc0042a10a2e3248f588fa0d2fd0a1d9e02fa9
6
+ metadata.gz: b97aae3db16d4e7bf7f8e06f708775ae45dcb5917d7b2d14c359df22104bfd94adc5655023679b6c38dfac98c17b26b8af4e90d1839845c0856c16186ef65c6e
7
+ data.tar.gz: e6c1f41262ca9a458ac06a78fd423da13578280c3ef932284d7b6180fd3f663c4781803670481af626b5a22c6a6c6f8206f237bbe3771e4484b3bf3467b268db
data/bin/parallel CHANGED
@@ -1,14 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require "dorian/arguments"
4
5
  require "parallel"
5
6
 
6
- if ARGV.size != 1 || ARGV[0] == "--help" || ARGV[0] == "-h"
7
- puts "USAGE: ... | parallel CODE"
8
- exit
7
+ parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
8
+
9
+ abort parsed.help if parsed.options.help
10
+
11
+ if parsed.options.version
12
+ abort File.read(File.expand_path("../../VERSION", __FILE__))
9
13
  end
10
14
 
11
- Parallel.each($stdin.each_line.to_a) do |it|
12
- it.strip!
13
- eval(ARGV.first)
15
+ input = parsed.files.map { |file| File.read(file) }.join("\n")
16
+ input = $stdin.each_line.to_a.map(&:strip).join("\n") if input.empty?
17
+ Parallel.each(input.lines.map(&:strip)) do |it|
18
+ eval(parsed.arguments.join(" "))
14
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-22 00:00:00.000000000 Z
11
+ date: 2024-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel