GitFlone 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/gitFlone +2 -0
- data/lib/gitFlone.rb +49 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fa82c1cba7ab4d31a6226af89b167365f387d195
|
4
|
+
data.tar.gz: 1c19b6ad04d384413177df0b1db4fd99838aef8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d863493660fcb0e689cb472e0cdfdf99fd779a7b9e6254e2cfd6d2bb72f56c29595f58965241ab25ef953ff5338cd559013c059ae58b6949151591648f99b54a
|
7
|
+
data.tar.gz: 1641145da8c6c635d3d2215a0d1e610312829aef79dc954a9d4368b4360058d8fa96441b2fd8f2b133a4411eca118ad706a75a7e5a0f7e0316fda89266f1c51a
|
data/bin/gitFlone
ADDED
data/lib/gitFlone.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
def fork(user, source,repoName)
|
2
|
+
shell %Q[curl -u '#{user}' https://api.github.com/repos/#{source}/#{repoName}/forks -d '{}']
|
3
|
+
end
|
4
|
+
|
5
|
+
def clone (user,repoName, branch="Feature")
|
6
|
+
shell"git clone git@github.com:#{user}/#{repoName}.git"
|
7
|
+
Dir.chdir("#{repoName}")
|
8
|
+
shell %Q[git checkout -b #{branch}]
|
9
|
+
shell %Q[git push origin #{branch}]
|
10
|
+
end
|
11
|
+
|
12
|
+
def pull (dummycommit="")
|
13
|
+
if dummycommit.length > 0
|
14
|
+
shell %Q[touch #{dummycommit}]
|
15
|
+
shell %Q[git add #{dummycommit}]
|
16
|
+
shell %Q[git commit -am "Initial #{@branch} commit"]
|
17
|
+
shell %Q[git push origin #{@branch}]
|
18
|
+
end
|
19
|
+
shell %Q[open https://github.com/#{@user}/#{@repoName}/compare/#{@branch}?expand=1]
|
20
|
+
end
|
21
|
+
|
22
|
+
def shell (command)
|
23
|
+
puts `#{command}`
|
24
|
+
end
|
25
|
+
|
26
|
+
def checkArg (pattern, string)
|
27
|
+
values = string.scan(pattern).flatten.uniq
|
28
|
+
raise ArgumentError, "Argument is invalid: #{string}" unless values.length==1
|
29
|
+
#puts "Found #{values.first}"
|
30
|
+
return values.first
|
31
|
+
end
|
32
|
+
|
33
|
+
def run
|
34
|
+
@user = ARGV[0]
|
35
|
+
@gitdirectory = ARGV[1].split(":").last
|
36
|
+
@branch = ARGV[2].nil? ? "Feature" : ARGV[2]
|
37
|
+
@source = checkArg(%r[(?<=:)(\S+)(?=\/)], ARGV[1])
|
38
|
+
@repoName = checkArg(%r[(?<=\/)(\S+)(?=\.)],ARGV[1])
|
39
|
+
|
40
|
+
fork(@user,@source,@repoName)
|
41
|
+
clone(@user,@repoName,@branch)
|
42
|
+
|
43
|
+
puts "Create an initial commit for pull request?"
|
44
|
+
puts "If so, provide a value for dummy pull request or leave blank to skip:"
|
45
|
+
dummy = STDIN.gets.chomp
|
46
|
+
pull(dummy)
|
47
|
+
end
|
48
|
+
|
49
|
+
run
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: GitFlone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Chang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Fork a github repository, the clone it locally with a new branch
|
14
|
+
email: kevin.w.chang@gmail.com
|
15
|
+
executables:
|
16
|
+
- gitFlone
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/gitFlone
|
21
|
+
- lib/gitFlone.rb
|
22
|
+
homepage: http://rubygems.org/gems/GitFlone
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.2.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Fork & clone a repository from the Terminal
|
46
|
+
test_files: []
|