lazy_fork 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +2 -2
- data/bin/git-fork +5 -0
- data/lazy_fork.gemspec +1 -1
- data/lib/lazy_fork/version.rb +1 -1
- data/lib/lazy_fork.rb +27 -20
- metadata +3 -3
- data/bin/lazy_fork +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5934cf12a623be2b0ef8b024d836020549027818
|
4
|
+
data.tar.gz: 89b873a8f2c4fdff9e90df3daef9b342cfd31c0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72baa5e093e5ce2f4e9b6d3e0646aa7d7c5d02214d19b06b06dbac8a0294114f46ba0b1b869d05b876b2ca1ff4b691f48d29d7b005d1417a25f2f2da95495404
|
7
|
+
data.tar.gz: 1a13b67b0432a9333d1713dfe8b076899b62c3c0e7a58bd4f3fd43edeef281ac8187b5f4cc82491de4cfb21c50c1c7c1fd8f57bfb8dee7125f094d6b21a6b297
|
data/README.md
CHANGED
@@ -10,11 +10,11 @@ Fork and clone your fork all without leaving the comfort of your terminal. :reli
|
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
13
|
-
$
|
13
|
+
$ git fork <owner>/<repo>
|
14
14
|
|
15
15
|
For example, if you wanted to fork this repo:
|
16
16
|
|
17
|
-
$
|
17
|
+
$ git fork CGA1123/lazy_fork
|
18
18
|
|
19
19
|
## Development
|
20
20
|
|
data/bin/git-fork
ADDED
data/lazy_fork.gemspec
CHANGED
data/lib/lazy_fork/version.rb
CHANGED
data/lib/lazy_fork.rb
CHANGED
@@ -1,55 +1,62 @@
|
|
1
1
|
require "lazy_fork/version"
|
2
|
-
|
3
|
-
require "optparse"
|
4
2
|
require "io/console"
|
3
|
+
require "octokit"
|
5
4
|
|
6
5
|
module LazyFork
|
7
6
|
class LazyForker
|
8
7
|
def initialize(options)
|
9
8
|
@options = options
|
10
|
-
@client = nil
|
11
9
|
|
12
|
-
# tell the user
|
13
|
-
puts "You lazy forker...
|
10
|
+
# tell the user they're being a lazy fork
|
11
|
+
puts "You lazy forker..."
|
14
12
|
|
15
|
-
unless Dir.exist?
|
13
|
+
unless Dir.exist?(LAZY_FORK_HOME)
|
16
14
|
puts "Creating #{LAZY_FORK_HOME}..."
|
17
15
|
Dir.mkdir LAZY_FORK_HOME
|
18
16
|
end
|
19
|
-
end
|
20
17
|
|
21
|
-
def be_lazy
|
22
18
|
authenticate_client
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
end
|
20
|
+
|
21
|
+
def fork
|
22
|
+
clone_repo(fork_repo(get_repo(ARGV.first)), ARGV.last)
|
23
|
+
end
|
24
|
+
|
25
|
+
def fork?(repo)
|
26
|
+
@client.repository(repo)[:fork]
|
27
|
+
end
|
28
|
+
|
29
|
+
def source(repo)
|
30
|
+
source_slug = @client.repository(repo)[:source][:full_name]
|
31
|
+
Octokit::Repository.new(source_slug)
|
26
32
|
end
|
27
33
|
|
28
34
|
private
|
29
35
|
|
30
|
-
def fork_repo
|
36
|
+
def fork_repo(repo)
|
31
37
|
puts "Forking..."
|
32
|
-
fork_repo = @client.fork(
|
33
|
-
|
38
|
+
fork_repo = @client.fork(repo)
|
39
|
+
Octokit::Repository.new(fork_repo[:full_name])
|
34
40
|
end
|
35
41
|
|
36
|
-
def clone_repo
|
37
|
-
|
38
|
-
`git clone #{@forked_repo.url} #{ARGV[1]}`
|
42
|
+
def clone_repo(repo, dest=".")
|
43
|
+
`git clone #{repo.url} #{dest}`
|
39
44
|
end
|
40
45
|
|
41
46
|
def get_repo(repo)
|
42
47
|
begin
|
43
|
-
|
48
|
+
repo = Octokit::Repository.new(repo)
|
44
49
|
rescue Octokit::InvalidRepository
|
45
50
|
puts "Invalid Repository: use owner/name format!"
|
46
51
|
abort
|
47
52
|
end
|
48
53
|
|
49
|
-
unless @client.repository?(
|
50
|
-
puts "Repo #{
|
54
|
+
unless @client.repository?(repo)
|
55
|
+
puts "Repo #{repo.to_s} could not be found."
|
51
56
|
abort
|
52
57
|
end
|
58
|
+
|
59
|
+
repo
|
53
60
|
end
|
54
61
|
|
55
62
|
def authenticate_client
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazy_fork
|
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
|
- Christian Gregg
|
@@ -70,7 +70,7 @@ description:
|
|
70
70
|
email:
|
71
71
|
- c_arlt@hotmail.com
|
72
72
|
executables:
|
73
|
-
-
|
73
|
+
- git-fork
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
@@ -82,7 +82,7 @@ files:
|
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
84
|
- bin/console
|
85
|
-
- bin/
|
85
|
+
- bin/git-fork
|
86
86
|
- bin/setup
|
87
87
|
- lazy_fork.gemspec
|
88
88
|
- lib/lazy_fork.rb
|