git-gsub-files 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -2
- data/git-gsub-files.gemspec +2 -2
- data/lib/git/gsub/files.rb +9 -6
- data/lib/git/gsub/files/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7452d48748da21a0e31970436995377f2b62c6d6
|
4
|
+
data.tar.gz: e9e4a6bdce5f7ba724b018ed87da973d0f394f30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b3c85a259c72cf53b88398bbfc9de8ec056a4d6364a581035bb57a0083e5d725e883f6589badee2f724ef1a667251cea44614a45d094f84bf98a5af0bf5ff29
|
7
|
+
data.tar.gz: 1dea98cb684e104425af9520aea3a55a31e38d5a1896fcb63a9bdc6a25ff3e1d627db525014a41401495ced8f10541bbbcb57e5ee721ec7408fe52f6e5025a7f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# git-gsub-files
|
2
2
|
|
3
|
-
A Git subcommand to `
|
3
|
+
A Git subcommand to `mv` file like gsub in a repository
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -8,10 +8,36 @@ A Git subcommand to `git mv` file like gsub in a repository
|
|
8
8
|
$ git gsub-files READ WRITE
|
9
9
|
$ git status
|
10
10
|
On branch master
|
11
|
+
Your branch is up-to-date with 'origin/master'.
|
12
|
+
Changes not staged for commit:
|
13
|
+
(use "git add/rm <file>..." to update what will be committed)
|
14
|
+
(use "git checkout -- <file>..." to discard changes in working directory)
|
15
|
+
|
16
|
+
deleted: README.md
|
17
|
+
|
18
|
+
Untracked files:
|
19
|
+
(use "git add <file>..." to include in what will be committed)
|
20
|
+
|
21
|
+
WRITEME.md
|
22
|
+
|
23
|
+
no changes added to commit (use "git add" and/or "git commit -a")
|
24
|
+
```
|
25
|
+
|
26
|
+
### `--add` option
|
27
|
+
|
28
|
+
Run `git mv` instead of `mv`.
|
29
|
+
|
30
|
+
```sh
|
31
|
+
$ git gsub-files READ WRITE --add
|
32
|
+
$ git status
|
33
|
+
On branch master
|
34
|
+
Your branch is up-to-date with 'origin/master'.
|
11
35
|
Changes to be committed:
|
12
36
|
(use "git reset HEAD <file>..." to unstage)
|
13
37
|
|
14
|
-
|
38
|
+
renamed: README.md -> WRITEME.md
|
39
|
+
|
40
|
+
no changes added to commit (use "git add" and/or "git commit -a")
|
15
41
|
```
|
16
42
|
|
17
43
|
## Instration
|
data/git-gsub-files.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['k1LoW']
|
10
10
|
spec.email = ['k1lowxb@gmail.com']
|
11
11
|
|
12
|
-
spec.summary = 'A Git subcommand to `
|
13
|
-
spec.description = 'A Git subcommand to `
|
12
|
+
spec.summary = 'A Git subcommand to `mv` file like gsub in a repository'
|
13
|
+
spec.description = 'A Git subcommand to `mv` file like gsub in a repository'
|
14
14
|
spec.homepage = 'https://github.com/k1LoW/git-gsub-files'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
data/lib/git/gsub/files.rb
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
require 'git/gsub/files/version'
|
2
2
|
require 'shellwords'
|
3
|
+
require 'optparse'
|
3
4
|
|
4
5
|
module Git
|
5
6
|
module Gsub
|
6
7
|
module Files
|
7
8
|
def self.run
|
8
|
-
|
9
|
-
|
9
|
+
params = ARGV.getopts('av', 'add', 'version')
|
10
|
+
if params['v'] || params['version']
|
10
11
|
version
|
11
12
|
else
|
12
|
-
|
13
|
+
command = 'mv'
|
14
|
+
command = 'git mv' if params['a'] || params['add']
|
15
|
+
gsub_files(command, *ARGV)
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
16
19
|
def self.version
|
17
|
-
puts Git::Gsub::VERSION
|
20
|
+
puts Git::Gsub::Files::VERSION
|
18
21
|
end
|
19
22
|
|
20
|
-
def self.gsub_files(*args)
|
23
|
+
def self.gsub_files(command, *args)
|
21
24
|
from, to, path, = args.map do |arg|
|
22
25
|
Shellwords.escape arg if arg
|
23
26
|
end
|
@@ -27,7 +30,7 @@ module Git
|
|
27
30
|
(`git ls-files #{path}`).each_line.map(&:chomp).map do |file|
|
28
31
|
next unless File.basename(file).match(from)
|
29
32
|
to_file = File.dirname(file) + '/' + File.basename(file).gsub(from, to)
|
30
|
-
system
|
33
|
+
system %|#{command} -v #{file} #{to_file}|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-gsub-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: A Git subcommand to `
|
97
|
+
description: A Git subcommand to `mv` file like gsub in a repository
|
98
98
|
email:
|
99
99
|
- k1lowxb@gmail.com
|
100
100
|
executables:
|
@@ -139,5 +139,5 @@ rubyforge_project:
|
|
139
139
|
rubygems_version: 2.2.2
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
|
-
summary: A Git subcommand to `
|
142
|
+
summary: A Git subcommand to `mv` file like gsub in a repository
|
143
143
|
test_files: []
|