class Wraith::CLI

Attributes

config_name[RW]

Public Class Methods

source_root() click to toggle source
# File lib/wraith/cli.rb, line 21
def self.source_root
  File.expand_path("../../../", __FILE__)
end

Public Instance Methods

capture(config, multi = false) click to toggle source
# File lib/wraith/cli.rb, line 119
def capture(config, multi = false)
  within_acceptable_limits do
    logger.info Wraith::Validate.new(config).validate("capture")
    reset_shots(config)
    setup_folders(config)
    save_images(config)
    crop_images(config)
    compare_images(config)
    generate_thumbnails(config)
    generate_gallery(config, multi)
  end
end
compare_images(config_name) click to toggle source
# File lib/wraith/cli.rb, line 92
def compare_images(config_name)
  within_acceptable_limits do
    logger.info "COMPARING IMAGES"
    compare = Wraith::CompareImages.new(config_name)
    compare.compare_images
  end
end
copy_base_images(config_name) click to toggle source
# File lib/wraith/cli.rb, line 66
def copy_base_images(config_name)
  within_acceptable_limits do
    copy = Wraith::FolderManager.new(config_name)
    copy.copy_base_images
  end
end
crop_images(config_name) click to toggle source
# File lib/wraith/cli.rb, line 83
def crop_images(config_name)
  within_acceptable_limits do
    logger.info "CROPPING IMAGES"
    crop = Wraith::CropImages.new(config_name)
    crop.crop_images
  end
end
generate_thumbnails(config_name) click to toggle source
# File lib/wraith/cli.rb, line 101
def generate_thumbnails(config_name)
  within_acceptable_limits do
    logger.info "GENERATING THUMBNAILS"
    thumbs = Wraith::Thumbnails.new(config_name)
    thumbs.generate_thumbnails
  end
end
history(config) click to toggle source
# File lib/wraith/cli.rb, line 143
def history(config)
  within_acceptable_limits do
    logger.info Wraith::Validate.new(config).validate("history")
    reset_shots(config)
    setup_folders(config)
    save_images(config)
    Wraith::FolderManager.new(config).copy_old_shots
  end
end
info() click to toggle source
# File lib/wraith/cli.rb, line 169
def info
  list_debug_information
end
latest(config) click to toggle source
# File lib/wraith/cli.rb, line 154
def latest(config)
  within_acceptable_limits do
    logger.info Wraith::Validate.new(config).validate("latest")
    reset_shots(config)
    setup_folders(config)
    save_images(config, true)
    copy_base_images(config)
    crop_images(config)
    compare_images(config)
    generate_thumbnails(config)
    generate_gallery(config)
  end
end
multi_capture(filelist) click to toggle source
# File lib/wraith/cli.rb, line 133
def multi_capture(filelist)
  within_acceptable_limits do
    config_array = IO.readlines(filelist)
    config_array.each do |config|
      capture(config.chomp, true)
    end
  end
end
reset_shots(config_name) click to toggle source
# File lib/wraith/cli.rb, line 50
def reset_shots(config_name)
  within_acceptable_limits do
    reset = Wraith::FolderManager.new(config_name)
    reset.clear_shots_folder
  end
end
save_images(config_name, history = false) click to toggle source
# File lib/wraith/cli.rb, line 74
def save_images(config_name, history = false)
  within_acceptable_limits do
    logger.info "SAVING IMAGES"
    save_images = Wraith::SaveImages.new(config_name, history)
    save_images.save_images
  end
end
setup() click to toggle source
# File lib/wraith/cli.rb, line 33
def setup
  within_acceptable_limits do
    directory("templates/configs", "configs")
    directory("templates/javascript", "javascript")
  end
end
setup_folders(config_name) click to toggle source
# File lib/wraith/cli.rb, line 58
def setup_folders(config_name)
  within_acceptable_limits do
    create = Wraith::FolderManager.new(config_name)
    create.create_folders
  end
end
spider(config) click to toggle source
# File lib/wraith/cli.rb, line 41
def spider(config)
  within_acceptable_limits do
    logger.info Wraith::Validate.new(config, { imports_must_resolve: false }).validate("spider")
    spider = Wraith::Spider.new(config)
    spider.crawl
  end
end
validate(config_name) click to toggle source
# File lib/wraith/cli.rb, line 26
def validate(config_name)
  within_acceptable_limits do
    logger.info Wraith::Validate.new(config_name).validate
  end
end
version() click to toggle source
# File lib/wraith/cli.rb, line 175
def version
  logger.info Wraith::VERSION
end