everoute 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/everoute.gemspec +3 -2
- data/lib/everoute.rb +14 -3
- data/pkg/everoute-0.0.1.gem +0 -0
- metadata +18 -17
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/everoute.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "everoute"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Trierweiler"]
|
12
|
-
s.date = "2011-12-
|
12
|
+
s.date = "2011-12-29"
|
13
13
|
s.description = "Parses the evemaps website and makes these information available in Ruby"
|
14
14
|
s.email = "trierweiler@dievision.de"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"everoute.gemspec",
|
29
29
|
"lib/everoute.rb",
|
30
30
|
"lib/evesystem.rb",
|
31
|
+
"pkg/everoute-0.0.1.gem",
|
31
32
|
"spec/everoute_spec.rb",
|
32
33
|
"spec/evesystem_spec.rb",
|
33
34
|
"spec/spec_helper.rb"
|
data/lib/everoute.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
require 'nokogiri'
|
3
3
|
require 'mechanize'
|
4
|
+
require 'evesystem'
|
4
5
|
|
5
6
|
class Everoute
|
6
7
|
|
7
8
|
BASE_URL = 'http://evemaps.dotlan.net/route/'
|
9
|
+
TRADEHUBS = %w(Jita Rens Hek Amarr Dodixie)
|
8
10
|
|
9
11
|
attr_accessor :route
|
10
12
|
|
@@ -12,16 +14,15 @@ class Everoute
|
|
12
14
|
@agent = Mechanize.new
|
13
15
|
end
|
14
16
|
|
15
|
-
|
16
17
|
def travel(system_arr)
|
17
|
-
sys_string = system_arr[0]
|
18
|
+
sys_string = system_arr[0].clone
|
18
19
|
system_arr.each_with_index do |sys, i|
|
19
20
|
next if i == 0
|
20
21
|
sys_string << ":" + sys
|
21
22
|
end
|
22
23
|
page = @agent.get BASE_URL+sys_string
|
23
24
|
arr = page.parser.xpath('//html/body/div/div/div[2]/div[2]/div/div/table/tr')
|
24
|
-
|
25
|
+
route = []
|
25
26
|
arr.each_with_index do |a, i|
|
26
27
|
next if i == 0
|
27
28
|
scan = [i]
|
@@ -32,4 +33,14 @@ class Everoute
|
|
32
33
|
route
|
33
34
|
end
|
34
35
|
|
36
|
+
def find_tradehubs(start_sys)
|
37
|
+
output = ""
|
38
|
+
TRADEHUBS.each do |hub|
|
39
|
+
temp_arr = [start_sys, hub]
|
40
|
+
route = travel(temp_arr)
|
41
|
+
output << "#{hub}: #{route.size} "
|
42
|
+
end
|
43
|
+
output
|
44
|
+
end
|
45
|
+
|
35
46
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: everoute
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &80754530 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *80754530
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mechanize
|
27
|
-
requirement: &
|
27
|
+
requirement: &80754170 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *80754170
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: shoulda
|
38
|
-
requirement: &
|
38
|
+
requirement: &80753860 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *80753860
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &80753550 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *80753550
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &80753180 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.6.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *80753180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rcov
|
71
|
-
requirement: &
|
71
|
+
requirement: &80752820 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *80752820
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &80752490 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *80752490
|
91
91
|
description: Parses the evemaps website and makes these information available in Ruby
|
92
92
|
email: trierweiler@dievision.de
|
93
93
|
executables: []
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- everoute.gemspec
|
108
108
|
- lib/everoute.rb
|
109
109
|
- lib/evesystem.rb
|
110
|
+
- pkg/everoute-0.0.1.gem
|
110
111
|
- spec/everoute_spec.rb
|
111
112
|
- spec/evesystem_spec.rb
|
112
113
|
- spec/spec_helper.rb
|
@@ -125,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
126
|
version: '0'
|
126
127
|
segments:
|
127
128
|
- 0
|
128
|
-
hash:
|
129
|
+
hash: 786954127
|
129
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
131
|
none: false
|
131
132
|
requirements:
|