Class: Egads::Upload

Inherits:
Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/egads/command/upload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Group

exit_on_failure?

Instance Attribute Details

#shaObject (readonly)

Returns the value of attribute sha.



8
9
10
# File 'lib/egads/command/upload.rb', line 8

def sha
  @sha
end

Instance Method Details

#uploadObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/egads/command/upload.rb', line 9

def upload
  @sha = sha
  size = File.size(path)
  type = 'patch'

  say_status :upload, "Uploading #{type} tarball (%.1f MB)" % (size.to_f / 2**20), :yellow
  duration = Benchmark.realtime do
    tarball.upload(path)
  end
  say_status :done, "Uploaded in %.1f seconds (%.1f KB/s)" % [duration, (size.to_f / 2**10) / duration]

  File.delete(path)
end