subtxt 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/subtxt/version.rb +1 -1
- data/lib/subtxt.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51e2f5f00771df588dde9f6f06e8b7818864e5a
|
4
|
+
data.tar.gz: 0539a1ae0e32fa61f031866717aa2c7b9879312d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e93bfc67f375571700fb3d4e65d5838d864d1da275207dc514f8e609e979b5f99acce8b8a219a71e3432deae9a5bbb727939354797a2d6581e93f0624301b9e7
|
7
|
+
data.tar.gz: 13dd9ae68de892ba890f622b077cbbfa5770c3a27c709dc1eaf7572e76796e5d119b56c636eec123f49b800221152020c1912e05b5fe0e6090000a027fa45e1f
|
data/lib/subtxt/version.rb
CHANGED
data/lib/subtxt.rb
CHANGED
@@ -59,7 +59,8 @@ def subtexts opts
|
|
59
59
|
sandr = []
|
60
60
|
patterns.each do |rec|
|
61
61
|
fnd = rec['fnd']
|
62
|
-
rep = rec['rep'].gsub(
|
62
|
+
rep = rec['rep'].gsub('\n', "\n")
|
63
|
+
rep = rep.gsub('\r', "\r")
|
63
64
|
if opts[:verbose] or opts[:debug]
|
64
65
|
matches = text.gsub(/#{fnd}/).count
|
65
66
|
syms = text.gsub(/#{fnd}/) {|sym| "-#{sym}-"}
|
@@ -117,7 +118,8 @@ parser = OptionParser.new do|opts|
|
|
117
118
|
|
118
119
|
Pattern files are formatted in 3-row sets. The first row is the find pattern,
|
119
120
|
the second row is the replace pattern, and the third row delimits the set for
|
120
|
-
the convenience of your eyeballs.
|
121
|
+
the convenience of your eyeballs. The file must terminate with an explicit
|
122
|
+
""EOF"" Like so:
|
121
123
|
\t---------------------------------------
|
122
124
|
\tfind pattern
|
123
125
|
\treplace pattern
|
@@ -144,7 +146,7 @@ parser = OptionParser.new do|opts|
|
|
144
146
|
end
|
145
147
|
|
146
148
|
if ARGV[0].split("").first == "-"
|
147
|
-
opts.on('-p PATH', '--patterns PATH', "Full (relative or absolute) path to a text file\n\t\t\t\t\
|
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|
|
148
150
|
@options[:patterns] = n;
|
149
151
|
end
|
150
152
|
else # the first arg has no leading - or --, it must be our path
|
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.
|
4
|
+
version: 0.2.2
|
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-
|
11
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|