rika 2.0.1-java → 2.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/RELEASE_NOTES.md +5 -0
- data/lib/rika/cli/args_parser.rb +1 -1
- data/lib/rika/cli/rika_command.rb +15 -1
- data/lib/rika/version.rb +1 -1
- data/spec/rika/cli/rika_command_spec.rb +18 -0
- data/spec/rika/parser_spec.rb +0 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350fd4a9478c68bea286f43ea43fe7199899fb6124115615d7e023d781845b8b
|
4
|
+
data.tar.gz: d9470eb7cd432acac089e1f1dc030a414096c87ab8720fa79ebd6cfe16ac4528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82961b39e1df54bd5ef83be432a1391a021537beea8ab63e7870f41ecec56457fd87c13fcdb3b3df848b520344ccbad69fd7d58b5c4c4b4ad2590381fc4dbca2
|
7
|
+
data.tar.gz: 2e9edfc485e6e2f43299ac34e0bcef47e752b5a3a76d0970f84a7880612619ba41d3adab011000199728847a11f53232515a5893bf084abbd51c41bf3f8c50b6
|
data/README.md
CHANGED
@@ -85,7 +85,7 @@ rika x.pdf https://github.com/keithrbennett/rika
|
|
85
85
|
Here is the help text:
|
86
86
|
|
87
87
|
```
|
88
|
-
Rika v2.0.
|
88
|
+
Rika v2.0.2 (Tika v2.9.0) - https://github.com/keithrbennett/rika
|
89
89
|
|
90
90
|
Usage: rika [options] <file or url> [...file or url...]
|
91
91
|
Output formats are: [a]wesome_print, [t]o_s, [i]nspect, [j]son), [J] for pretty json, and [y]aml.
|
@@ -98,7 +98,7 @@ Values for the text, metadata, and as_array boolean options may be specified as
|
|
98
98
|
-m, --[no-]metadata [FLAG] Output metadata (default: true)
|
99
99
|
-t, --[no-]text [FLAG] Output text (default: true)
|
100
100
|
-k, --[no-]key-sort [FLAG] Sort metadata keys case insensitively (default: true)
|
101
|
-
-s, --[no-]source [FLAG] Output document source file or URL
|
101
|
+
-s, --[no-]source [FLAG] Output document source file or URL (default: false)
|
102
102
|
-a, --[no-]as-array [FLAG] Output all parsed results as an array (default: false)
|
103
103
|
-v, --version Output version
|
104
104
|
-h, --help Output help
|
data/RELEASE_NOTES.md
CHANGED
data/lib/rika/cli/args_parser.rb
CHANGED
@@ -72,7 +72,7 @@ class ArgsParser
|
|
72
72
|
options[:key_sort] = (v.nil? ? true : v)
|
73
73
|
end
|
74
74
|
|
75
|
-
opts.on('-s', '--[no-]source [FLAG]', TrueClass, 'Output document source file or URL') do |v|
|
75
|
+
opts.on('-s', '--[no-]source [FLAG]', TrueClass, 'Output document source file or URL (default: false)') do |v|
|
76
76
|
options[:source] = (v.nil? ? true : v)
|
77
77
|
end
|
78
78
|
|
@@ -71,6 +71,20 @@ class RikaCommand
|
|
71
71
|
h
|
72
72
|
end
|
73
73
|
|
74
|
+
# Outputs the source file or URL in the form of:
|
75
|
+
# -------------------------------------------------------------------------------
|
76
|
+
# Source: path/to/file.ext
|
77
|
+
# -------------------------------------------------------------------------------
|
78
|
+
# @param [String] source document source identifier
|
79
|
+
# @return multiline string as displayed above
|
80
|
+
private def source_output_string(source)
|
81
|
+
<<~STRING
|
82
|
+
-------------------------------------------------------------------------------
|
83
|
+
Source: #{source}
|
84
|
+
-------------------------------------------------------------------------------
|
85
|
+
STRING
|
86
|
+
end
|
87
|
+
|
74
88
|
# Builds the string representation of the result of parsing a single document
|
75
89
|
# @param [String] target the target document
|
76
90
|
# @param [ParseResult] result the parse result
|
@@ -80,7 +94,7 @@ class RikaCommand
|
|
80
94
|
metadata_formatter.(result_hash(result))
|
81
95
|
else
|
82
96
|
sio = StringIO.new
|
83
|
-
sio <<
|
97
|
+
sio << source_output_string(target) if options[:source]
|
84
98
|
sio << metadata_formatter.(result.metadata) << "\n" if options[:metadata]
|
85
99
|
sio << text_formatter.(result.content) << "\n" if options[:text]
|
86
100
|
sio.string
|
data/lib/rika/version.rb
CHANGED
@@ -117,4 +117,22 @@ describe RikaCommand do
|
|
117
117
|
expect(output).to include('sample help text')
|
118
118
|
end
|
119
119
|
end
|
120
|
+
|
121
|
+
describe '#source_output_string' do
|
122
|
+
let(:rika_command) { described_class.new([]) }
|
123
|
+
let(:sample_filespec) { 'path/to/file.ext' }
|
124
|
+
let(:sample_output_string) { rika_command.send(:source_output_string, sample_filespec) }
|
125
|
+
let(:sample_output_lines) { sample_output_string.lines.map(&:chomp) }
|
126
|
+
let(:header_trailer_line) { '-' * 79 }
|
127
|
+
|
128
|
+
specify 'it has a header and trailer line' do
|
129
|
+
expect(sample_output_lines[0]).to eq(header_trailer_line)
|
130
|
+
expect(sample_output_lines[2]).to eq(header_trailer_line)
|
131
|
+
end
|
132
|
+
|
133
|
+
specify 'information line is well formed' do
|
134
|
+
line = sample_output_lines[1]
|
135
|
+
expect(line).to match("Source: #{sample_filespec}")
|
136
|
+
end
|
137
|
+
end
|
120
138
|
end
|
data/spec/rika/parser_spec.rb
CHANGED
@@ -161,10 +161,6 @@ describe Rika::Parser do
|
|
161
161
|
expect(pdf_parse_result.content.lines[1]).to include(quote_first_line)
|
162
162
|
end
|
163
163
|
|
164
|
-
it 'returns no content for an image' do
|
165
|
-
expect(image_parse_result.content).to be_empty
|
166
|
-
end
|
167
|
-
|
168
164
|
it 'only returns max content length from a text file' do
|
169
165
|
expect(Rika.parse(fixture_path('document.txt'), max_content_length: 8).content).to eq('Stopping')
|
170
166
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rika
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Richard Nyström
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|