module App

Public Class Methods

api() click to toggle source
# File lib/app.rb, line 30
def self.api
  HTTP
end
setup() click to toggle source
# File lib/app.rb, line 9
def self.setup
  # Create config file
  unless File.exists? @config_path
    new_file = File.open(@config_path, 'w')
    new_file.write $DEFAULT_CONFIG
    new_file.close
  end

  # Read and Parse config file
  @config_file = File.open(@config_path, 'r')
  @config = JSON.parse(@config_file.read)

  if @config['email'].empty? or @config['pass'].empty?
    abort "You have not configured your credentials yet, add them to ~/.pack"
  end

  @config['username'] = @config['email'][/[^@]*/]

  self.api.setup(@config)
end
watch(path, &fn) click to toggle source
# File lib/app.rb, line 33
def self.watch(path, &fn)
  Watch.watch path, &fn
end