class Plagiarism::Cli

Constants

CONFIG_PATH

Public Class Methods

load_config(path) click to toggle source
# File lib/plagiarism/cli.rb, line 10
def load_config(path)
  config = YAML.load_file(File.expand_path path)
  Config.strategies = config['strategies'].split(',').map &:strip
  Config.whitelists = config['whitelists'].split(',').map &:strip
  Config.bing_key = config['bing_key']
  Config.google_key = config['google_key']
  Config.google_cx = config['google_cx']
end

Public Instance Methods

init() click to toggle source
# File lib/plagiarism/cli.rb, line 22
    def init
      create_file options[:path], <<-STRING
strategies: "yahoo"
whitelists: "www.ring.md, blog.ring.md"
bing_key: xxx
google_key: xxx
google_cx: xxx
      STRING
    end
match() click to toggle source
# File lib/plagiarism/cli.rb, line 43
def match
  Cli.load_config(options[:path])
  puts Plagiarism.match options[:content]
end
unique() click to toggle source
# File lib/plagiarism/cli.rb, line 35
def unique
  Cli.load_config(options[:path])
  puts Plagiarism.unique? options[:content]
end