Module: Ipecache::Runner::InstanceMethods

Defined in:
lib/ipecache/runner.rb

Instance Method Summary collapse

Instance Method Details

#ipecache_configObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ipecache/runner.rb', line 11

def ipecache_config
  return @ipecache_config unless @ipecache_config.nil?

  @ipecache_config = AppConf.new
  load_paths = [ File.expand_path('config/ipecache-config.yml'), '/etc/ipecache-config.yml', File.expand_path('~/.ipecache/ipecache-config.yml') ]
  load_paths.each do |load_path|
    if File.exists?(load_path)
      @ipecache_config.load(load_path)
    end
  end

  @ipecache_config
end

#pretty_print_json(json) ⇒ Object



40
41
42
# File 'lib/ipecache/runner.rb', line 40

def pretty_print_json(json)
  JSON.pretty_generate(json)
end

#run_plugins(hook) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ipecache/runner.rb', line 25

def run_plugins(hook)
  urls = @urls
  log_file = @log_file
  continue_on_error = @continue_on_error
  quiet_mode = @quiet_mode
  Ipecache::Plugins.run(
    :config => ipecache_config,
    :hook => hook.to_sym,
    :urls => urls,
    :log_file => log_file,
    :continue_on_error => continue_on_error,
    :quiet_mode => quiet_mode
  )
end