git-fastclone 1.0.6 → 1.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66f55056583c1cef92771f601ba0328ac6b983b9
4
- data.tar.gz: de3cbb7684efbc61b6f298a4dd8a967d7145a344
3
+ metadata.gz: 7bf187b8673e91a3020f57e8c8160da9f9411b6f
4
+ data.tar.gz: a152d68f2366421d048522a436f86bfe91c189d7
5
5
  SHA512:
6
- metadata.gz: 133227b43589c4c2f4a76d81d5d90f15ab81bf73e45a4e89bfd8b456b8ac79d934009755692e33fd208eb99f5dc51a9bf380834c3579b4a5b756bc0eaf25b8f2
7
- data.tar.gz: 9eaafcef8055c66c99d49b5e8c3002fc69e2ebf8673a472c3093bad76957018e7c426db7d47c69b8605eff30d6f9526de033536fe2c9078a714acb4bd1fc6ca9
6
+ metadata.gz: 5b830ddaece88719818f84f438546c62c01ec07a5a75eea884a01b403b13d8b2c51ba2d3b93aa521c4aabf421fa5b49ff426929bed4f343a4fb0744a4ea91f1e
7
+ data.tar.gz: 721878ddc71145362d772cd8a0312a51934c109b4f54ee6039c80c85e660a4bdc852b6e9da8f112e545c451115573a480ed3dc1557b4cb55e8ed1d94b797baba
data/lib/git-fastclone.rb CHANGED
@@ -16,6 +16,7 @@ require 'optparse'
16
16
  require 'fileutils'
17
17
  require 'logger'
18
18
  require 'cocaine'
19
+ require 'colorize'
19
20
 
20
21
  # Contains helper module UrlHelper and execution class GitFastClone::Runner
21
22
  module GitFastClone
@@ -63,7 +64,7 @@ module GitFastClone
63
64
  DEFAULT_GIT_ALLOW_PROTOCOL = 'file:git:http:https:ssh'
64
65
 
65
66
  attr_accessor :reference_dir, :prefetch_submodules, :reference_mutex, :reference_updated,
66
- :options, :logger, :abs_clone_path, :using_local_repo
67
+ :options, :logger, :abs_clone_path, :using_local_repo, :verbose
67
68
 
68
69
  def initialize
69
70
  # Prefetch reference repos for submodules we've seen before
@@ -87,11 +88,13 @@ module GitFastClone
87
88
  self.abs_clone_path = Dir.pwd
88
89
 
89
90
  self.using_local_repo = false
91
+
92
+ self.verbose = false
90
93
  end
91
94
 
92
95
  def run
93
96
  url, path, options = parse_inputs
94
- logger.info("Cloning #{url} to #{path}") if logger
97
+ puts 'Cloning'.bold + " #{url} to #{File.join(abs_clone_path, path)}"
95
98
  Cocaine::CommandLine.environment['GIT_ALLOW_PROTOCOL'] =
96
99
  ENV['GIT_ALLOW_PROTOCOL'] || DEFAULT_GIT_ALLOW_PROTOCOL
97
100
  clone(url, options[:branch], path)
@@ -109,6 +112,7 @@ module GitFastClone
109
112
  options[:branch] = branch
110
113
  end
111
114
  opts.on('-v', '--verbose', 'Verbose mode') do
115
+ self.verbose = true
112
116
  self.logger = Logger.new(STDOUT)
113
117
  Cocaine::CommandLine.logger = logger
114
118
  end
@@ -129,7 +133,7 @@ module GitFastClone
129
133
  path = ARGV[1] || path_from_git_url(url)
130
134
 
131
135
  if Dir.exist?(path)
132
- fail "Clone destination #{File.join(abs_clone_path, path)} already exists!"
136
+ fail "Clone destination #{File.join(abs_clone_path, path)} already exists!".red
133
137
  end
134
138
 
135
139
  self.reference_dir = ENV['REFERENCE_REPO_DIR'] || DEFAULT_REFERENCE_REPO_DIR
@@ -158,13 +162,13 @@ module GitFastClone
158
162
  update_submodules(src_dir, url)
159
163
 
160
164
  final_time = Time.now
161
- logger.info("Checkout of #{url} took #{final_time - initial_time}s") if logger
165
+ puts "Checkout of #{src_dir} took #{final_time - initial_time}s".green
162
166
  end
163
167
 
164
168
  def update_submodules(pwd, url)
165
169
  return unless File.exist?(File.join(abs_clone_path, pwd, '.gitmodules'))
166
170
 
167
- logger.info('Updating submodules') if logger
171
+ puts 'Updating submodules...' if verbose
168
172
 
169
173
  threads = []
170
174
  submodule_url_list = []
@@ -251,7 +255,7 @@ module GitFastClone
251
255
  reference_updated[repo_name] = true
252
256
 
253
257
  rescue Cocaine::ExitStatusError => e
254
- raise e if fail_hard
258
+ raise e.red if fail_hard
255
259
  end
256
260
 
257
261
  # This command will create and bring the mirror up-to-date on-demand,
@@ -1,3 +1,3 @@
1
1
  module GitFastCloneVersion
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.8'
3
3
  end
@@ -69,7 +69,7 @@ describe GitFastClone::Runner do
69
69
  allow(cocaine_commandline_double).to receive(:run) {}
70
70
  allow(Cocaine::CommandLine).to receive(:new) { cocaine_commandline_double }
71
71
 
72
- expect(Time).to receive(:now).twice
72
+ expect(Time).to receive(:now).twice { 0 }
73
73
  expect(Cocaine::CommandLine).to receive(:new)
74
74
  expect(cocaine_commandline_double).to receive(:run)
75
75
 
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.6
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Tauraso
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: colorize
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  description: A git command that uses reference repositories and threading to quickly
29
43
  and recursively clone repositories with many nested submodules
30
44
  email:
@@ -64,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
78
  version: '0'
65
79
  requirements: []
66
80
  rubyforge_project:
67
- rubygems_version: 2.4.8
81
+ rubygems_version: 2.2.2
68
82
  signing_key:
69
83
  specification_version: 4
70
84
  summary: git-clone --recursive on steroids!