l42_my_ruby 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 878bf96a608ecbdb0a5fa11dfd1dfd1623843fa12ecede6104a58eb039324758
4
- data.tar.gz: a73393d4a5268da7ce0b03f2cd8e4acdf1e82d3526c20c371b7585eac0ce464e
3
+ metadata.gz: bb1c3756379e743210148854ee4eedb3e3a15e8d009051a5e1b43083fde80715
4
+ data.tar.gz: 668781958b9b1caf7721896b5e3a8f05a94e7409f259223db4fb8ae842f3c311
5
5
  SHA512:
6
- metadata.gz: f85bb9344263e6d1ab22b106631600e828c7f21cc6b0cf8e267fb58933b9a78c75f9828c1f6f02185bed1bb9438e50ab3bd91393d41bfe11242c05b2d3b3308d
7
- data.tar.gz: edba69dac39e3c02b23219ced7052faf59411c4121472852fefb83ec9bc61e75f1a0859586fb0eb05afe145467a202b7e38e4b994cf53080a2feb7d111ba2ba7
6
+ metadata.gz: 9ca6caf9ffeb117ee01dcfca54072db7ea5e402be9d62e782abce90b3470bc4f8897e7bbf150f3afeaf09c0eaebc2fe4520b9be6e38180eb3eaa935534212b5c
7
+ data.tar.gz: 636cac32842376ad0cd33c1ad292e2aa8cff03a033379304f75931f11a01b42c4914636635aa97f8444a7589de6a427a3ff8fa18b6bc7639a2027667f3e8705c
data/bin/mv_to_random CHANGED
@@ -1,4 +1,7 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- ASDF_RUBY_VERSION=3.1.2 ruby $(realpath $0).rb $@
4
+ require_relative '../lib/l42'
4
5
 
6
+ L42::Monad.interact(L42::Interfaces::ToRandom)
7
+ # SPDX-License-Identifier: Apache-2.0
data/bin/mv_with_ts CHANGED
@@ -1,4 +1,6 @@
1
- #!/usr/bin/env bash
2
-
3
- ASDF_RUBY_VERSION=3.1.2 ruby $(realpath $0).rb $@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ require_relative '../lib/l42'
4
4
 
5
+ L42::Monad.functional_output(L42::Interfaces::WithTs, *ARGV)
6
+ # SPDX-License-Identifier: Apache-2.0
data/bin/tx_send CHANGED
@@ -1,4 +1,9 @@
1
- #!/usr/bin/env bash
2
-
3
- ASDF_RUBY_VERSION=3.1.2 ruby $(realpath $0).rb $@ | bash
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ require_relative '../lib/l42'
4
4
 
5
+ output = L42::Monad.functional_input(L42::Interfaces::TxSend, ARGV.first)
6
+ output&.each do | line |
7
+ system(line)
8
+ end
9
+ # SPDX-License-Identifier: Apache-2.0
@@ -6,8 +6,7 @@ module L42
6
6
  module TxSend
7
7
  extend self
8
8
 
9
- def call(lines)
10
- Lab42::Rgxargs.new.parse(ARGV) => [OpenStruct, [dest], *]
9
+ def call(lines, dest)
11
10
  [
12
11
  :stdout,
13
12
  [*lines.map(&_send_to(dest)), "tmux select-window -t #{dest}"]
data/lib/l42/monad.rb CHANGED
@@ -29,6 +29,19 @@ module L42
29
29
  "a transformer needs to return a result of type `[:stderr|:stdout, anything]`, not #{x.inspect}"
30
30
  end
31
31
  end
32
+
33
+ def functional_input(transformer, *args)
34
+ case transformer.($stdin.readlines(chomp: true), *args)
35
+ in [:stdout, output]
36
+ output
37
+ in [:stderr, output]
38
+ $stderr.puts(output)
39
+ exit(-1)
40
+ in x
41
+ raise ContractViolation,
42
+ "a transformer needs to return a result of type `[:stderr|:stdout, anything]`, not #{x.inspect}"
43
+ end
44
+ end
32
45
  end
33
46
  end
34
47
  # SPDX-License-Identifier: Apache-2.0
data/lib/l42/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module L42
4
4
  module Version
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
8
8
  # SPDX-License-Identifier: Apache-2.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l42_my_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
@@ -39,11 +39,8 @@ files:
39
39
  - LICENSE
40
40
  - README.md
41
41
  - bin/mv_to_random
42
- - bin/mv_to_random.rb
43
42
  - bin/mv_with_ts
44
- - bin/mv_with_ts.rb
45
43
  - bin/tx_send
46
- - bin/tx_send.rb
47
44
  - lib/l42.rb
48
45
  - lib/l42/data_class.rb
49
46
  - lib/l42/interfaces/to_random.rb
data/bin/mv_to_random.rb DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- raise RuntimeError, "Do not require me" unless __FILE__ == $PROGRAM_NAME
4
-
5
- require_relative '../lib/l42'
6
-
7
- L42::Monad.interact(L42::Interfaces::ToRandom)
8
- # SPDX-License-Identifier: Apache-2.0
data/bin/mv_with_ts.rb DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- raise RuntimeError, "Do not require me" unless __FILE__ == $PROGRAM_NAME
4
-
5
- require_relative '../lib/l42'
6
-
7
- L42::Monad.functional_output(L42::Interfaces::WithTs, *ARGV)
8
- # SPDX-License-Identifier: Apache-2.0
data/bin/tx_send.rb DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- raise RuntimeError, "Do not require me" unless __FILE__ == $PROGRAM_NAME
4
-
5
- require_relative '../lib/l42'
6
-
7
- L42::Monad.interact(L42::Interfaces::TxSend)
8
- # SPDX-License-Identifier: Apache-2.0