rika 2.0.1-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9885d200caf6116b8356a6eedf8c953aba4429e05d7a20d30a6c0a2281a9e57e
4
- data.tar.gz: 9c71e6ae01ea608c45cb302627bea7ee3612058fbd237787d4aebc5ff07476b4
3
+ metadata.gz: 350fd4a9478c68bea286f43ea43fe7199899fb6124115615d7e023d781845b8b
4
+ data.tar.gz: d9470eb7cd432acac089e1f1dc030a414096c87ab8720fa79ebd6cfe16ac4528
5
5
  SHA512:
6
- metadata.gz: 407fe5fe996b47c080a1a9282ae5b7c3bc48685f18ee243af81ecb6e567c5eef3dfec86b554ed3fd59d3735f8ba5af7712f9c5388f59a9a22905b0b0c8e01c73
7
- data.tar.gz: 20e0f6c590f5d533866616e2cba8229d1d003959214e452702f19f5fc462b6afa3e4f2e1c8ce5feb30468f9207c0231b9778185333c91af4173c35970684bc2c
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.1 (Tika v2.9.0) - https://github.com/keithrbennett/rika
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
@@ -1,5 +1,10 @@
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
+
3
8
  #### v2.0.1
4
9
 
5
10
  * Fix license specification in gemspec, update copyright name and year.
@@ -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 << "Source: #{target}\n" if options[:source]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rika
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.2'
5
5
  end
@@ -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
@@ -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.1
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-09-15 00:00:00.000000000 Z
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