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.



10
11
12
# File 'lib/egads/command/upload.rb', line 10

def sha
  @sha
end

Instance Method Details

#uploadObject



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

def upload
  @sha = sha
  size = File.size(path)
  type = options[:seed] ? 'seed' : '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