vpsadmin-client 2.9.1 → 3.0.0.master.20190517.pre.0.3ab5ddfe

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 90e17e09d7317f2d4b4aaaaca892b856915c91b3
4
- data.tar.gz: 5dd5964a98e6b8db90c85845209aa7c5221add94
2
+ SHA256:
3
+ metadata.gz: e88be4aa43616fcca48c5a44a608568bbe5a17a820b601a4750b559e306eb789
4
+ data.tar.gz: 93a4a8389faa06c619633113e3992deb7cbea545e0b5ee1814344d3d01f5fd83
5
5
  SHA512:
6
- metadata.gz: 002f5d64cf963a61ad0bea921e0299564e854c07585e513e0e0c29aef7722b7873d32b735b0260dc4afe34bac3ecd9d5beb45348cc42d12c11723c16ff98d12a
7
- data.tar.gz: f4ce6dfd54221d6ec88b47ca34315a44f1e3777dd10a2d138ce1ce79fb7d09dbfafbf11d13bd2c271a5e6b57731594e661542b3977a1b0543b442d68787d41bf
6
+ metadata.gz: 431461ad20a69847e7d4c52d0731b0691b9745e4f16e448e1bbcfbe43c44cfd8bbe16ca7c9fe2257a9fc285b1b97fbebff8821f610fb8bc409cb3ec7fc5c7443
7
+ data.tar.gz: 9adafa55fa0e00c99159f60a049014b866eb41a4a7bad8f4a4b84efd9bddede771d4d7bfbeeb9ed5aabd20d035165b79269df800a53e017920c895038bda8717
data/CHANGELOG CHANGED
@@ -1,6 +1,3 @@
1
- * Mon Nov 27 2017 - version 2.9.1
2
- - Updated haveapi-client to v0.11
3
-
4
1
  * Wed Sep 20 2017 - version 2.9.0
5
2
  - Updated haveapi-client to v0.10
6
3
 
@@ -14,14 +14,14 @@ module VpsAdmin::CLI::Commands
14
14
 
15
15
  def options(opts)
16
16
  @opts = {
17
- rotate: true,
18
- min_snapshots: 30,
19
- max_snapshots: 45,
20
- max_age: 30,
21
- attempts: 10,
22
- checksum: true,
23
- delete_after: true,
24
- sudo: true,
17
+ rotate: true,
18
+ min_snapshots: 30,
19
+ max_snapshots: 45,
20
+ max_age: 30,
21
+ attempts: 10,
22
+ checksum: true,
23
+ delete_after: true,
24
+ sudo: true,
25
25
  }
26
26
 
27
27
  opts.on('-p', '--pretend', 'Print what would the program do') do
@@ -51,7 +51,7 @@ module VpsAdmin::CLI::Commands
51
51
  exit_msg('--max-rate must be greater than zero') if r <= 0
52
52
  @opts[:max_rate] = r
53
53
  end
54
-
54
+
55
55
  opts.on('-q', '--quiet', 'Print only errors') do |q|
56
56
  @opts[:quiet] = q
57
57
  end
@@ -90,9 +90,9 @@ module VpsAdmin::CLI::Commands
90
90
  def exec(args)
91
91
  if args.size == 1 && /^\d+$/ !~ args[0]
92
92
  fs = args[0]
93
-
93
+
94
94
  ds_id = read_dataset_id(fs)
95
-
95
+
96
96
  if ds_id
97
97
  ds = @api.dataset.show(ds_id)
98
98
  else
@@ -130,8 +130,8 @@ module VpsAdmin::CLI::Commands
130
130
  if remote_state[ds.current_history_id].nil? \
131
131
  || remote_state[ds.current_history_id].empty?
132
132
  exit_msg(
133
- "Nothing to transfer: no snapshots with history id #{ds.current_history_id}",
134
- error: @opts[:no_snapshots_error]
133
+ "Nothing to transfer: no snapshots with history id #{ds.current_history_id}",
134
+ error: @opts[:no_snapshots_error]
135
135
  )
136
136
  end
137
137
 
@@ -170,9 +170,9 @@ module VpsAdmin::CLI::Commands
170
170
  if for_transfer.empty?
171
171
  if found_latest
172
172
  exit_msg(
173
- "Nothing to transfer: all snapshots with history id "+
174
- "#{ds.current_history_id} are already present locally",
175
- error: @opts[:no_snapshots_error]
173
+ "Nothing to transfer: all snapshots with history id "+
174
+ "#{ds.current_history_id} are already present locally",
175
+ error: @opts[:no_snapshots_error]
176
176
  )
177
177
 
178
178
  else
@@ -205,7 +205,7 @@ END
205
205
  for_transfer.each { |s| puts " @#{s.name}" }
206
206
  puts
207
207
  end
208
-
208
+
209
209
  if @opts[:pretend]
210
210
  pretend_state = local_state.clone
211
211
  pretend_state[ds.current_history_id] ||= []
@@ -245,7 +245,7 @@ END
245
245
  if local_state[hist_id].nil?
246
246
  zfs(:create, nil, ds)
247
247
  end
248
-
248
+
249
249
  if no_local_snapshots
250
250
  msg "Performing a full receive of @#{snapshots.first.name} to #{ds}"
251
251
 
@@ -255,12 +255,12 @@ END
255
255
  else
256
256
  run_piped(zfs_cmd(:recv, '-F', ds)) do
257
257
  SnapshotSend.new({}, @api).do_exec({
258
- snapshot: snapshots.first.id,
259
- send_mail: false,
260
- delete_after: @opts[:delete_after],
261
- max_rate: @opts[:max_rate],
262
- checksum: @opts[:checksum],
263
- quiet: @opts[:quiet],
258
+ snapshot: snapshots.first.id,
259
+ send_mail: false,
260
+ delete_after: @opts[:delete_after],
261
+ max_rate: @opts[:max_rate],
262
+ checksum: @opts[:checksum],
263
+ quiet: @opts[:quiet],
264
264
  })
265
265
  end || exit_msg('Receive failed')
266
266
  end
@@ -276,13 +276,13 @@ END
276
276
  else
277
277
  run_piped(zfs_cmd(:recv, '-F', ds)) do
278
278
  SnapshotSend.new({}, @api).do_exec({
279
- snapshot: snapshots.last.id,
280
- from_snapshot: snapshots.first.id,
281
- send_mail: false,
282
- delete_after: @opts[:delete_after],
283
- max_rate: @opts[:max_rate],
284
- checksum: @opts[:checksum],
285
- quiet: @opts[:quiet],
279
+ snapshot: snapshots.last.id,
280
+ from_snapshot: snapshots.first.id,
281
+ send_mail: false,
282
+ delete_after: @opts[:delete_after],
283
+ max_rate: @opts[:max_rate],
284
+ checksum: @opts[:checksum],
285
+ quiet: @opts[:quiet],
286
286
  })
287
287
  end || exit_msg('Receive failed')
288
288
  end
@@ -297,16 +297,16 @@ END
297
297
 
298
298
  begin
299
299
  SnapshotDownload.new({}, @api).do_exec({
300
- snapshot: snapshot.id,
301
- from_snapshot: from_snapshot && from_snapshot.id,
302
- format: from_snapshot ? :incremental_stream : :stream,
303
- file: part,
304
- max_rate: @opts[:max_rate],
305
- checksum: @opts[:checksum],
306
- quiet: @opts[:quiet],
307
- resume: true,
308
- delete_after: @opts[:delete_after],
309
- send_mail: false,
300
+ snapshot: snapshot.id,
301
+ from_snapshot: from_snapshot && from_snapshot.id,
302
+ format: from_snapshot ? :incremental_stream : :stream,
303
+ file: part,
304
+ max_rate: @opts[:max_rate],
305
+ checksum: @opts[:checksum],
306
+ quiet: @opts[:quiet],
307
+ resume: true,
308
+ delete_after: @opts[:delete_after],
309
+ send_mail: false,
310
310
  })
311
311
 
312
312
  rescue Errno::ECONNREFUSED,
@@ -341,7 +341,7 @@ END
341
341
  def rotate(fs, pretend: false)
342
342
  msg "Rotating snapshots"
343
343
  local_state = pretend ? pretend : parse_tree(fs)
344
-
344
+
345
345
  # Order snapshots by date of creation
346
346
  snapshots = local_state.values.flatten.sort do |a, b|
347
347
  a.creation <=> b.creation
@@ -368,7 +368,7 @@ END
368
368
 
369
369
  local_state.each do |hist_id, snapshots|
370
370
  next unless snapshots.empty?
371
-
371
+
372
372
  ds = "#{fs}/#{hist_id}"
373
373
 
374
374
  msg "Destroying #{ds}"
@@ -386,7 +386,7 @@ END
386
386
  last_name = name.split('/').last
387
387
  ret[last_name.to_i] = [] if dataset?(last_name)
388
388
  end
389
-
389
+
390
390
  zfs(
391
391
  :get,
392
392
  '-Hrp -d2 -tsnapshot -oname,property,value name,creation',
@@ -10,20 +10,20 @@ module VpsAdmin::CLI::Commands
10
10
  cmd :ip_traffic, :top
11
11
  args ''
12
12
  desc 'Live IP traffic monitor'
13
-
13
+
14
14
  def options(opts)
15
15
  @opts = {
16
- unit: :bits,
16
+ unit: :bits,
17
17
  }
18
18
 
19
19
  opts.on('--unit UNIT', %w(bytes bits), 'Select data unit (bytes or bits)') do |v|
20
20
  @opts[:unit] = v.to_sym
21
21
  end
22
-
22
+
23
23
  opts.on('--limit LIMIT', Integer, 'Number of IP addresses to monitor') do |v|
24
24
  @opts[:limit] = v
25
25
  end
26
-
26
+
27
27
  opts.on('--ip-address ADDR', 'ADDR or ID of IP addresses to monitor') do |v|
28
28
  id = ip_address_id(v)
29
29
 
@@ -35,11 +35,11 @@ module VpsAdmin::CLI::Commands
35
35
  exit(1)
36
36
  end
37
37
  end
38
-
38
+
39
39
  opts.on('--ip-version VER', [4, 6], 'Filter IP addresses by version') do |v|
40
40
  @opts[:ip_version] = v
41
41
  end
42
-
42
+
43
43
  (FILTERS - %i(limit ip_address ip_version)).each do |f|
44
44
  opts.on("--#{f.to_s.gsub(/_/, '-')} ID", Integer, "Filter IP addresses by #{f}") do |v|
45
45
  @opts[f] = v
@@ -143,9 +143,9 @@ module VpsAdmin::CLI::Commands
143
143
  size = title.size + 1
144
144
 
145
145
  @columns << {
146
- name: p,
147
- title: title,
148
- width: size < 8 ? 8 : size,
146
+ name: p,
147
+ title: title,
148
+ width: size < 8 ? 8 : size,
149
149
  }
150
150
  end
151
151
  end
@@ -156,9 +156,9 @@ module VpsAdmin::CLI::Commands
156
156
  limit = @opts[:limit] || lines - 6
157
157
 
158
158
  params = {
159
- limit: limit > 0 ? limit : 25,
160
- order: "#{@sort_desc ? '-' : ''}#{@sort_param}",
161
- meta: {includes: 'ip_address'}
159
+ limit: limit > 0 ? limit : 25,
160
+ order: "#{@sort_desc ? '-' : ''}#{@sort_param}",
161
+ meta: {includes: 'ip_address__network_interface'}
162
162
  }
163
163
 
164
164
  FILTERS.each do |f|
@@ -186,11 +186,11 @@ module VpsAdmin::CLI::Commands
186
186
  attroff(color_pair(1))
187
187
 
188
188
  i = 3
189
-
189
+
190
190
  fetch.each do |data|
191
191
  setpos(i, 0)
192
192
  print_row(data)
193
-
193
+
194
194
  i += 1
195
195
 
196
196
  break if i >= (lines - 5)
@@ -205,20 +205,24 @@ module VpsAdmin::CLI::Commands
205
205
  fmt = (['%-30s', '%6s'] + @columns.map { |c| "%#{c[:width]}s" }).join(' ')
206
206
 
207
207
  @header = sprintf(
208
- fmt,
209
- 'IP Address',
210
- 'VPS',
211
- *@columns.map { |c| c[:title] },
208
+ fmt,
209
+ 'IP Address',
210
+ 'VPS',
211
+ *@columns.map { |c| c[:title] },
212
212
  )
213
213
 
214
214
  @header << (' ' * (cols - @header.size)) << "\n"
215
215
  end
216
-
216
+
217
217
  addstr(@header)
218
218
  end
219
219
 
220
220
  def print_row(data)
221
- addstr(sprintf('%-30s %6s', data.ip_address.addr, data.ip_address.vps_id))
221
+ addstr(sprintf(
222
+ '%-30s %6s',
223
+ data.ip_address.addr,
224
+ data.ip_address.network_interface.vps_id
225
+ ))
222
226
 
223
227
  @columns.each do |c|
224
228
  p = c[:name]
@@ -236,7 +240,7 @@ module VpsAdmin::CLI::Commands
236
240
 
237
241
  fields.each do |f|
238
242
  stats[f] = 0
239
-
243
+
240
244
  %i(in out).each do |dir|
241
245
  stats[:"#{f}_#{dir}"] = 0
242
246
  end
@@ -247,7 +251,7 @@ module VpsAdmin::CLI::Commands
247
251
 
248
252
  fields.each do |f|
249
253
  stats[f] += data.send(f)
250
-
254
+
251
255
  %i(in out).each do |dir|
252
256
  stats[:"#{f}_#{dir}"] += data.send("#{f}_#{dir}")
253
257
  end
@@ -264,20 +268,20 @@ module VpsAdmin::CLI::Commands
264
268
 
265
269
  setpos(lines-4, 0)
266
270
  addstr(sprintf(
267
- fmt,
268
- '',
269
- 'Packets/s',
270
- "#{unit}/s",
271
- "Public#{unit}/s",
272
- "Private#{unit}/s"
271
+ fmt,
272
+ '',
273
+ 'Packets/s',
274
+ "#{unit}/s",
275
+ "Public#{unit}/s",
276
+ "Private#{unit}/s"
273
277
  ))
274
278
 
275
279
  setpos(lines-3, 0)
276
280
  addstr(sprintf(fmt, 'In', *fields.map { |f| unitize(stats[:"#{f}_in"], avg_delta) }))
277
-
281
+
278
282
  setpos(lines-2, 0)
279
283
  addstr(sprintf(fmt, 'Out', *fields.map { |f| unitize(stats[:"#{f}_out"], avg_delta) }))
280
-
284
+
281
285
  setpos(lines-1, 0)
282
286
  attron(A_BOLD)
283
287
  addstr(sprintf(fmt, 'Total', *fields.map { |f| unitize(stats[:"#{f}_in"] + stats[:"#{f}_out"], avg_delta) }))
@@ -6,16 +6,16 @@ module VpsAdmin::CLI::Commands
6
6
 
7
7
  def options(opts)
8
8
  @opts = {
9
- delete_after: true,
10
- send_mail: false,
11
- checksum: true,
12
- format: 'archive',
9
+ delete_after: true,
10
+ send_mail: false,
11
+ checksum: true,
12
+ format: 'archive',
13
13
  }
14
14
 
15
15
  opts.on('-f', '--format FORMAT', 'archive, stream or incremental_stream') do |f|
16
16
  @opts[:format] = f
17
17
  end
18
-
18
+
19
19
  opts.on('-I', '--from-snapshot SNAPSHOT_ID', Integer, 'Download snapshot incrementally from SNAPSHOT_ID') do |s|
20
20
  @opts[:from_snapshot] = s
21
21
  end
@@ -65,7 +65,7 @@ module VpsAdmin::CLI::Commands
65
65
  else
66
66
  @opts[:snapshot] = args.first.to_i
67
67
  end
68
-
68
+
69
69
  do_exec(@opts)
70
70
  end
71
71
 
@@ -101,19 +101,19 @@ module VpsAdmin::CLI::Commands
101
101
 
102
102
  begin
103
103
  VpsAdmin::CLI::StreamDownloader.download(
104
- @api,
105
- dl,
106
- f,
107
- progress: !@opts[:quiet] && (f == STDOUT ? STDERR : STDOUT),
108
- position: pos,
109
- max_rate: @opts[:max_rate],
110
- checksum: @opts[:checksum],
104
+ @api,
105
+ dl,
106
+ f,
107
+ progress: !@opts[:quiet] && (f == STDOUT ? STDERR : STDOUT),
108
+ position: pos,
109
+ max_rate: @opts[:max_rate],
110
+ checksum: @opts[:checksum],
111
111
  )
112
112
 
113
113
  rescue VpsAdmin::CLI::DownloadError => e
114
114
  warn e.message
115
115
  exit(false)
116
-
116
+
117
117
  ensure
118
118
  f.close
119
119
  end
@@ -139,9 +139,9 @@ module VpsAdmin::CLI::Commands
139
139
  STDERR.flush
140
140
 
141
141
  action = {
142
- 'r' => :resume,
143
- 'o' => :overwrite,
144
- '' => false,
142
+ 'r' => :resume,
143
+ 'o' => :overwrite,
144
+ '' => false,
145
145
  }[STDIN.readline.strip.downcase]
146
146
  end
147
147
 
@@ -149,7 +149,7 @@ module VpsAdmin::CLI::Commands
149
149
  warn "File '#{path}' already exists"
150
150
  exit(false)
151
151
  end
152
-
152
+
153
153
  case action
154
154
  when :resume
155
155
  mode = 'a+'
@@ -216,4 +216,4 @@ module VpsAdmin::CLI::Commands
216
216
  end
217
217
  end
218
218
  end
219
- end
219
+ end
@@ -8,11 +8,11 @@ module VpsAdmin::CLI::Commands
8
8
 
9
9
  def options(opts)
10
10
  @opts = {
11
- delete_after: true,
12
- send_mail: false,
13
- checksum: true,
11
+ delete_after: true,
12
+ send_mail: false,
13
+ checksum: true,
14
14
  }
15
-
15
+
16
16
  opts.on('-I', '--from-snapshot SNAPSHOT_ID', Integer, 'Download snapshot incrementally from SNAPSHOT_ID') do |s|
17
17
  @opts[:from_snapshot] = s
18
18
  end
@@ -20,7 +20,7 @@ module VpsAdmin::CLI::Commands
20
20
  opts.on('-d', '--[no-]delete-after', 'Delete the file from the server after successful download') do |d|
21
21
  @opts[:delete_after] = d
22
22
  end
23
-
23
+
24
24
  opts.on('-q', '--quiet', 'Print only errors') do |q|
25
25
  @opts[:quiet] = q
26
26
  end
@@ -72,12 +72,12 @@ module VpsAdmin::CLI::Commands
72
72
 
73
73
  begin
74
74
  VpsAdmin::CLI::StreamDownloader.download(
75
- @api,
76
- dl,
77
- w,
78
- progress: !opts[:quiet] && STDERR,
79
- max_rate: opts[:max_rate],
80
- checksum: opts[:checksum],
75
+ @api,
76
+ dl,
77
+ w,
78
+ progress: !opts[:quiet] && STDERR,
79
+ max_rate: opts[:max_rate],
80
+ checksum: opts[:checksum],
81
81
  )
82
82
 
83
83
  rescue VpsAdmin::CLI::DownloadError => e
@@ -3,7 +3,7 @@ module VpsAdmin::CLI::Commands
3
3
  cmd :vps, :migrate_many
4
4
  args 'VPS_ID...'
5
5
  desc 'Migrate multiple VPSes using a migration plan'
6
-
6
+
7
7
  def options(opts)
8
8
  @opts = {}
9
9
 
@@ -14,11 +14,11 @@ module VpsAdmin::CLI::Commands
14
14
  opts.on('--dst-node NODE_ID', 'Destination node') do |id|
15
15
  @opts[:dst_node] = id.to_i
16
16
  end
17
-
17
+
18
18
  opts.on('--[no-]outage-window', 'Migrate VPSes inside outage windows') do |w|
19
19
  @opts[:outage_window] = w
20
20
  end
21
-
21
+
22
22
  opts.on('--[no-]cleanup-data', 'Cleanup VPS dataset on the source node') do |c|
23
23
  @opts[:cleanup_data] = c
24
24
  end
@@ -26,7 +26,7 @@ module VpsAdmin::CLI::Commands
26
26
  opts.on('--[no-]stop-on-error', 'Cancel the plan if a migration fails') do |s|
27
27
  @opts[:stop_on_error] = s
28
28
  end
29
-
29
+
30
30
  opts.on('--concurrency N', 'How many migrations run concurrently') do |n|
31
31
  @opts[:concurrency] = n.to_i
32
32
  end
@@ -34,7 +34,7 @@ module VpsAdmin::CLI::Commands
34
34
  opts.on('--[no-]send-mail', 'Send users mail informing about the migration') do |s|
35
35
  @opts[:send_mail] = s
36
36
  end
37
-
37
+
38
38
  opts.on('--reason REASON', 'Why are the VPS being migrated') do |r|
39
39
  @opts[:reason] = r
40
40
  end
@@ -87,15 +87,15 @@ module VpsAdmin::CLI::Commands
87
87
  begin
88
88
  vpses.each do |vps_id|
89
89
  params = {
90
- vps: vps_id,
91
- dst_node: @opts[:dst_node],
90
+ vps: vps_id,
91
+ dst_node: @opts[:dst_node],
92
92
  }
93
93
  params[:outage_window] = @opts[:outage_window] unless @opts[:outage_window].nil?
94
94
  params[:cleanup_data] = @opts[:cleanup_data] unless @opts[:cleanup_data].nil?
95
95
 
96
96
  plan.vps_migration.create(params)
97
97
  end
98
-
98
+
99
99
  rescue HaveAPI::Client::ActionFailed => e
100
100
  report_error(e)
101
101
  end
@@ -107,7 +107,7 @@ module VpsAdmin::CLI::Commands
107
107
  rescue HaveAPI::Client::ActionFailed => e
108
108
  report_error(e)
109
109
  end
110
-
110
+
111
111
  HaveAPI::CLI::OutputFormatter.print(ret.attributes)
112
112
  end
113
113
 
@@ -66,7 +66,7 @@ module VpsAdmin::CLI::Commands
66
66
 
67
67
  def options(opts)
68
68
  @opts = {
69
- rate: 0.05
69
+ rate: 0.05
70
70
  }
71
71
 
72
72
  opts.on('--refresh-rate MSEC', 'How often send and receive data, defaults to 50 ms') do |r|
@@ -136,7 +136,7 @@ module VpsAdmin::CLI::Commands
136
136
 
137
137
  pid = Process.fork do
138
138
  @size = Terminal.size!
139
-
139
+
140
140
  Signal.trap('WINCH') do
141
141
  @size = Terminal.size!
142
142
  end
@@ -144,7 +144,7 @@ module VpsAdmin::CLI::Commands
144
144
  yield
145
145
  end
146
146
 
147
- Process.wait(pid)
147
+ Process.wait(pid)
148
148
 
149
149
  `stty #{state}`
150
150
  puts
@@ -152,13 +152,13 @@ module VpsAdmin::CLI::Commands
152
152
 
153
153
  def communicate
154
154
  post = @http.post(
155
- body: {
156
- session: @token,
157
- keys: @input.buffer,
158
- width: @size[:width],
159
- height: @size[:height],
160
- },
161
- keepalive: true
155
+ body: {
156
+ session: @token,
157
+ keys: @input.buffer,
158
+ width: @size[:width],
159
+ height: @size[:height],
160
+ },
161
+ keepalive: true
162
162
  )
163
163
 
164
164
  @input.buffer = ''
@@ -170,7 +170,7 @@ module VpsAdmin::CLI::Commands
170
170
 
171
171
  post.callback do
172
172
  ret = JSON.parse(post.response, symbolize_names: true)
173
-
173
+
174
174
  unless ret[:session]
175
175
  $stdout.write(ret[:data])
176
176
  puts "\nSession closed."
@@ -21,12 +21,12 @@ module VpsAdmin::CLI
21
21
  if position > 0 && checksum
22
22
  if progress
23
23
  pb = ProgressBar.create(
24
- title: 'Calculating checksum',
25
- total: position,
26
- format: '%E %t: [%B] %p%% %r MB/s',
27
- rate_scale: ->(rate) { (rate / 1024.0 / 1024.0).round(2) },
28
- throttle_rate: 0.2,
29
- output: progress,
24
+ title: 'Calculating checksum',
25
+ total: position,
26
+ format: '%E %t: [%B] %p%% %r MB/s',
27
+ rate_scale: ->(rate) { (rate / 1024.0 / 1024.0).round(2) },
28
+ throttle_rate: 0.2,
29
+ output: progress,
30
30
  )
31
31
  end
32
32
 
@@ -49,14 +49,14 @@ module VpsAdmin::CLI
49
49
  self.format = '%t: [%B] %r kB/s'
50
50
 
51
51
  @pb = ProgressBar.create(
52
- title: 'Downloading',
53
- total: nil,
54
- format: @format,
55
- rate_scale: ->(rate) { (rate / 1024.0).round(2) },
56
- throttle_rate: 0.2,
57
- starting_at: downloaded,
58
- autofinish: false,
59
- output: progress,
52
+ title: 'Downloading',
53
+ total: nil,
54
+ format: @format,
55
+ rate_scale: ->(rate) { (rate / 1024.0).round(2) },
56
+ throttle_rate: 0.2,
57
+ starting_at: downloaded,
58
+ autofinish: false,
59
+ output: progress,
60
60
  )
61
61
  end
62
62
 
@@ -129,7 +129,7 @@ module VpsAdmin::CLI
129
129
  else
130
130
  raise DownloadError, "Unexpected HTTP status code '#{res.code}'"
131
131
  end
132
-
132
+
133
133
  t1 = Time.now
134
134
  data_counter = 0
135
135
 
@@ -170,7 +170,7 @@ module VpsAdmin::CLI
170
170
  t1 = Time.now
171
171
  end
172
172
  end
173
-
173
+
174
174
  io.write(fragment)
175
175
  end
176
176
  end
@@ -194,7 +194,7 @@ module VpsAdmin::CLI
194
194
  protected
195
195
  def pause(secs)
196
196
  @paused = true
197
-
197
+
198
198
  if @pb
199
199
  secs.times do |i|
200
200
  if @download_size
@@ -1,5 +1,5 @@
1
1
  module VpsAdmin
2
2
  module Client
3
- VERSION = '2.9.1'
3
+ VERSION = '3.0.0.master.20190517-0.3ab5ddfe'
4
4
  end
5
5
  end
data/shell.nix ADDED
@@ -0,0 +1,33 @@
1
+ let
2
+ pkgs = import <nixpkgs> {};
3
+ stdenv = pkgs.stdenv;
4
+
5
+ in stdenv.mkDerivation rec {
6
+ name = "vpsadmin-client";
7
+
8
+ buildInputs = [
9
+ pkgs.ruby
10
+ pkgs.git
11
+ pkgs.zlib
12
+ pkgs.openssl
13
+ pkgs.ncurses
14
+ ];
15
+
16
+ shellHook = ''
17
+ mkdir -p /tmp/dev-ruby-gems
18
+ export GEM_HOME="/tmp/dev-ruby-gems"
19
+ export GEM_PATH="$GEM_HOME:$PWD/lib"
20
+ export PATH="$GEM_HOME/bin:$PATH"
21
+
22
+ BUNDLE="$GEM_HOME/bin/bundle"
23
+
24
+ [ ! -x "$BUNDLE" ] && ${pkgs.ruby}/bin/gem install bundler
25
+
26
+ export BUNDLE_PATH="$GEM_HOME"
27
+ export BUNDLE_GEMFILE="$PWD/Gemfile"
28
+
29
+ $BUNDLE install
30
+
31
+ export RUBYOPT=-rbundler/setup
32
+ '';
33
+ }
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.6'
21
+ spec.add_development_dependency 'bundler'
22
22
  spec.add_development_dependency 'rake'
23
23
 
24
- spec.add_runtime_dependency 'haveapi-client', '~> 0.11.0'
24
+ spec.add_runtime_dependency 'haveapi-client', '~> 0.13.0'
25
25
  spec.add_runtime_dependency 'eventmachine', '~> 1.0.3'
26
26
  spec.add_runtime_dependency 'em-http-request', '~> 1.1.3'
27
27
  spec.add_runtime_dependency 'json'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vpsadmin-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 3.0.0.master.20190517.pre.0.3ab5ddfe
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-27 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.11.0
47
+ version: 0.13.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.11.0
54
+ version: 0.13.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: eventmachine
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,7 @@ files:
136
136
  - lib/vpsadmin/cli/stream_downloader.rb
137
137
  - lib/vpsadmin/client.rb
138
138
  - lib/vpsadmin/client/version.rb
139
+ - shell.nix
139
140
  - vpsadmin-client.gemspec
140
141
  homepage: ''
141
142
  licenses:
@@ -152,12 +153,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
153
  version: '0'
153
154
  required_rubygems_version: !ruby/object:Gem::Requirement
154
155
  requirements:
155
- - - ">="
156
+ - - ">"
156
157
  - !ruby/object:Gem::Version
157
- version: '0'
158
+ version: 1.3.1
158
159
  requirements: []
159
160
  rubyforge_project:
160
- rubygems_version: 2.6.14
161
+ rubygems_version: 2.7.6.2
161
162
  signing_key:
162
163
  specification_version: 4
163
164
  summary: Ruby API and CLI for vpsAdmin API