git-copy 0.1.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.
Files changed (5) hide show
  1. checksums.yaml +15 -0
  2. data/LICENSE +22 -0
  3. data/README.md +22 -0
  4. data/bin/git-copy +45 -0
  5. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzQ3MThmNjllNzEzNzdiYjM4OGNlMzY5OWQyNGIxNTEzNWFlMGJmZg==
5
+ data.tar.gz: !binary |-
6
+ MmQxMDNlMmM4NDEzZmNjMjM1Mjk3OTUzNzdkYzcxNzM2MjNhZjg4MA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTM1NDk5MGYwODdlZGM4NWQ4YWVjNjI5YTRmYTBhNTUxOTlkYTZiNDBmNGRm
10
+ YWY1NzkwMGMyZTU5OTRjNWIyMTdlZTZmYmM0NWVjMTk3NmE3NTBkZDlhZGFm
11
+ ZWRjNDdhZWM0ZTdmNzYxMjNhOGNjODgyMWJkMmU4ZTc3ZjBiYTQ=
12
+ data.tar.gz: !binary |-
13
+ YTcxMzViYjBiMTM1NmI4MGQ0NGUwOTY5MWE0YzNjOGI3NGU0MTM4ZWFjMmZh
14
+ MjZiNzBlNDg4NzNlODgyNmQyMmE2NTg5YjY1NTJjYmM4NzY1Y2JkNGE5YTcy
15
+ NmE4YTUxNDViOTM1OTAyNTI5NzNhMTJkZDAyNTc1ZmNmZDEyOTU=
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ ## git-copy
2
+
3
+ > Git plugin for copy remote git repo to another remote destination
4
+
5
+ [![Gem](https://img.shields.io/gem/v/git-copy.svg)]()
6
+ [![Build Status](https://travis-ci.org/cybertk/git-copy.svg?branch=master)](https://travis-ci.org/cybertk/git-copy)
7
+
8
+ ## Getting Started
9
+
10
+ sudo gem install git-copy
11
+ git copy https://github.com/cybertk/git-copy.git https://github.com/cybertk/git-copy.git
12
+
13
+ ### Examples
14
+
15
+ Copy this repo to a local hosted git server
16
+
17
+ git init --bare git-copy.git
18
+ git copy https://github.com/cybertk/git-copy.git $PWD/git-copy.git
19
+
20
+ ## Contribution
21
+
22
+ Any contribution is more then welcome!
data/bin/git-copy ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+
4
+ require "optparse"
5
+ require "tmpdir"
6
+
7
+ def GitCopy(src, dst)
8
+ # Copy a remote git repo to another remote destination
9
+ #
10
+ # Example:
11
+ # >> GitCopy("https://github.com/cybertk/git-copy", "mirror.git")
12
+ Dir.mktmpdir("git-copy") do |dir|
13
+ # Clone source into temp working dir
14
+ `git clone --bare #{src} #{dir}`
15
+ return if $? != 0
16
+
17
+ Dir.chdir(dir)
18
+ `git push -f --mirror #{dst}`
19
+ return if $? != 0
20
+ end
21
+
22
+ end
23
+
24
+ options = {}
25
+ optparse = OptionParser.new do |opts|
26
+ opts.banner = "Usage: git copy <source_repo> <destination_repo>"
27
+ opts.on("-h", "--help", "Display this screen") do
28
+ puts opts
29
+ exit
30
+ end
31
+
32
+ opts.on_tail("--version", "Show version") do
33
+ puts ::Version.join(".")
34
+ exit
35
+ end
36
+
37
+ if ARGV.size != 2 then
38
+ puts "You must specify source and destination repositories."
39
+ puts ""
40
+ puts opts
41
+ exit
42
+ end
43
+ end.parse!
44
+
45
+ GitCopy(ARGV[0], ARGV[1])
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-copy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Quanlong He
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Git plugin for copy remote git repo to another remote destination
14
+ email: kyan.ql.he@gmail.com
15
+ executables:
16
+ - git-copy
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE
21
+ - README.md
22
+ - bin/git-copy
23
+ homepage: https://github.com/cybertk/git-copy
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.4.5
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Copy remote git repo to another remote destination
47
+ test_files: []