rexe 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +7 -7
- data/exe/rexe +30 -34
- data/rexe.gemspec +10 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d4ad1a24022659314b09d706db797d17702d6b879b4b52d0d4068b7fef4ef9c
|
4
|
+
data.tar.gz: 04b6759f33142d6e738bd12ce0bad997385f77c02c7e0537ea5f3c609df8ef7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a51a900c81e65878e13a795708c35e57d41f7226300932bea17105707aa03f9b5246e386ecdb7e3d437361614ccbdbaab63b7fb1b4c6bc59ee28bbd33dcd18a
|
7
|
+
data.tar.gz: cc4acaa0817872e3e9ec7960246c721152c7311708abd8bed7bf9e206332c8c6bf579d876c0240d2a98a1780eaade154fd7412b3c3e5fa28d5f8383308ea0323
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## rexe -- Ruby Command Line Executor/Filter
|
2
2
|
|
3
|
+
### 1.7.0
|
4
|
+
|
5
|
+
* Replace amazing_print dependency with awesome_print.
|
6
|
+
* Effectively disable `try` method, i.e. print stack trace on errors.
|
7
|
+
* In `try` method, rescue StandardError instead of Exception.
|
8
|
+
|
9
|
+
|
3
10
|
### 1.6.0
|
4
11
|
|
5
12
|
* Replace calls to `exists?`, which has been removed, with `exist?`.
|
data/README.md
CHANGED
@@ -73,7 +73,7 @@ Rexe is at https://github.com/keithrbennett/rexe and can be installed with `gem
|
|
73
73
|
Here is rexe's help text as of the time of this writing:
|
74
74
|
|
75
75
|
```
|
76
|
-
rexe -- Ruby Command Line Executor/Filter -- v1.
|
76
|
+
rexe -- Ruby Command Line Executor/Filter -- v1.7.0 -- https://github.com/keithrbennett/rexe
|
77
77
|
|
78
78
|
Executes Ruby code on the command line,
|
79
79
|
optionally automating management of standard input and standard output,
|
@@ -135,7 +135,7 @@ before processing the input.
|
|
135
135
|
|
136
136
|
If there is a REXE_OPTIONS environment variable, its content will be prepended
|
137
137
|
to the command line so that you can specify options implicitly
|
138
|
-
(e.g. `export REXE_OPTIONS="-r
|
138
|
+
(e.g. `export REXE_OPTIONS="-r awesome_print,yaml"`)
|
139
139
|
```
|
140
140
|
|
141
141
|
### Simplifying the Rexe Invocation
|
@@ -239,11 +239,11 @@ $ echo $EUR_RATES_JSON | rexe -gy -ij -mb -oa -n self
|
|
239
239
|
:input_format: :json
|
240
240
|
:input_mode: :one_big_string
|
241
241
|
:loads: []
|
242
|
-
:output_format: :
|
243
|
-
:output_format_tty: :
|
244
|
-
:output_format_block: :
|
242
|
+
:output_format: :awesome_print
|
243
|
+
:output_format_tty: :awesome_print
|
244
|
+
:output_format_block: :awesome_print
|
245
245
|
:requires:
|
246
|
-
-
|
246
|
+
- awesome_print
|
247
247
|
- json
|
248
248
|
- yaml
|
249
249
|
:log_format: :yaml
|
@@ -741,7 +741,7 @@ For consistency with the `ruby` interpreter, rexe supports requires with the `-r
|
|
741
741
|
|
742
742
|
```bash
|
743
743
|
vvvvvvvvvvvvvvvvvv
|
744
|
-
$ echo $EUR_RATES_JSON | rexe -r json,
|
744
|
+
$ echo $EUR_RATES_JSON | rexe -r json,awesome_print 'ap JSON.parse(STDIN.read)'
|
745
745
|
^^^^^^^^^^^^^^^^^^
|
746
746
|
```
|
747
747
|
|
data/exe/rexe
CHANGED
@@ -15,24 +15,26 @@ require 'shellwords'
|
|
15
15
|
|
16
16
|
class Rexe
|
17
17
|
|
18
|
-
VERSION = '1.
|
18
|
+
VERSION = '1.7.0'
|
19
19
|
|
20
20
|
PROJECT_URL = 'https://github.com/keithrbennett/rexe'
|
21
21
|
|
22
22
|
|
23
23
|
module Helpers
|
24
24
|
|
25
|
-
#
|
25
|
+
# Originally the entire run was wrapped in this rescue to make error output more concise.
|
26
|
+
# However, I am concerned that hiding the stack trace will make it harder to debug,
|
27
|
+
# and be worse than the ugliness of showing it when it is not needed. So, I am commenting
|
28
|
+
# out the rescue for now, and will see how it goes. If you have any opinions on this,
|
29
|
+
# please let me know at https://github.com/keithrbennett/rexe/issues/5 .
|
30
|
+
#
|
31
|
+
# (disabled) Try executing code. If error raised, print message (but not stack trace) & exit -1.
|
26
32
|
def try
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
$stderr.puts("Use the -h option to get help.")
|
33
|
-
exit(-1)
|
34
|
-
end
|
35
|
-
end
|
33
|
+
yield
|
34
|
+
# rescue StandardError => e
|
35
|
+
# $stderr.puts("rexe ERROR: #{e}")
|
36
|
+
# $stderr.puts('Use the -h option to get help.')
|
37
|
+
# exit(-1)
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
@@ -71,9 +73,6 @@ class Rexe
|
|
71
73
|
end
|
72
74
|
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
76
|
class Lookups
|
78
77
|
def input_modes
|
79
78
|
@input_modes ||= {
|
@@ -107,7 +106,7 @@ class Rexe
|
|
107
106
|
|
108
107
|
def output_formats
|
109
108
|
@output_formats ||= {
|
110
|
-
'a' => :
|
109
|
+
'a' => :awesome_print,
|
111
110
|
'i' => :inspect,
|
112
111
|
'j' => :json,
|
113
112
|
'J' => :pretty_json,
|
@@ -123,7 +122,7 @@ class Rexe
|
|
123
122
|
|
124
123
|
def formatters
|
125
124
|
@formatters ||= {
|
126
|
-
|
125
|
+
awesome_print: ->(obj) { obj.ai + "\n" },
|
127
126
|
inspect: ->(obj) { obj.inspect + "\n" },
|
128
127
|
json: ->(obj) { obj.to_json },
|
129
128
|
marshal: ->(obj) { Marshal.dump(obj) },
|
@@ -141,7 +140,7 @@ class Rexe
|
|
141
140
|
@format_requires ||= {
|
142
141
|
json: 'json',
|
143
142
|
pretty_json: 'json',
|
144
|
-
|
143
|
+
awesome_print: 'awesome_print',
|
145
144
|
pretty_print: 'pp',
|
146
145
|
yaml: 'yaml'
|
147
146
|
}
|
@@ -149,7 +148,6 @@ class Rexe
|
|
149
148
|
end
|
150
149
|
|
151
150
|
|
152
|
-
|
153
151
|
class CommandLineParser
|
154
152
|
|
155
153
|
include Helpers
|
@@ -245,7 +243,7 @@ class Rexe
|
|
245
243
|
|
246
244
|
If there is a REXE_OPTIONS environment variable, its content will be prepended
|
247
245
|
to the command line so that you can specify options implicitly
|
248
|
-
(e.g. `export REXE_OPTIONS="-r
|
246
|
+
(e.g. `export REXE_OPTIONS="-r awesome_print,yaml"`)
|
249
247
|
|
250
248
|
HEREDOC
|
251
249
|
|
@@ -261,7 +259,7 @@ class Rexe
|
|
261
259
|
extension = File.extname(filespec).downcase
|
262
260
|
if extension == '.json'
|
263
261
|
:json
|
264
|
-
elsif
|
262
|
+
elsif %w{.yml .yaml}.include?(extension)
|
265
263
|
:yaml
|
266
264
|
else
|
267
265
|
:none
|
@@ -293,7 +291,7 @@ class Rexe
|
|
293
291
|
input_format_specified = false
|
294
292
|
output_format_specified = false
|
295
293
|
|
296
|
-
report_unspecified_options = ->
|
294
|
+
report_unspecified_options = -> do
|
297
295
|
messages = []
|
298
296
|
|
299
297
|
unless input_mode_specified
|
@@ -307,14 +305,14 @@ class Rexe
|
|
307
305
|
end
|
308
306
|
|
309
307
|
if messages.any?
|
310
|
-
$stderr.puts(
|
308
|
+
$stderr.puts(messages.join("\n"))
|
311
309
|
$stderr.puts("See help (run with -h) for more information.\n\n")
|
312
310
|
end
|
313
311
|
end
|
314
312
|
|
315
313
|
OptionParser.new do |parser|
|
316
314
|
|
317
|
-
parser.on('-c', '--clear_options',
|
315
|
+
parser.on('-c', '--clear_options', 'Clear all previous command line options') do |v|
|
318
316
|
options.clear
|
319
317
|
end
|
320
318
|
|
@@ -339,7 +337,7 @@ class Rexe
|
|
339
337
|
end
|
340
338
|
end
|
341
339
|
|
342
|
-
parser.on("-h", "--help",
|
340
|
+
parser.on("-h", "--help", 'Show help') do |_help_requested|
|
343
341
|
puts help_text
|
344
342
|
exit
|
345
343
|
end
|
@@ -537,17 +535,15 @@ class Rexe
|
|
537
535
|
# Bypasses Bundler's restriction on loading gems
|
538
536
|
# (see https://stackoverflow.com/questions/55144094/bundler-doesnt-permit-using-gems-in-project-home-directory)
|
539
537
|
private def require!(the_require)
|
540
|
-
|
538
|
+
require the_require
|
539
|
+
rescue LoadError => error
|
540
|
+
gem_path = `gem which #{the_require}`
|
541
|
+
if gem_path.chomp.strip.empty?
|
542
|
+
raise error # re-raise the error, can't fix it
|
543
|
+
else
|
544
|
+
load_dir = File.dirname(gem_path)
|
545
|
+
$LOAD_PATH += load_dir
|
541
546
|
require the_require
|
542
|
-
rescue LoadError => error
|
543
|
-
gem_path = `gem which #{the_require}`
|
544
|
-
if gem_path.chomp.strip.empty?
|
545
|
-
raise error # re-raise the error, can't fix it
|
546
|
-
else
|
547
|
-
load_dir = File.dirname(gem_path)
|
548
|
-
$LOAD_PATH += load_dir
|
549
|
-
require the_require
|
550
|
-
end
|
551
547
|
end
|
552
548
|
end
|
553
549
|
|
data/rexe.gemspec
CHANGED
@@ -3,6 +3,9 @@ Gem::Specification.new do |spec|
|
|
3
3
|
spec.name = "rexe"
|
4
4
|
|
5
5
|
spec.version = -> do
|
6
|
+
# This is a bit of a kludge. If there is a commented out VERSION line preceding the active line,
|
7
|
+
# this will read the commented line.
|
8
|
+
# TODO: Ignore comment lines.
|
6
9
|
rexe_file = File.join(File.dirname(__FILE__), 'exe', 'rexe')
|
7
10
|
version_line = File.readlines(rexe_file).grep(/\s*VERSION\s*=\s*'/).first.chomp
|
8
11
|
version_line.match(/'(.+)'/)[0].gsub("'", '')
|
@@ -38,11 +41,16 @@ Gem::Specification.new do |spec|
|
|
38
41
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
39
42
|
spec.require_paths = ["lib"]
|
40
43
|
|
41
|
-
spec.add_dependency "
|
44
|
+
spec.add_dependency "awesome_print"
|
42
45
|
|
43
46
|
spec.add_development_dependency "bundler", "~> 2.0"
|
44
47
|
spec.add_development_dependency "os"
|
45
48
|
spec.add_development_dependency "rake", "~> 12.3"
|
46
|
-
spec.add_development_dependency "rspec", "~> 3.
|
49
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
47
50
|
|
51
|
+
# Remove this message (added November 2023) later (maybe July 2024).
|
52
|
+
spec.post_install_message = <<~MESSAGE
|
53
|
+
Starting with v1.7.0, awesome_print is now used instead of amazing_print
|
54
|
+
for fancy human readable output.
|
55
|
+
MESSAGE
|
48
56
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Bennett
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: awesome_print
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
75
|
+
version: '3.12'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
82
|
+
version: '3.12'
|
83
83
|
description: Ruby Command Line Executor
|
84
84
|
email:
|
85
85
|
- keithrbennett@gmail.com
|
@@ -110,7 +110,8 @@ metadata:
|
|
110
110
|
homepage_uri: https://github.com/keithrbennett/rexe
|
111
111
|
source_code_uri: https://github.com/keithrbennett/rexe
|
112
112
|
changelog_uri: https://github.com/keithrbennett/rexe/blob/master/README.md
|
113
|
-
post_install_message:
|
113
|
+
post_install_message: "Starting with v1.7.0, awesome_print is now used instead of
|
114
|
+
amazing_print \nfor fancy human readable output.\n"
|
114
115
|
rdoc_options: []
|
115
116
|
require_paths:
|
116
117
|
- lib
|
@@ -125,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: '0'
|
127
128
|
requirements: []
|
128
|
-
rubygems_version: 3.4.
|
129
|
-
signing_key:
|
129
|
+
rubygems_version: 3.4.22
|
130
|
+
signing_key:
|
130
131
|
specification_version: 4
|
131
132
|
summary: Ruby Command Line Executor
|
132
133
|
test_files: []
|