class LineChange::Deploy

Attributes

id[R]
path[R]

Public Class Methods

new(id, path) click to toggle source
# File lib/line_change/deploy.rb, line 7
def initialize(id, path)
  @id, @path = id, path
end

Public Instance Methods

start() click to toggle source
# File lib/line_change/deploy.rb, line 11
def start
  print "Uploading #{most_recent_modified_file_path} to HockeyApp... "

  connection.upload(most_recent_modified_file_path, id).tap do |response|
    puts "Done!" "\n\n"
    puts "Response from HockeyApp:"

    response.body.each do |key, value|
      puts "#{' ' * 4}" "#{key.ljust(19)}: #{value}"
    end
  end
end

Private Instance Methods

connection() click to toggle source
# File lib/line_change/deploy.rb, line 38
def connection
  @connection ||= Connection.new
end
most_recent_modified_file_path() click to toggle source
# File lib/line_change/deploy.rb, line 26
def most_recent_modified_file_path
  @most_recent_modified_file_path ||= begin
    file = Dir[path].map{|file_path| File.open(file_path) }.sort_by(&:mtime).last

    if file
      file.path
    else
      raise FileNotFound, "No such file or directory: #{path}"
    end
  end
end