plagiarism2 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/bin/plagiarism +6 -0
- data/lib/plagiarism/cli.rb +35 -0
- data/lib/plagiarism/strategy.rb +1 -1
- data/lib/plagiarism/version.rb +1 -1
- data/lib/plagiarism.rb +2 -0
- data/plagiarism.gemspec +3 -2
- metadata +34 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bff4f9ef7060e99ba754a8e85d88ded43bc92234
|
4
|
+
data.tar.gz: fb32b027c73191b7724644a4f169db41bd93135b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c919a74db75b832676a998db8a5084cd7b93c2da18d171178ad98091f7d363bb4058399a397e8bacc401fd61f00b64d7133ab4c8a7421c5483e79eef99e4d4bc
|
7
|
+
data.tar.gz: a38c0840f60715c6c32bdcb8673d2217128d5d945c4bbb6133addc8b1a119bace2aa951f5fa3675cf04bbcf01953651a4cb67ec97fa1beb7b4a7021032557d13
|
data/README.md
CHANGED
@@ -49,6 +49,18 @@ Plagiarism.unique? text
|
|
49
49
|
|
50
50
|
`Plagiarism.unique?` is true when all strategies is true
|
51
51
|
|
52
|
+
#### Bash
|
53
|
+
|
54
|
+
```bash
|
55
|
+
plagiarism init # generate config
|
56
|
+
plagiarism unique -c="ringmd" # check unique
|
57
|
+
```
|
58
|
+
|
59
|
+
For more details, you can use help
|
60
|
+
```bash
|
61
|
+
plagiarism help init
|
62
|
+
```
|
63
|
+
|
52
64
|
## Contributing
|
53
65
|
|
54
66
|
Bug reports and pull requests are welcome on GitHub at https://github.com/MQuy/plagiarism. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/bin/plagiarism
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Plagiarism
|
5
|
+
class Cli < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
CONFIG_PATH = '~/.plagiarism.yml'
|
8
|
+
|
9
|
+
desc 'init', 'Create file for plagiarism to load config'
|
10
|
+
method_option :path, aliases: '-p', desc: 'where put the config', type: :string, default: CONFIG_PATH
|
11
|
+
def init
|
12
|
+
create_file options[:path], <<-STRING
|
13
|
+
strategies: "duck, yahoo"
|
14
|
+
whitelists: "www.ring.md, blog.ring.md"
|
15
|
+
bing_key: xxx
|
16
|
+
google_key: xxx
|
17
|
+
google_cx: xxx
|
18
|
+
STRING
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'unique', 'Check the unique content from search engines'
|
22
|
+
method_option :content, aliases: '-c', desc: 'content which need to checked', type: :string, required: true
|
23
|
+
method_option :path, aliases: '-p', desc: 'where put the config', type: :string, default: CONFIG_PATH
|
24
|
+
def unique
|
25
|
+
config = YAML.load_file(File.expand_path options[:path])
|
26
|
+
Config.strategies = config['strategies'].split(',').map &:strip
|
27
|
+
Config.whitelists = config['whitelists'].split(',').map &:strip
|
28
|
+
Config.bing_key = config['bing_key']
|
29
|
+
Config.google_key = config['google_key']
|
30
|
+
Config.google_cx = config['google_cx']
|
31
|
+
|
32
|
+
puts Plagiarism.unique? options[:content]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/plagiarism/strategy.rb
CHANGED
data/lib/plagiarism/version.rb
CHANGED
data/lib/plagiarism.rb
CHANGED
@@ -2,10 +2,12 @@ require 'typhoeus'
|
|
2
2
|
require 'typhoeus/adapters/faraday'
|
3
3
|
require 'pragmatic_segmenter'
|
4
4
|
require 'nokogiri'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
require 'plagiarism/version'
|
7
8
|
require 'plagiarism/config'
|
8
9
|
require 'plagiarism/strategy'
|
10
|
+
require 'plagiarism/cli'
|
9
11
|
|
10
12
|
module Plagiarism
|
11
13
|
extend self
|
data/plagiarism.gemspec
CHANGED
@@ -15,8 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.executables = ["plagiarism"]
|
20
19
|
spec.require_paths = ["lib"]
|
21
20
|
|
22
21
|
spec.add_development_dependency "bundler", "~> 1.11"
|
@@ -24,6 +23,8 @@ Gem::Specification.new do |spec|
|
|
24
23
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
24
|
|
26
25
|
spec.add_dependency 'typhoeus', '~> 1.0'
|
26
|
+
spec.add_dependency 'faraday', '~> 0.9.2'
|
27
27
|
spec.add_dependency 'pragmatic_segmenter', '~> 0.3'
|
28
28
|
spec.add_dependency 'nokogiri', '~> 1.6'
|
29
|
+
spec.add_dependency 'thor', '~> 0.19.1'
|
29
30
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plagiarism2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MQuy
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.9.2
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pragmatic_segmenter
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,10 +108,25 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '1.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.19.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.19.1
|
97
125
|
description: Check the unique content on internet from bing, google, yahoo and duckduckgo.
|
98
126
|
email:
|
99
127
|
- sugiacupit@gmail.com
|
100
|
-
executables:
|
128
|
+
executables:
|
129
|
+
- plagiarism
|
101
130
|
extensions: []
|
102
131
|
extra_rdoc_files: []
|
103
132
|
files:
|
@@ -109,8 +138,10 @@ files:
|
|
109
138
|
- README.md
|
110
139
|
- Rakefile
|
111
140
|
- bin/console
|
141
|
+
- bin/plagiarism
|
112
142
|
- bin/setup
|
113
143
|
- lib/plagiarism.rb
|
144
|
+
- lib/plagiarism/cli.rb
|
114
145
|
- lib/plagiarism/config.rb
|
115
146
|
- lib/plagiarism/strategries/bing.rb
|
116
147
|
- lib/plagiarism/strategries/duck.rb
|