git-fastclone 1.0.11 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/git-fastclone.rb +28 -6
- data/lib/git-fastclone/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99f2ed04cdf72fcb80a6f5b3025ecaa34bc0d00f
|
4
|
+
data.tar.gz: e4519db820594d0983ed806e9dcd868874d7b3f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee2a68e3c0007d4d3a86f43a6f0df0d403faa98acf5fdf48315f7ef64a1c313ef08a462fa78a39f42ccd00125a8c9d7bb14a6b18b5ef7831394d2bf4eaae1358
|
7
|
+
data.tar.gz: 2a6fcf00b85f18b8fc40ab88c7aa94709414dc3601d34f68eb289e662fcdff5323e5508cefabbc63342b188ecbcce5e6145400496263ebec2ee439332acdbaae
|
data/README.md
CHANGED
data/lib/git-fastclone.rb
CHANGED
@@ -65,7 +65,7 @@ module GitFastClone
|
|
65
65
|
DEFAULT_GIT_ALLOW_PROTOCOL = 'file:git:http:https:ssh'
|
66
66
|
|
67
67
|
attr_accessor :reference_dir, :prefetch_submodules, :reference_mutex, :reference_updated,
|
68
|
-
:options, :logger, :abs_clone_path, :using_local_repo, :verbose
|
68
|
+
:options, :logger, :abs_clone_path, :using_local_repo, :verbose, :color
|
69
69
|
|
70
70
|
def initialize
|
71
71
|
# Prefetch reference repos for submodules we've seen before
|
@@ -91,14 +91,22 @@ module GitFastClone
|
|
91
91
|
self.using_local_repo = false
|
92
92
|
|
93
93
|
self.verbose = false
|
94
|
+
|
95
|
+
self.color = false
|
94
96
|
end
|
95
97
|
|
96
98
|
def run
|
99
|
+
url, path, options = parse_inputs
|
100
|
+
|
97
101
|
require_relative './git-fastclone/version'
|
98
|
-
|
102
|
+
msg = "git-fastclone #{GitFastCloneVersion::VERSION}"
|
103
|
+
if color
|
104
|
+
puts msg.yellow
|
105
|
+
else
|
106
|
+
puts msg
|
107
|
+
end
|
99
108
|
|
100
|
-
url, path
|
101
|
-
puts 'Cloning'.bold + " #{path_from_git_url(url)} to #{File.join(abs_clone_path, path)}"
|
109
|
+
puts "Cloning #{path_from_git_url(url)} to #{File.join(abs_clone_path, path)}"
|
102
110
|
Cocaine::CommandLine.environment['GIT_ALLOW_PROTOCOL'] =
|
103
111
|
ENV['GIT_ALLOW_PROTOCOL'] || DEFAULT_GIT_ALLOW_PROTOCOL
|
104
112
|
clone(url, options[:branch], path)
|
@@ -112,9 +120,11 @@ module GitFastClone
|
|
112
120
|
OptionParser.new do |opts|
|
113
121
|
opts.banner = usage
|
114
122
|
options[:branch] = nil
|
123
|
+
|
115
124
|
opts.on('-b', '--branch BRANCH', 'Checkout this branch rather than the default') do |branch|
|
116
125
|
options[:branch] = branch
|
117
126
|
end
|
127
|
+
|
118
128
|
opts.on('-v', '--verbose', 'Verbose mode') do
|
119
129
|
self.verbose = true
|
120
130
|
self.logger = Logger.new(STDOUT)
|
@@ -123,6 +133,10 @@ module GitFastClone
|
|
123
133
|
end
|
124
134
|
Cocaine::CommandLine.logger = logger
|
125
135
|
end
|
136
|
+
|
137
|
+
opts.on('-c', '--color', 'Display colored output') do
|
138
|
+
self.color = true
|
139
|
+
end
|
126
140
|
end.parse!
|
127
141
|
|
128
142
|
unless ARGV[0]
|
@@ -140,7 +154,9 @@ module GitFastClone
|
|
140
154
|
path = ARGV[1] || path_from_git_url(url)
|
141
155
|
|
142
156
|
if Dir.exist?(path)
|
143
|
-
|
157
|
+
msg = "Clone destination #{File.join(abs_clone_path, path)} already exists!"
|
158
|
+
fail msg.red if color
|
159
|
+
fail msg
|
144
160
|
end
|
145
161
|
|
146
162
|
self.reference_dir = ENV['REFERENCE_REPO_DIR'] || DEFAULT_REFERENCE_REPO_DIR
|
@@ -169,7 +185,13 @@ module GitFastClone
|
|
169
185
|
update_submodules(src_dir, url)
|
170
186
|
|
171
187
|
final_time = Time.now
|
172
|
-
|
188
|
+
|
189
|
+
msg = "Checkout of #{src_dir} took #{final_time - initial_time}s"
|
190
|
+
if color
|
191
|
+
puts msg.green
|
192
|
+
else
|
193
|
+
puts msg
|
194
|
+
end
|
173
195
|
end
|
174
196
|
|
175
197
|
def update_submodules(pwd, url)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-fastclone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Tauraso
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.4.8
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: git-clone --recursive on steroids!
|