amiblocked 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/README.md +3 -3
- data/amiblocked.gemspec +6 -6
- data/bin/amiblocked +4 -6
- data/lib/amiblocked.rb +10 -15
- data/lib/version.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62fd59baa37d88a784831c5d00ba5d4410746f46
|
4
|
+
data.tar.gz: b5833b70cc3a34a00eadd5cf2593fa38ea9afbc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b486976f85956a7c7f4c21adceaa42e2e6cba7c7423f98bd021e15952917597ea0a055cf0ab023246c1e2382553dab07a52e4becea5d04259f4fb3730b1c1ab
|
7
|
+
data.tar.gz: 910bcf2c29f4e17b37e69937da557676ef9f82df32014a0c90f0d78d8d11b6f5dae0639d53889950839d0ab6a0d5531cbba0a2cf89c045de3be25931a48139c2
|
data/Gemfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'notifaction'
|
3
|
+
gem 'notifaction'
|
data/README.md
CHANGED
@@ -5,9 +5,9 @@ Checks to see if your service is on any of the lists on the [easylist](https://e
|
|
5
5
|
## Usage
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
|
8
|
+
gem install amiblocked
|
9
9
|
|
10
10
|
# Examples
|
11
|
-
|
12
|
-
|
11
|
+
amiblocked google
|
12
|
+
amiblocked doubleclick
|
13
13
|
```
|
data/amiblocked.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require './lib/version'
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'amiblocked'
|
5
5
|
s.version = AmIBlocked::VERSION
|
6
6
|
s.date = Date.today
|
7
|
-
s.summary =
|
8
|
-
s.description =
|
9
|
-
s.authors = [
|
7
|
+
s.summary = 'Simple Adblock list testing'
|
8
|
+
s.description = 'Check if your service blocked by adblockers'
|
9
|
+
s.authors = ['Ryan Priebe']
|
10
10
|
s.email = 'hello@ryanpriebe.com'
|
11
|
-
s.files = `git ls-files`.split(
|
11
|
+
s.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
12
12
|
s.homepage = 'http://rubygems.org/gems/amiblocked'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.executables = 'amiblocked'
|
15
|
-
end
|
15
|
+
end
|
data/bin/amiblocked
CHANGED
@@ -7,16 +7,14 @@ require 'notifaction'
|
|
7
7
|
require_relative '../lib/amiblocked'
|
8
8
|
|
9
9
|
# default configuration options
|
10
|
-
config = {
|
11
|
-
url:
|
10
|
+
config = {
|
11
|
+
url: 'https://easylist.adblockplus.org/en/',
|
12
12
|
service: ARGV[0]
|
13
13
|
}
|
14
14
|
|
15
15
|
# use local configuration options if they exist
|
16
16
|
local_config = File.expand_path('~') + '.amiblocked-config.json'
|
17
17
|
|
18
|
-
if File.
|
19
|
-
config = JSON.parse(local_config)
|
20
|
-
end
|
18
|
+
config = JSON.parse(local_config) if File.exist?(local_config)
|
21
19
|
|
22
|
-
AmIBlocked.new(config)
|
20
|
+
AmIBlocked.new(config)
|
data/lib/amiblocked.rb
CHANGED
@@ -1,25 +1,22 @@
|
|
1
|
+
# Determines if a service is on the blocklist
|
1
2
|
class AmIBlocked
|
2
3
|
def initialize(config = {})
|
3
|
-
Notify.error(
|
4
|
+
Notify.error('A URL is required') if config[:url].nil?
|
4
5
|
Notify.error("A service name is required, e.g.\namiblocked doubleclick") if config[:service].nil?
|
5
6
|
|
6
|
-
@url = config[:url]
|
7
|
-
|
8
7
|
execute_and_report(config)
|
9
8
|
end
|
10
9
|
|
11
10
|
private
|
12
11
|
|
13
|
-
def
|
12
|
+
def lists_from_page(url)
|
14
13
|
lists = []
|
15
14
|
|
16
|
-
open(
|
15
|
+
open(url) do |res|
|
17
16
|
res.each_line do |line|
|
18
17
|
# grossness to follow
|
19
18
|
if list = /http(s):\/\/(.*)\.txt/.match(line)
|
20
|
-
|
21
|
-
lists.push list.to_s
|
22
|
-
end
|
19
|
+
lists.push list.to_s unless list.to_s.index('&')
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
@@ -34,13 +31,11 @@ class AmIBlocked
|
|
34
31
|
begin
|
35
32
|
open(list) do |res|
|
36
33
|
res.each_line do |line|
|
37
|
-
if /#{ARGV[0]}/.match(line)
|
38
|
-
matched_lists.push list
|
39
|
-
end
|
34
|
+
matched_lists.push list if /#{ARGV[0]}/.match(line)
|
40
35
|
end
|
41
36
|
end
|
42
37
|
rescue
|
43
|
-
|
38
|
+
Notify.warning("List not found - #{list}")
|
44
39
|
end
|
45
40
|
end
|
46
41
|
|
@@ -50,8 +45,8 @@ class AmIBlocked
|
|
50
45
|
def execute_and_report(config)
|
51
46
|
Notify.info("Checking if #{config[:service]} is on any adblock lists\nThis may take a few minutes...")
|
52
47
|
|
53
|
-
matched_lists = parse_lists(
|
54
|
-
|
48
|
+
matched_lists = parse_lists(lists_from_page(config[:url]))
|
49
|
+
|
55
50
|
if matched_lists.size > 0
|
56
51
|
Notify.warning("Found #{config[:service]} on #{matched_lists.size} lists")
|
57
52
|
Notify.warning(matched_lists.join("\n"))
|
@@ -59,4 +54,4 @@ class AmIBlocked
|
|
59
54
|
Notify.success("#{config[:service].capitalize} was not found on any lists, rejoice!")
|
60
55
|
end
|
61
56
|
end
|
62
|
-
end
|
57
|
+
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amiblocked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Priebe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Check if your service blocked by adblockers
|
14
14
|
email: hello@ryanpriebe.com
|