skates 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +2 -1
- data/lib/skates/client_connection.rb +19 -12
- data/lib/skates/generator.rb +4 -1
- data/lib/skates/xmpp_connection.rb +3 -3
- data/templates/skates/Gemfile +3 -0
- data/templates/skates/config/boot.rb +1 -2
- data/templates/skates/script/component +1 -1
- metadata +8 -13
data/README.rdoc
CHANGED
@@ -91,7 +91,7 @@ Gems : Eventmachine, nokogiri, YAML, log4r, templater
|
|
91
91
|
|
92
92
|
(The MIT License)
|
93
93
|
|
94
|
-
Copyright (c) 2009 Julien Genestoux http://
|
94
|
+
Copyright (c) 2009 Julien Genestoux http://ouvre-boite.com
|
95
95
|
|
96
96
|
Permission is hereby granted, free of charge, to any person obtaining
|
97
97
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
gem.add_dependency('log4r')
|
15
15
|
gem.add_dependency('nokogiri', "= 1.4.2")
|
16
16
|
gem.add_dependency('utf8cleaner')
|
17
|
-
gem.requirements = ["eventmachine", "yaml", "fileutils", "log4r", "nokogiri", "optparse", "digest/sha1", "base64", "resolv", "utf8cleaner"]
|
17
|
+
gem.requirements = ["bundler", "eventmachine", "yaml", "fileutils", "log4r", "nokogiri", "optparse", "digest/sha1", "base64", "resolv", "utf8cleaner"]
|
18
18
|
gem.executables = "skates"
|
19
19
|
gem.files = [ "bin/skates",
|
20
20
|
"lib/skates.rb",
|
@@ -33,6 +33,7 @@ begin
|
|
33
33
|
"LICENSE",
|
34
34
|
"Rakefile",
|
35
35
|
"README.rdoc",
|
36
|
+
"templates/skates/Gemfile",
|
36
37
|
"templates/skates/app/controllers/controller.rb",
|
37
38
|
"templates/skates/app/views/view.rb",
|
38
39
|
"templates/skates/app/stanzas/stanza.rb",
|
@@ -40,20 +40,27 @@ module Skates
|
|
40
40
|
# Sort SRV records: lowest priority first, highest weight first
|
41
41
|
srv.sort! { |a,b| (a.priority != b.priority) ? (a.priority <=> b.priority) : (b.weight <=> a.weight) }
|
42
42
|
Skates.logger.debug {
|
43
|
-
"Found #{srv.count} SRV records for
|
43
|
+
"Found #{srv.count} SRV records for #{host}."
|
44
44
|
}
|
45
|
-
# And now, for each record, let's try to connect.
|
46
|
-
srv.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
45
|
+
# And now, for each record, let's try to connect. We add a bit of randomness, without touching the priority
|
46
|
+
srv.group_by { |record|
|
47
|
+
record.priority
|
48
|
+
}.each do |priority, records|
|
49
|
+
records.sort_by { |record|
|
50
|
+
rand()
|
51
|
+
}.each do |record|
|
52
|
+
if !found
|
53
|
+
Skates.logger.debug {
|
54
|
+
"Trying connection with : #{record.target.to_s}:#{record.port}"
|
55
|
+
}
|
56
|
+
ip = record.target.to_s
|
57
|
+
port = Integer(record.port)
|
58
|
+
if !found and block.call({"host" => ip, "port" => port})
|
59
|
+
found = true
|
60
|
+
end
|
61
|
+
end
|
55
62
|
end
|
56
|
-
|
63
|
+
end
|
57
64
|
if !found
|
58
65
|
# We failover to solving A record with default port.
|
59
66
|
Skates.logger.debug {
|
data/lib/skates/generator.rb
CHANGED
@@ -52,6 +52,10 @@ module Skates
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# And now add the critical files
|
55
|
+
file :gemfile_file do |f|
|
56
|
+
f.source = "#{source_root}/Gemfile"
|
57
|
+
f.destination = "#{application_name}/Gemfile"
|
58
|
+
end
|
55
59
|
file :boot_file do |f|
|
56
60
|
f.source = "#{source_root}/config/boot.rb"
|
57
61
|
f.destination = "#{application_name}/config/boot.rb"
|
@@ -72,7 +76,6 @@ module Skates
|
|
72
76
|
f.source = "#{source_root}/script/component"
|
73
77
|
f.destination = "#{application_name}/script/component"
|
74
78
|
end
|
75
|
-
|
76
79
|
end
|
77
80
|
|
78
81
|
##
|
@@ -181,9 +181,9 @@ module Skates
|
|
181
181
|
def receive_data(data)
|
182
182
|
data = UTF8Cleaner.clean(data)
|
183
183
|
begin
|
184
|
-
Skates.logger.debug {
|
185
|
-
|
186
|
-
}
|
184
|
+
# Skates.logger.debug {
|
185
|
+
# "RECEIVED : #{data}"
|
186
|
+
# }
|
187
187
|
@parser.push(data)
|
188
188
|
rescue
|
189
189
|
Skates.logger.error {
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 31
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- julien Genestoux
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-01-11 00:00:00 +01:00
|
19
18
|
default_executable: skates
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 59
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
- 12
|
@@ -42,7 +40,6 @@ dependencies:
|
|
42
40
|
requirements:
|
43
41
|
- - ">="
|
44
42
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 3
|
46
43
|
segments:
|
47
44
|
- 0
|
48
45
|
version: "0"
|
@@ -56,7 +53,6 @@ dependencies:
|
|
56
53
|
requirements:
|
57
54
|
- - "="
|
58
55
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
56
|
segments:
|
61
57
|
- 1
|
62
58
|
- 4
|
@@ -72,7 +68,6 @@ dependencies:
|
|
72
68
|
requirements:
|
73
69
|
- - ">="
|
74
70
|
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
71
|
segments:
|
77
72
|
- 0
|
78
73
|
version: "0"
|
@@ -105,6 +100,7 @@ files:
|
|
105
100
|
- lib/skates/runner.rb
|
106
101
|
- lib/skates/xmpp_connection.rb
|
107
102
|
- lib/skates/xmpp_parser.rb
|
103
|
+
- templates/skates/Gemfile
|
108
104
|
- templates/skates/app/controllers/controller.rb
|
109
105
|
- templates/skates/app/stanzas/stanza.rb
|
110
106
|
- templates/skates/app/views/view.rb
|
@@ -138,8 +134,8 @@ homepage: http://github.com/julien51/skates
|
|
138
134
|
licenses: []
|
139
135
|
|
140
136
|
post_install_message:
|
141
|
-
rdoc_options:
|
142
|
-
|
137
|
+
rdoc_options: []
|
138
|
+
|
143
139
|
require_paths:
|
144
140
|
- lib
|
145
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -147,7 +143,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
143
|
requirements:
|
148
144
|
- - ">="
|
149
145
|
- !ruby/object:Gem::Version
|
150
|
-
hash: 3
|
151
146
|
segments:
|
152
147
|
- 0
|
153
148
|
version: "0"
|
@@ -156,11 +151,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
151
|
requirements:
|
157
152
|
- - ">="
|
158
153
|
- !ruby/object:Gem::Version
|
159
|
-
hash: 3
|
160
154
|
segments:
|
161
155
|
- 0
|
162
156
|
version: "0"
|
163
157
|
requirements:
|
158
|
+
- bundler
|
164
159
|
- eventmachine
|
165
160
|
- yaml
|
166
161
|
- fileutils
|