Class: Depends::Commands::Upload

Inherits:
Base
  • Object
show all
Defined in:
lib/depends/commands/upload.rb

Defined Under Namespace

Classes: UploadConfig

Instance Method Summary collapse

Methods inherited from Base

exit!, fatal!, #initialize, #reconfigure, #run

Constructor Details

This class inherits a constructor from Depends::Commands::Base

Instance Method Details

#run_applicationObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/depends/commands/upload.rb', line 58

def run_application
  client = Depends::RestClient.new(config[:destination])
  client.api_key = config[:key]

  begin
    Log.info "Getting Depend"
    @dep = client.get_depend(config[:name])
  rescue Nestful::ResourceNotFound => e
    if config[:description].nil?
      Log.fatal("Depends does not exist, you must specify a description") 
      exit(1)
    end
    Log.info "Creating Depends"
    @dep = client.create_depend(config[:name],config[:description])
  end
  file = build_package
  sha1 = Digest::SHA1.file(file).to_s
  client.create_version(config[:name], :file => file, :sha1 => sha1, :number => config[:version])
end

#setup_applicationObject



54
55
56
# File 'lib/depends/commands/upload.rb', line 54

def setup_application

end