Class: Wraith::Wraith

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_name) ⇒ Wraith

Returns a new instance of Wraith.



6
7
8
9
10
11
12
13
14
15
# File 'lib/wraith/wraith.rb', line 6

def initialize(config_name)
  if File.exist?(config_name) && File.extname(config_name) == '.yaml'
    @config = YAML.load(File.open(config_name))
  else
    @config = YAML.load(File.open("configs/#{config_name}.yaml"))
  end
rescue
  puts 'unable to find config'
  exit 1
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



4
5
6
# File 'lib/wraith/wraith.rb', line 4

def config
  @config
end

Instance Method Details

#base_domainObject



33
34
35
# File 'lib/wraith/wraith.rb', line 33

def base_domain
  domains[base_domain_label]
end

#base_domain_labelObject



41
42
43
# File 'lib/wraith/wraith.rb', line 41

def base_domain_label
  domains.keys[0]
end

#comp_domainObject



37
38
39
# File 'lib/wraith/wraith.rb', line 37

def comp_domain
  domains[comp_domain_label]
end

#comp_domain_labelObject



45
46
47
# File 'lib/wraith/wraith.rb', line 45

def comp_domain_label
  domains.keys[1]
end

#directoryObject



17
18
19
# File 'lib/wraith/wraith.rb', line 17

def directory
  @config['directory'].first
end

#domainsObject



29
30
31
# File 'lib/wraith/wraith.rb', line 29

def domains
  @config['domains']
end

#engineObject



69
70
71
# File 'lib/wraith/wraith.rb', line 69

def engine
  @config['browser']
end

#fuzzObject



73
74
75
# File 'lib/wraith/wraith.rb', line 73

def fuzz
  @config['fuzz']
end

#modeObject



77
78
79
80
81
82
83
# File 'lib/wraith/wraith.rb', line 77

def mode
  if %w(diffs_only diffs_first alphanumeric).include?(@config['mode'])
    @config['mode']
  else
    'alphanumeric'
  end
end

#pathsObject



65
66
67
# File 'lib/wraith/wraith.rb', line 65

def paths
  @config['paths']
end

#phantomjs_optionsObject



85
86
87
# File 'lib/wraith/wraith.rb', line 85

def phantomjs_options
  @config['phantomjs_options']
end

#sitemapObject



57
58
59
# File 'lib/wraith/wraith.rb', line 57

def sitemap
  @config['sitemap']
end

#snap_fileObject



21
22
23
# File 'lib/wraith/wraith.rb', line 21

def snap_file
  @config['snap_file'] ? @config['snap_file'] : File.expand_path('lib/wraith/javascript/snap.js')
end

#spider_daysObject



53
54
55
# File 'lib/wraith/wraith.rb', line 53

def spider_days
  @config['spider_days']
end

#spider_fileObject



49
50
51
# File 'lib/wraith/wraith.rb', line 49

def spider_file
  @config['spider_file'] ? @config['spider_file'] : 'spider.txt'
end

#spider_skipsObject



61
62
63
# File 'lib/wraith/wraith.rb', line 61

def spider_skips
  @config['spider_skips']
end

#widthsObject



25
26
27
# File 'lib/wraith/wraith.rb', line 25

def widths
  @config['screen_widths']
end