subtxt 0.2.2 → 0.3.0

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.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/lib/subtxt.rb +20 -18
  3. data/lib/subtxt/version.rb +1 -1
  4. metadata +7 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a51e2f5f00771df588dde9f6f06e8b7818864e5a
4
- data.tar.gz: 0539a1ae0e32fa61f031866717aa2c7b9879312d
2
+ SHA256:
3
+ metadata.gz: 7d6b3f5586203d5fff3aabc5fe4f96924ecbb12c6a074aa85d98e3dfdfd9e1b5
4
+ data.tar.gz: 39d19a2cd6dbd85d431cb07dc07b8f4f30d3de3d20e62aa70b218eb05ae62778
5
5
  SHA512:
6
- metadata.gz: e93bfc67f375571700fb3d4e65d5838d864d1da275207dc514f8e609e979b5f99acce8b8a219a71e3432deae9a5bbb727939354797a2d6581e93f0624301b9e7
7
- data.tar.gz: 13dd9ae68de892ba890f622b077cbbfa5770c3a27c709dc1eaf7572e76796e5d119b56c636eec123f49b800221152020c1912e05b5fe0e6090000a027fa45e1f
6
+ metadata.gz: 0ccae6e0c113b355468421e69963c1219b157733a1244c41a0fec26969c0b349103f58c3dcf439a21f3715e54e5f57bdec9244919b4b29e902810d5211da46c9
7
+ data.tar.gz: cef008ada7bf46741b163094986b5578d4e0f620d7e4bd0f542b0381b88eae08f809d9dc8cf014c619cba4a03ced5e2de4d8471c87f44ff0c202108c72dff042
data/lib/subtxt.rb CHANGED
@@ -19,22 +19,24 @@ require 'yaml'
19
19
  "#{severity}: #{msg}\n"
20
20
  end
21
21
 
22
- def load_patterns pfile
22
+ def load_patterns pfiles
23
+ files = pfiles.split(",")
23
24
  records = []
24
- File.open(pfile, "r") do |pats|
25
- pair = {}
26
- rowct = 0
27
- pats.each_line do |row|
28
- break if row.chomp.downcase == "eof"
29
- unless pair['fnd'] and pair['rep']
30
- unless pair['fnd']
31
- pair['fnd'] = row.chomp
25
+ files.each do |pfile|
26
+ File.open(pfile, "r") do |pats|
27
+ pair = {}
28
+ pats.each_line do |row|
29
+ break if row.chomp.downcase == "eof"
30
+ unless pair['fnd'] and pair['rep']
31
+ unless pair['fnd']
32
+ pair['fnd'] = row.chomp
33
+ else
34
+ pair['rep'] = row.chomp
35
+ end
32
36
  else
33
- pair['rep'] = row.chomp
37
+ records << pair
38
+ pair = {}
34
39
  end
35
- else
36
- records << pair
37
- pair = {}
38
40
  end
39
41
  end
40
42
  end
@@ -125,7 +127,7 @@ parser = OptionParser.new do|opts|
125
127
  \treplace pattern
126
128
  \t
127
129
  \t(pattern|string|content)-(to)-(find)
128
- \t$1 $2 replace
130
+ \t\1 \2 replace
129
131
  \t
130
132
  \tregular expression pattern
131
133
  \ttokenized substitute output
@@ -146,14 +148,14 @@ parser = OptionParser.new do|opts|
146
148
  end
147
149
 
148
150
  if ARGV[0].split("").first == "-"
149
- opts.on('-p PATH', '--patterns PATH', "Full (relative or absolute) path to a text file containing\n\t\t\t\t\tfind & replace patterns in the designated format.\n\t\t\t\t\tREQUIRED. Ex: -p path/to/patterns.rgxp") do |n|
151
+ opts.on('-p', '--patterns PATH[,PATH]', "Full (relative or absolute) path to a text file containing","find & replace patterns in the designated format.","REQUIRED. Ex: -p path/to/patterns.rgxp,path/to/secondary-patterns.txt") do |n|
150
152
  @options[:patterns] = n;
151
153
  end
152
154
  else # the first arg has no leading - or --, it must be our path
153
155
  @options[:patterns] = ARGV[0]
154
156
  end
155
157
 
156
- opts.on('-s PATH', '--source PATH', "Ingest files from this directory. Defaults to current directory.\n\t\t\t\t\tSuperceded if a path is passed as the first argument\n\t\t\t\t\t(subtxt path/to/files -p patterns.rgx). Ex: -i path/to/ingest/dir") do |n|
158
+ opts.on('-s PATH', '--source PATH', "Ingest files from this directory. Defaults to current directory.","\tSuperceded if a path is passed as the first argument","\t(subtxt path/to/files -p patterns.rgx). Ex: -i path/to/ingest/dir") do |n|
157
159
  @options[:ingestdir] = n;
158
160
  end
159
161
 
@@ -162,7 +164,7 @@ parser = OptionParser.new do|opts|
162
164
  # @options[:recursive] = true
163
165
  # end
164
166
 
165
- opts.on('-f STRING', '--filext STRING', "Restrict ingested files to this extension. The first dot (.) is implied.\n\t\t\t\t\tEx: -f htm") do |n|
167
+ opts.on('-f STRING', '--filext STRING', "Restrict ingested files to this extension. The first dot (.) is implied.","\tEx: -f htm") do |n|
166
168
  @options[:filext] = n;
167
169
  end
168
170
 
@@ -170,7 +172,7 @@ parser = OptionParser.new do|opts|
170
172
  @options[:expath] = n;
171
173
  end
172
174
 
173
- opts.on('--expext STRING', "The export file\'s extension to reassign for all files. The first dot (.)\n\t\t\t\t\tis implied. Defaults to same extension as original. Ex: --expext htm") do |n|
175
+ opts.on('--expext STRING', "The export file\'s extension to reassign for all files. The first dot (.)","is implied. Defaults to same extension as original. Ex: --expext htm") do |n|
174
176
  @options[:expext] = n;
175
177
  end
176
178
 
@@ -1,3 +1,3 @@
1
1
  module Subtxt
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subtxt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dominick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2020-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  description: A simple text conversion utility using regular expressions for searching
42
42
  and replacing multiple strings across multiple files, for conversion projects.
43
43
  email:
@@ -69,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubyforge_project:
73
- rubygems_version: 2.4.8
72
+ rubygems_version: 3.0.3
74
73
  signing_key:
75
74
  specification_version: 4
76
75
  summary: A simple utility for converting multiple strings across multiple files, for