hoster 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -6
- data/lib/hoster/hosts.rb +2 -2
- data/test/test_hoster.rb +2 -2
- metadata +19 -5
data/README.md
CHANGED
@@ -13,22 +13,28 @@ Usage
|
|
13
13
|
-----
|
14
14
|
|
15
15
|
$ hoster add testsite.com (defaults to 127.0.0.1)
|
16
|
-
|
16
|
+
|
17
17
|
$ hoster add testsite.com 192.168.1.150
|
18
|
-
|
18
|
+
|
19
19
|
$ hoster modify testsite.com 192.168.1.149
|
20
|
-
|
20
|
+
|
21
21
|
$ hoster remove testsite.com
|
22
|
-
|
22
|
+
|
23
23
|
$ hoster list (prints entire hosts file)
|
24
|
-
|
24
|
+
|
25
25
|
$ hoster list 127.0.0.1
|
26
26
|
|
27
27
|
|
28
28
|
Installation
|
29
29
|
------------
|
30
30
|
|
31
|
-
|
31
|
+
gem install hoster
|
32
|
+
|
33
|
+
|
34
|
+
Contributors
|
35
|
+
------------
|
36
|
+
|
37
|
+
* [SHIBATA Hiroshi](http://github.com/hsbt)
|
32
38
|
|
33
39
|
|
34
40
|
License
|
data/lib/hoster/hosts.rb
CHANGED
@@ -52,7 +52,7 @@ class Hosts
|
|
52
52
|
def extract_entries
|
53
53
|
entries = Hash.new
|
54
54
|
File.open(@hosts_path,"r").each do |line|
|
55
|
-
if line =~ /^(\d+\.\d+\.\d+\.\d+) (
|
55
|
+
if line =~ /^(\d+\.\d+\.\d+\.\d+)[ \t]+([^#]*)[#\n]/
|
56
56
|
ip_address = $1
|
57
57
|
hosts_list = $2.split(' ')
|
58
58
|
if entries.has_key?(ip_address)
|
@@ -103,4 +103,4 @@ class Hosts
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
end
|
106
|
+
end
|
data/test/test_hoster.rb
CHANGED
@@ -6,7 +6,7 @@ require 'shoulda'
|
|
6
6
|
BaseFile = <<CONTENT
|
7
7
|
127.0.0.1 localhost
|
8
8
|
127.0.1.1 localhost
|
9
|
-
192.168.1.1
|
9
|
+
192.168.1.1 router.com router # comment
|
10
10
|
192.168.1.2 localhost
|
11
11
|
127.0.0.1 test.com
|
12
12
|
192.168.1.2 local.host
|
@@ -87,4 +87,4 @@ class TestHoster < Test::Unit::TestCase
|
|
87
87
|
assert_equal ModifiedFile, @hoster.dump
|
88
88
|
end
|
89
89
|
end
|
90
|
-
end
|
90
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jerod Santo
|
@@ -9,7 +15,7 @@ autorequire: hoster
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-09-29 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -26,6 +32,8 @@ files:
|
|
26
32
|
- bin/hoster
|
27
33
|
- lib/hoster/hosts.rb
|
28
34
|
- lib/hoster.rb
|
35
|
+
- test/test_helper.rb
|
36
|
+
- test/test_hoster.rb
|
29
37
|
has_rdoc: true
|
30
38
|
homepage: http://github.com/sant0sk1/hoster
|
31
39
|
licenses: []
|
@@ -36,21 +44,27 @@ rdoc_options: []
|
|
36
44
|
require_paths:
|
37
45
|
- lib
|
38
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
39
48
|
requirements:
|
40
49
|
- - ">="
|
41
50
|
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
42
54
|
version: "0"
|
43
|
-
version:
|
44
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
45
57
|
requirements:
|
46
58
|
- - ">="
|
47
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
48
63
|
version: "0"
|
49
|
-
version:
|
50
64
|
requirements: []
|
51
65
|
|
52
66
|
rubyforge_project:
|
53
|
-
rubygems_version: 1.3.
|
67
|
+
rubygems_version: 1.3.7
|
54
68
|
signing_key:
|
55
69
|
specification_version: 3
|
56
70
|
summary: Allows you to easily modify your local hosts file using one simple command
|