dorian-rename 0.0.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 +7 -0
- data/bin/rename +22 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a709696ff4c3ef5776e4c3a0e96bfc5f78ac97df522e277410ccfc4b933ff7b0
|
4
|
+
data.tar.gz: 3f2df6f028f533346fcc21e7632abdaee1719ca17dd135987425576d40e92198
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28f234ae92e364fd238c2f1762af3bed32eb1b97669831a0d85719c14a0b38f3fd739ac06613841748a2fd315397c6b3f883c959af0c55162b9479b6492185c7
|
7
|
+
data.tar.gz: 1b23c4065bfe29385cfa69be586d1afc7b5b65c22c3e251ccdf4a1f5f4a96ab7c732a984db83cfc0d471d72c5ecee3c71c15cdfa4ae97126c05c6782e771ec3e
|
data/bin/rename
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
if ARGV.size < 3 || ARGV[0] == "--help" || ARGV[0] == "-h"
|
5
|
+
puts "USAGE: replace FROM TO FILES..."
|
6
|
+
puts "USAGE: ... | replace FROM TO"
|
7
|
+
exit
|
8
|
+
end
|
9
|
+
|
10
|
+
def rename(old, new)
|
11
|
+
if old != new
|
12
|
+
puts "#{old} -> #{new}"
|
13
|
+
File.rename(old, new)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
from = ARGV[0]
|
18
|
+
to = ARGV[1]
|
19
|
+
files = ARGV[2..]
|
20
|
+
directories = files.select { |file| File.directory?(file) }
|
21
|
+
(files - directories).each { |file| rename(file, file.gsub(from, to)) }
|
22
|
+
directories.each { |directory| rename(directory, directory.gsub(from, to)) }
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dorian-rename
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dorian Marié
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-08-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |-
|
14
|
+
Rename files
|
15
|
+
|
16
|
+
e.g. `rename "cool" "coolest" *.md`
|
17
|
+
email: dorian@dorianmarie.com
|
18
|
+
executables:
|
19
|
+
- rename
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- bin/rename
|
24
|
+
homepage: https://github.com/dorianmariecom/dorian-rename
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata:
|
28
|
+
rubygems_mfa_required: 'true'
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubygems_version: 3.5.11
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Rename files
|
48
|
+
test_files: []
|