Sha256: fd54316064924112ca60e48d02fd229a8e08ef912a95615e83c8d5960b3cd90f

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

#!/usr/bin/env ruby

# TODO
# => fix recursive upload bug where it only uploads the first layer of files (dirs are just blank files)
#    => UPDATE: dirs are now dirs, but theyre empty, details on server/server.rb:23-24
# => Try to fix spinner bug on Windows (may be a weird interaction with \r)

# Put all our core library files in the require path
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))

require 'core'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: #{$PROGRAM_NAME} [options]"

  opts.separator Paint['\nGeneral Options: ', '#95a5a6']
  opts.on('-v', '--verbose', 'Run verbosely') do |v|
    options[:verbose] = v
  end
  # directory flag
  opts.on('-d DIR', '--dir DIR', String, 'Upload files in DIR') do |d|
    options[:directory] = d unless d.nil?
  end

  opts.on('-h', '--help', 'Show this help message') do
    puts opts
    exit
  end
end.parse!(ARGV)

if Rise::Util.is_first_run?
  Rise::Util.setup
  puts '\nPlease run the `rise` command again to upload your files.'
  exit 0
end

result_url = ''
uploader = Rise::Transport::Uploader.new(options[:directory]) unless options[:directory].nil?
uploader = Rise::Transport::Uploader.new(Dir.pwd) if options[:directory].nil?


puts Paint['Thanks for using Rise! Your local source for serverless deployment!', '#95a5a6']

Whirly.start(spinner: 'dots', status: "Uploading files (#{uploader.total_files} total files)") do
  beginning_time = Time.now
  result_url = uploader.upload!(options[:verbose])  # Do the file upload

  Whirly.status = 'Done!\n'
  Clipboard.copy(result_url)
  print Paint["Your url is: #{result_url} (copied to clipboard) ", :bold]
  puts Paint["[#{((Time.now - beginning_time)).round(2)}s]", "#95a5a6"]

  puts Paint['Deployment successful!', '#3498db']
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rise-cli-0.1.1b bin/rise
rise-cli-0.1.1 bin/rise