Class: Rusic::Deployer

Inherits:
Object
  • Object
show all
Defined in:
lib/rusic/deployer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(files) ⇒ Deployer

Returns a new instance of Deployer.



5
6
7
# File 'lib/rusic/deployer.rb', line 5

def initialize(files)
  @files = Array(files).map { |file| ThemeFile.new(file) }
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



3
4
5
# File 'lib/rusic/deployer.rb', line 3

def files
  @files
end

Instance Method Details

#upload_files(options = {}) ⇒ Object



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

def upload_files(options = {})
  files.each do |file|
    file.uploader.upload_file(options)
  end
rescue RestClient::Unauthorized
  puts
  puts '401 Unauthorized. Ensure your API Key is set correctly.'
  exit(1)
rescue RestClient::ResourceNotFound
  puts
  puts '404 Not Found. Ensure you are have permission to access the given theme'
  exit(1)
end