blockhosts 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40724e7916a86388c65a9edf705d05ffbf796b27702f4ed03639d17cc9dda8e4
4
- data.tar.gz: 2ef36ae952b23b74294d48347e6aca9ff777c7e661f9b43221883869013b1c7c
3
+ metadata.gz: 67913c506d902bbe615aaeb54b23435d83c141e2c3ab38b8ca36c060794fbe25
4
+ data.tar.gz: 6c8eea9339fbd1c0cff02048f61409e1336de12984ab7d2d48f30711a26e44b9
5
5
  SHA512:
6
- metadata.gz: e2ff940762b4f739729c0d0d87702cfeed125207671418be58103bdca2cb5afc6a2906661a7f744579f5e7f8ef61438d1f4626499921ee4d9de0be6513fc4050
7
- data.tar.gz: 0c398104cdbafb9ec82cb4d94161d89df425a83c9da59893540ac9dff44b22817c23590105a2b84bdc94092ee3946a435fb7d8016e4dda05830fa388a4d87630
6
+ metadata.gz: 79b8895069300ae145792fe840fd44b98e6218be92689554174cb3be4422a703e1d8a00474afbdae087e4c38116548b42953fa1d82b4ec84e1ba307698d85a62
7
+ data.tar.gz: 52d8ef088571d3c02d07b11b50d9f55ab8b82a505c7d019bd2c677692afcd65d9b28cc0f3557e4dc3eb2ff9a83e4e794b13a8afab29e93cbebaae8e0f6e65c22
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/blockhosts.rb CHANGED
@@ -2,19 +2,17 @@
2
2
 
3
3
  # file: blockhosts.rb
4
4
 
5
-
6
5
  require 'rxfhelper'
7
6
 
7
+
8
8
  class Host
9
9
 
10
10
  @ip = '127.0.0.1'
11
11
 
12
12
  @file = case RUBY_PLATFORM
13
- when /linux|darwin/
14
- '/etc/hosts'
15
13
  when /cygwin|mswin|mingw|bccwin|wince|emx/
16
14
  'c:\windows\system32\drivers\etc\hosts'
17
- else
15
+ else # /linux|darwin/
18
16
  '/etc/hosts'
19
17
  end
20
18
 
@@ -25,10 +23,10 @@ class Host
25
23
 
26
24
  hashtag = hostname.sub(/^#/,'')
27
25
  list, _ = RXFHelper.read(banlist)
28
- list.lines.map {|hostx| "#{@ip} #{hostx.chomp} ##{hashtag}" }.join("\n")
26
+ list.lines.map {|hostx| "##{@ip} #{hostx.chomp} ##{hashtag}" }.join("\n")
29
27
 
30
28
  else
31
- "#{@ip} #{hostname} ##{hashtag}"
29
+ "##{@ip} #{hostname} ##{hashtag}"
32
30
  end
33
31
 
34
32
  open(@file, 'a') { |f| f.puts s } unless File.read(@file).include? hostname
@@ -69,4 +67,12 @@ class Host
69
67
 
70
68
  end
71
69
 
70
+ def self.rm(hashtag)
71
+
72
+ modify() do |line|
73
+ line.gsub(/^([^^]+##{hashtag.sub(/^#/,'')}[^$]+$)/,'')
74
+ end
75
+
76
+ end
77
+
72
78
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blockhosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,8 +35,28 @@ cert_chain:
35
35
  7vecf9qfrpZt4fjOajWBWWZEUQ3QKHva1uNegE75UqN77YfewLL+A+SrV0ORhL9q
36
36
  /sJ0X03RC0pDp5fyhHmUoTyT
37
37
  -----END CERTIFICATE-----
38
- date: 2018-10-20 00:00:00.000000000 Z
39
- dependencies: []
38
+ date: 2018-10-21 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: rxfhelper
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.9'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.9.1
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.9'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.9.1
40
60
  description:
41
61
  email: james@jamesrobertson.eu
42
62
  executables: []
metadata.gz.sig CHANGED
Binary file