dorian-replace 0.2.0 → 0.3.1
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/bin/replace +2 -1
- data/lib/dorian/replace.rb +5 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc155b33a4a42fc1a09cdfc4f08b34c41d89b0f805e14d1f95f0be63be387b27
|
4
|
+
data.tar.gz: e8c3d02effd208143fc3dd98b88fe951ab44811407ef07e30e320ed8f88b7018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8820c855459dee2fc4a78d46dac3a68e64c72a97a22644e4053cb462a509eec99e13665fbe099718c7ced08507debfc6c8d06829bb44f7bd747f5e3ae85ee946
|
7
|
+
data.tar.gz: 115b62ed38be1514511d14aa6a28ac5be29feeebd9925400f3e5afbfdca05e56c728d61e1416bb8536bb87d5c1ee104cbfec3249bf842945c16231d2eb298f57
|
data/bin/replace
CHANGED
data/lib/dorian/replace.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dorian
|
2
4
|
class Replace
|
3
5
|
def self.run
|
4
|
-
if ARGV.size < 2
|
6
|
+
if ARGV.size < 2 || ARGV[0] == "--help" || ARGV[0] == "-h"
|
5
7
|
puts "USAGE: replace FROM TO FILES..."
|
6
8
|
puts "USAGE: ... | replace FROM TO"
|
7
9
|
exit
|
@@ -9,10 +11,11 @@ module Dorian
|
|
9
11
|
|
10
12
|
from = ARGV[0]
|
11
13
|
to = ARGV[1]
|
12
|
-
files = ARGV.size > 2 ? ARGV[2
|
14
|
+
files = (ARGV.size > 2) ? ARGV[2..] : $stdin.each_line.to_a.map(&:strip)
|
13
15
|
|
14
16
|
files.each do |file|
|
15
17
|
next if File.directory?(file)
|
18
|
+
|
16
19
|
File.write(file, File.read(file).gsub(from, to))
|
17
20
|
end
|
18
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorian-replace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Replace some string with some other string from the files provided
|
@@ -22,10 +22,11 @@ extra_rdoc_files: []
|
|
22
22
|
files:
|
23
23
|
- bin/replace
|
24
24
|
- lib/dorian/replace.rb
|
25
|
-
homepage: https://github.com/
|
25
|
+
homepage: https://github.com/dorianmariecom/replace
|
26
26
|
licenses:
|
27
27
|
- MIT
|
28
|
-
metadata:
|
28
|
+
metadata:
|
29
|
+
rubygems_mfa_required: 'true'
|
29
30
|
post_install_message:
|
30
31
|
rdoc_options: []
|
31
32
|
require_paths:
|
@@ -41,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
42
|
- !ruby/object:Gem::Version
|
42
43
|
version: '0'
|
43
44
|
requirements: []
|
44
|
-
rubygems_version: 3.
|
45
|
+
rubygems_version: 3.5.3
|
45
46
|
signing_key:
|
46
47
|
specification_version: 4
|
47
48
|
summary: Replace some string with some other string from the files provided
|