git-copy 0.1.0 → 0.2.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.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/bin/git-copy +20 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2FiN2RhNGUzNzY0MWVkNTM2OTZkYjNmZTdjYjgzMmI4YTlkNmY5ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmY4ZjI1NGRhZWQ3MjI2YzhiOTM2MWVmMzdiYzMwMTllOTQ1YjQ4Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjQ3MDQ2MjNlMzM2MDU2M2Q2Y2E4MjllZDBjZjg2NDMzNzVhMTI4YmFhYzBm
|
10
|
+
NTUxODA1NGJiZTBhYjJkMzk3ZmY0M2E0NzEwYjY5OTZmMzg4ZmM3YmMyMTQy
|
11
|
+
OTM2NzA4MTU2Y2NmMDMzZDA5MDE5ZjhkMWZmZjkxMDNjNmMwNGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGM1Nzk1YmMwYmY3MGQ4ZmI0Y2I5ODFmZjIwYzBmMGU2OTBlMDgxYmI5NDQ5
|
14
|
+
NDJhYjQyN2E0N2RiMmIwOTJkNzFhZTcxYTI3NjRjYzFhMTUyODg1M2I3ODkz
|
15
|
+
NzU1NmY2MmMyNjhiYTk2MDY2YThmMjllM2M5NWRmOGQyMTE3NmU=
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
## git-copy
|
2
2
|
|
3
|
-
> Git plugin for copy remote git repo to another remote destination
|
3
|
+
> Git plugin for copy remote/local git repo to another remote/local destination
|
4
4
|
|
5
|
-
[]()
|
5
|
+
[](https://rubygems.org/gems/git-copy)
|
6
6
|
[](https://travis-ci.org/cybertk/git-copy)
|
7
7
|
|
8
8
|
## Getting Started
|
data/bin/git-copy
CHANGED
@@ -3,19 +3,33 @@
|
|
3
3
|
|
4
4
|
require "optparse"
|
5
5
|
require "tmpdir"
|
6
|
+
require "addressable/uri"
|
6
7
|
|
7
8
|
def GitCopy(src, dst)
|
8
9
|
# Copy a remote git repo to another remote destination
|
9
10
|
#
|
10
11
|
# Example:
|
12
|
+
# >> GitCopy("https://github.com/cybertk/git-copy", "https://bitbucket.com/mirror.git")
|
11
13
|
# >> GitCopy("https://github.com/cybertk/git-copy", "mirror.git")
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
uri = Addressable::URI.parse(dst)
|
15
|
+
|
16
|
+
# Convert to absolute path for local path
|
17
|
+
dst = File.absolute_path(dst) unless uri.scheme
|
18
|
+
|
19
|
+
if uri.scheme or File.exist? dst
|
20
|
+
|
21
|
+
Dir.mktmpdir("git-copy-") do |dir|
|
22
|
+
# Clone source into temp working dir
|
23
|
+
`git clone --bare #{src} #{dir}`
|
24
|
+
return if $? != 0
|
16
25
|
|
17
|
-
|
18
|
-
|
26
|
+
Dir.chdir(dir)
|
27
|
+
`git push -f --mirror #{dst}`
|
28
|
+
return if $? != 0
|
29
|
+
end
|
30
|
+
else
|
31
|
+
# Copy to local path
|
32
|
+
`git clone --bare #{src} #{dst}`
|
19
33
|
return if $? != 0
|
20
34
|
end
|
21
35
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-copy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quanlong He
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Git plugin for copy remote git repo to another remote destination
|
13
|
+
description: Git plugin for copy remote/local git repo to another remote/local destination
|
14
14
|
email: kyan.ql.he@gmail.com
|
15
15
|
executables:
|
16
16
|
- git-copy
|
@@ -43,5 +43,5 @@ rubyforge_project:
|
|
43
43
|
rubygems_version: 2.4.5
|
44
44
|
signing_key:
|
45
45
|
specification_version: 4
|
46
|
-
summary: Copy
|
46
|
+
summary: Copy git repo to another destination
|
47
47
|
test_files: []
|