rika 2.0.0-java → 2.0.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +2 -2
- data/README.md +2 -2
- data/RELEASE_NOTES.md +11 -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/rika.gemspec +1 -1
- data/spec/rika/cli/rika_command_spec.rb +18 -0
- data/spec/rika/parser_spec.rb +0 -4
- metadata +3 -3
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/LICENSE.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2023 Keith Bennett
|
|
2
2
|
|
|
3
3
|
MIT License
|
|
4
4
|
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
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.
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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]
|
|
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
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## Release Notes
|
|
2
2
|
|
|
3
|
+
#### v2.0.2
|
|
4
|
+
|
|
5
|
+
* Now prints source name on line with header and footer lines.
|
|
6
|
+
* Improve help text.
|
|
7
|
+
|
|
8
|
+
#### v2.0.1
|
|
9
|
+
|
|
10
|
+
* Fix license specification in gemspec, update copyright name and year.
|
|
11
|
+
* Clarify help text.
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
#### v2.0.0
|
|
4
15
|
|
|
5
16
|
* Add features:
|
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, '
|
|
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
data/rika.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
|
19
19
|
gem.require_paths = ['lib']
|
|
20
20
|
gem.add_dependency 'awesome_print'
|
|
21
21
|
gem.platform = 'java'
|
|
22
|
-
gem.license = '
|
|
22
|
+
gem.license = 'MIT'
|
|
23
23
|
gem.metadata['rubygems_mfa_required'] = 'true'
|
|
24
24
|
|
|
25
25
|
# NOTE: I am excluding the Ruby version constraint because this gem runs only in JRuby, and I don't know the
|
|
@@ -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
|
|
@@ -79,7 +79,7 @@ files:
|
|
|
79
79
|
- spec/spec_helper.rb
|
|
80
80
|
homepage: https://github.com/keithrbennett/rika
|
|
81
81
|
licenses:
|
|
82
|
-
-
|
|
82
|
+
- MIT
|
|
83
83
|
metadata:
|
|
84
84
|
rubygems_mfa_required: 'true'
|
|
85
85
|
post_install_message: |2+
|