Class: Zine::Upload

Inherits:
Object
  • Object
show all
Defined in:
lib/zine/upload.rb

Overview

Deploy changes to a remote host, via SFTP or using the AWS or GitHub API

Instance Method Summary collapse

Constructor Details

#initialize(build_dir, options, delete_file_array, upload_file_array) ⇒ Upload

Returns a new instance of Upload.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/zine/upload.rb', line 13

def initialize(build_dir, options, delete_file_array, upload_file_array)
  if options['method'] == 'none'
    @no_upload = true
    return
  end
  @build_dir = build_dir
  @options = options
  cred_file = options['credentials']
  @credentials = read_credentials(cred_file)
  @upload_file_array = Set.new(upload_file_array).to_a
  @delete_file_array = Set.new(delete_file_array).to_a - @upload_file_array
end

Instance Method Details

#upload_decision(query_class) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/zine/upload.rb', line 26

def upload_decision(query_class)
  return if @no_upload

  cli = query_class.new
  answer = cli.call 'Upload files? (Y/n)'
  return if answer != 'Y'

  puts Rainbow('Connecting...').green
  upload
end