gemfury 0.10.0 → 0.11.0.rc1
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/lib/gemfury/command/app.rb +107 -11
- data/lib/gemfury/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d70b381f57a4b0bdaa62c9cf441eaa42bbd5c0fbb6ff3317ef2a396fbbf65217
|
4
|
+
data.tar.gz: 4a2869a2f1b62c3bbb9326dc4dcf73b8086a0ac4d4f6a75925c90a4fb8e8fe75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c7eb18d8f1660c10ef60c7eabe1f218ab02ccbdc28d7f79d59f15d0d827452ef53b238cc7d4e523be9b38f6f10626142dfca7ab789e3d55e9c7d535d4311923
|
7
|
+
data.tar.gz: 2f135047469572a771c67a24b47d113b3710154ed421319148e5439bf8b7196854d8d9366ee6ab5cdb8474b9ed36f25761bbdcbea85de279e5a21508e99273a6
|
data/lib/gemfury/command/app.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'progressbar'
|
2
|
+
require 'delegate'
|
3
|
+
|
1
4
|
class Gemfury::Command::App < Thor
|
2
5
|
include Gemfury::Command::Authorization
|
3
6
|
UserAgent = "Gemfury CLI #{Gemfury::VERSION}".freeze
|
@@ -15,6 +18,7 @@ class Gemfury::Command::App < Thor
|
|
15
18
|
|
16
19
|
### PACKAGE MANAGEMENT ###
|
17
20
|
option :public, :type => :boolean, :desc => "Create as public package"
|
21
|
+
option :quiet, :type => :boolean, :aliases => "-q", :desc => "Do not show progress bar", :default => false
|
18
22
|
desc "push FILE", "Upload a new version of a package"
|
19
23
|
def push(*gems)
|
20
24
|
with_checks_and_rescues do
|
@@ -46,10 +50,10 @@ class Gemfury::Command::App < Thor
|
|
46
50
|
shell.say "\n*** #{gem_name.capitalize} Versions ***\n\n"
|
47
51
|
|
48
52
|
va = []
|
49
|
-
va = [ %w{ version uploaded
|
53
|
+
va = [ %w{ version uploaded_by uploaded } ]
|
50
54
|
versions.each do |v|
|
51
|
-
uploaded = Time.parse(v['created_at']).
|
52
|
-
va << [ v['version'],
|
55
|
+
uploaded = time_ago(Time.parse(v['created_at']).getlocal)
|
56
|
+
va << [ v['version'], v['created_by']['name'], uploaded ]
|
53
57
|
end
|
54
58
|
|
55
59
|
shell.print_table(va)
|
@@ -114,16 +118,25 @@ class Gemfury::Command::App < Thor
|
|
114
118
|
desc "sharing", "List collaborators"
|
115
119
|
def sharing
|
116
120
|
with_checks_and_rescues do
|
117
|
-
|
121
|
+
account_info = client.account_info
|
122
|
+
me = account_info['username']
|
123
|
+
|
118
124
|
collaborators = client.list_collaborators
|
119
125
|
if collaborators.empty?
|
120
|
-
shell.say
|
126
|
+
shell.say %Q(You (#{me}) are the only collaborator\n), :green
|
121
127
|
else
|
122
128
|
shell.say %Q(\n*** Collaborators for "#{me}" ***\n), :green
|
123
|
-
|
124
|
-
|
129
|
+
|
130
|
+
va = [ %w{ username permission } ]
|
131
|
+
|
132
|
+
if account_info['type'] == 'user'
|
133
|
+
va << [ me, 'owner' ]
|
134
|
+
end
|
135
|
+
|
136
|
+
collaborators.each { |c| va << [ c['username'], c['permission'] ] }
|
137
|
+
|
138
|
+
shell.print_table(va)
|
125
139
|
end
|
126
|
-
shell.say "\n"
|
127
140
|
end
|
128
141
|
end
|
129
142
|
|
@@ -248,6 +261,10 @@ private
|
|
248
261
|
g.is_a?(String) ? File.new(g) : g rescue nil
|
249
262
|
end.compact
|
250
263
|
|
264
|
+
if !options[:quiet] && !shell.mute? && $stdout.tty?
|
265
|
+
files = files.map { |g| ProgressIO.new(g) }
|
266
|
+
end
|
267
|
+
|
251
268
|
if files.empty?
|
252
269
|
die!("Problem: No valid packages found", nil, command)
|
253
270
|
end
|
@@ -259,11 +276,23 @@ private
|
|
259
276
|
|
260
277
|
error_ex = nil
|
261
278
|
|
262
|
-
# Let's get uploading
|
263
279
|
files.each do |file|
|
280
|
+
show_bar = file.is_a?(ProgressIO) && file.show_bar?
|
281
|
+
title = "Uploading #{File.basename(file.path)} "
|
282
|
+
|
264
283
|
begin
|
265
|
-
|
266
|
-
|
284
|
+
if show_bar
|
285
|
+
begin
|
286
|
+
client.push_gem(file, push_options)
|
287
|
+
ensure
|
288
|
+
shell.say "\e[A\e[0K", nil, false
|
289
|
+
shell.say title
|
290
|
+
end
|
291
|
+
else
|
292
|
+
shell.say title
|
293
|
+
client.push_gem(file, push_options)
|
294
|
+
end
|
295
|
+
|
267
296
|
shell.say "- done"
|
268
297
|
rescue Gemfury::CorruptGemFile => e
|
269
298
|
shell.say "- problem processing this package", :red
|
@@ -286,10 +315,77 @@ private
|
|
286
315
|
end
|
287
316
|
end
|
288
317
|
|
318
|
+
C50K = 50000
|
319
|
+
|
320
|
+
class ProgressIO < SimpleDelegator
|
321
|
+
attr_reader :content_type, :original_filename, :local_path
|
322
|
+
|
323
|
+
def initialize(filename_or_io, content_type = 'application/octet-stream', fname = nil)
|
324
|
+
io = filename_or_io
|
325
|
+
local_path = ''
|
326
|
+
|
327
|
+
if io.respond_to? :read
|
328
|
+
local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : 'local.path'
|
329
|
+
else
|
330
|
+
io = File.open(filename_or_io)
|
331
|
+
local_path = filename_or_io
|
332
|
+
end
|
333
|
+
|
334
|
+
fname ||= local_path
|
335
|
+
|
336
|
+
@content_type = content_type
|
337
|
+
@original_filename = File.basename(fname)
|
338
|
+
@local_path = local_path
|
339
|
+
|
340
|
+
if io.respond_to? :size
|
341
|
+
filesize = io.size
|
342
|
+
else
|
343
|
+
filesize = io.stat.size
|
344
|
+
end
|
345
|
+
|
346
|
+
if filesize > C50K
|
347
|
+
title = 'Uploading %s ' % File.basename(fname)
|
348
|
+
@bar = ProgressBar.create(:title => title, :total => filesize)
|
349
|
+
else
|
350
|
+
@bar = nil
|
351
|
+
end
|
352
|
+
|
353
|
+
super(io)
|
354
|
+
end
|
355
|
+
|
356
|
+
def show_bar?
|
357
|
+
@bar != nil
|
358
|
+
end
|
359
|
+
|
360
|
+
def read(length)
|
361
|
+
buf = __getobj__.read(length)
|
362
|
+
unless @bar.nil? || buf.nil?
|
363
|
+
@bar.progress += buf.bytesize
|
364
|
+
end
|
365
|
+
|
366
|
+
buf
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
289
370
|
def die!(msg, err = nil, command = nil)
|
290
371
|
shell.say msg, :red
|
291
372
|
help(command) if command
|
292
373
|
shell.say %Q(#{err.class.name}: #{err}\n#{err.backtrace.join("\n")}) if err && ENV['DEBUG']
|
293
374
|
exit(1)
|
294
375
|
end
|
376
|
+
|
377
|
+
def time_ago(tm)
|
378
|
+
ago = tm.strftime('%F %R')
|
379
|
+
|
380
|
+
in_secs = Time.now - tm
|
381
|
+
if in_secs < 60
|
382
|
+
ago += ' (~ %ds ago)' % in_secs
|
383
|
+
elsif in_secs < 3600
|
384
|
+
ago += ' (~ %sm ago)' % (in_secs / 60).floor
|
385
|
+
elsif in_secs < (3600 * 24)
|
386
|
+
ago += ' (~ %sh ago)' % (in_secs / 3600).floor
|
387
|
+
end
|
388
|
+
|
389
|
+
ago
|
390
|
+
end
|
295
391
|
end
|
data/lib/gemfury/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemfury
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Rykov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -104,6 +104,20 @@ dependencies:
|
|
104
104
|
- - "<"
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: 2.1.0.pre
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: progressbar
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.10.1
|
114
|
+
type: :runtime
|
115
|
+
prerelease: false
|
116
|
+
version_requirements: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.10.1
|
107
121
|
description: 'Hosted repo for your public and private packages at https://gemfury.com
|
108
122
|
|
109
123
|
'
|
@@ -165,9 +179,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
179
|
version: '0'
|
166
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
181
|
requirements:
|
168
|
-
- - "
|
182
|
+
- - ">"
|
169
183
|
- !ruby/object:Gem::Version
|
170
|
-
version:
|
184
|
+
version: 1.3.1
|
171
185
|
requirements: []
|
172
186
|
rubyforge_project:
|
173
187
|
rubygems_version: 2.7.8
|