ruby-proxy 0.0.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/atu/key.rb +0 -0
- data/lib/atu/sikuli-script.jar +0 -0
- data/lib/atu/sikuli.rb +0 -0
- data/lib/ext/drb_ext.rb +0 -0
- data/lib/ruby_proxy.rb +3 -1
- data/lib/ruby_proxy/client.rb +60 -46
- data/lib/ruby_proxy/config.rb +34 -0
- data/lib/ruby_proxy/exceptions.rb +9 -0
- data/lib/ruby_proxy/proxy.rb +5 -5
- data/lib/ruby_proxy/proxy_load.rb +8 -10
- data/lib/ruby_proxy/server.rb +26 -13
- data/lib/ruby_proxy/version.rb +1 -1
- data/lib/test.rb +15 -0
- data/unittests/all_tests.rb +0 -0
- data/unittests/setup.rb +2 -2
- data/unittests/support/atu/hello.rb +6 -5
- data/unittests/support/config.yml +3 -0
- data/unittests/support/image/search.png +0 -0
- data/unittests/support/image/start.png +0 -0
- data/unittests/test_config.rb +24 -0
- data/unittests/test_drb_proxy.rb +16 -31
- data/unittests/test_sikuli_api.rb +0 -0
- data/unittests/your_jruby_sikuli_config_ok.rb +0 -0
- metadata +45 -56
data/lib/atu/key.rb
CHANGED
File without changes
|
data/lib/atu/sikuli-script.jar
CHANGED
File without changes
|
data/lib/atu/sikuli.rb
CHANGED
File without changes
|
data/lib/ext/drb_ext.rb
CHANGED
File without changes
|
data/lib/ruby_proxy.rb
CHANGED
data/lib/ruby_proxy/client.rb
CHANGED
@@ -5,10 +5,23 @@ require 'socket'
|
|
5
5
|
require 'logger'
|
6
6
|
|
7
7
|
module ATU
|
8
|
+
|
9
|
+
#require redefine
|
10
|
+
class << self
|
11
|
+
alias require_old require
|
12
|
+
|
13
|
+
def require(arg)
|
14
|
+
#TODO: path maybe confict
|
15
|
+
#~ path= File.expand_path File.join(Dir.pwd,arg)
|
16
|
+
#~ path += '.rb'
|
17
|
+
RubyProxy::DRbClient.proxy_load(arg)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
#entry
|
9
22
|
def self.const_missing(name)
|
10
23
|
name = self.name.to_s + "::" + name.to_s
|
11
|
-
type = RubyProxy::DRbClient.client.proxy_type(name
|
24
|
+
type = RubyProxy::DRbClient.client.proxy_type(name)
|
12
25
|
make_kclass(name,type)
|
13
26
|
end
|
14
27
|
|
@@ -19,14 +32,9 @@ module ATU
|
|
19
32
|
RubyProxy::KlassFactory.make_class(name) do |klass|
|
20
33
|
klass.class_eval do
|
21
34
|
def initialize(*arg)
|
22
|
-
#puts self.class.to_s
|
23
35
|
@proxy = RubyProxy::DRbClient.client.proxy(self.class.to_s,"new",*arg)
|
24
|
-
# undef type method
|
25
|
-
# I think all methods should be proxyed by remote
|
26
|
-
#~ class << @proxy
|
27
|
-
#~ undef :type
|
28
|
-
#~ end
|
29
36
|
end
|
37
|
+
# I think all methods should be proxyed by remote
|
30
38
|
undef :type rescue nil
|
31
39
|
undef :to_s
|
32
40
|
undef :to_a if respond_to?(:to_a)
|
@@ -36,11 +44,11 @@ module ATU
|
|
36
44
|
@proxy
|
37
45
|
end
|
38
46
|
|
39
|
-
def method_missing(name,*arg)
|
47
|
+
def method_missing(name,*arg,&block)
|
40
48
|
#return if @proxy.nil?
|
41
49
|
#puts "#{@proxy.methods(false)}"
|
42
50
|
#puts "proxy = #{@proxy} method=#{name} arg=#{arg.join(',')}"
|
43
|
-
@proxy.__send__(name
|
51
|
+
@proxy.__send__(name,*arg,&block)
|
44
52
|
end
|
45
53
|
def self.const_missing(name)
|
46
54
|
name = self.name.to_s + "::" + name.to_s
|
@@ -53,9 +61,9 @@ module ATU
|
|
53
61
|
RubyProxy::DRbClient.client.proxy(name.to_s)
|
54
62
|
end
|
55
63
|
|
56
|
-
# block not support now
|
57
|
-
def self.method_missing(name,*arg)
|
58
|
-
RubyProxy::DRbClient.client.proxy(self.name.to_s,name.to_s,*arg)
|
64
|
+
# TODO: block not support now
|
65
|
+
def self.method_missing(name,*arg,&block)
|
66
|
+
RubyProxy::DRbClient.client.proxy(self.name.to_s,name.to_s,*arg,&block)
|
59
67
|
end
|
60
68
|
|
61
69
|
end
|
@@ -103,7 +111,7 @@ module RubyProxy
|
|
103
111
|
end
|
104
112
|
end
|
105
113
|
|
106
|
-
|
114
|
+
# generate proxy class
|
107
115
|
def self.make_class(klass_name)
|
108
116
|
klass_name = klass_name.to_s
|
109
117
|
name_ok?(klass_name)
|
@@ -132,31 +140,29 @@ module RubyProxy
|
|
132
140
|
raise TypeError," name #{name} can't be class or module name." unless name =~ /^[A-Z][a-zA-Z_0-9]*/
|
133
141
|
end
|
134
142
|
end
|
143
|
+
|
144
|
+
# Get DRbClient
|
135
145
|
class DRbClient
|
136
146
|
@client = nil
|
137
|
-
@port = 9000
|
138
|
-
@ip = "127.0.0.1"
|
139
147
|
@@logger = Logger.new(STDOUT)
|
140
|
-
@@logger.level= Logger::
|
148
|
+
@@logger.level= Logger::INFO
|
141
149
|
class <<self
|
142
150
|
def client
|
143
151
|
begin
|
144
152
|
stop_service if @client.nil?
|
145
|
-
@client
|
146
|
-
|
147
|
-
@client
|
148
|
-
rescue
|
149
|
-
|
150
|
-
@client ||= DRbObject.new(nil,"druby://#{@ip}:#{@port}")
|
151
|
-
@client
|
153
|
+
start_service if @client.nil?
|
154
|
+
connect_addr = "druby://#{Config.ip}:#{Config.port}"
|
155
|
+
@client ||= DRbObject.new(nil,connect_addr)
|
156
|
+
rescue DRb::DRbConnError
|
157
|
+
raise RubyProxy::NotConnError, "can connect to druby server: #{connect_addr}"
|
152
158
|
end
|
153
159
|
end
|
154
160
|
|
155
161
|
def alive?
|
156
162
|
@client.respond_to?("any_thing")
|
157
|
-
|
163
|
+
true
|
158
164
|
rescue DRb::DRbConnError
|
159
|
-
|
165
|
+
false
|
160
166
|
end
|
161
167
|
|
162
168
|
attr_accessor :ip,:port
|
@@ -165,30 +171,29 @@ module RubyProxy
|
|
165
171
|
client.proxy_load(dir_or_file)
|
166
172
|
end
|
167
173
|
|
168
|
-
|
174
|
+
# not use it later
|
175
|
+
def start_service(t=10)
|
169
176
|
message = nil
|
170
|
-
@start_service_log_path = File.join(File.dirname(__FILE__),'start_service.log')
|
171
177
|
@service_log = nil
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
ENV["RUBYOPT"] = "-rubygems"
|
180
|
-
#system("start /I /B jruby -J-Dfile.encoding=UTF-8 ruby_proxy/server.rb #{@ip} #{@port} \"#{org_path}\" ") #> #{@start_service_log_path} 2>&1")
|
181
|
-
@service_log = IO.popen("jruby -J-Dfile.encoding=UTF-8 ruby_proxy/server.rb #{@ip} #{@port} \"#{org_path}\" 2>&1")
|
182
|
-
ENV["RUBYOPT"] = temp
|
183
|
-
end
|
184
|
-
end
|
178
|
+
@@logger.info "start ruby proxy server..."
|
179
|
+
@@logger.info start_command
|
180
|
+
#~ @server_thread = Thread.new do |t|
|
181
|
+
#~ t.abort_on_exception = true
|
182
|
+
@service_log = IO.popen(start_command)
|
183
|
+
#~ end
|
184
|
+
#~ @server_thread.abort_on_exception = true
|
185
185
|
wait_until_server_start_time(t)
|
186
|
-
|
186
|
+
end
|
187
|
+
|
188
|
+
def start_command
|
189
|
+
#raise RubyProxy::CommandNotFoundError, "ruby command can not be found: #{Config.command}" unless File.file?(Config.command)
|
190
|
+
server_file = File.expand_path File.join( File.dirname(__FILE__), 'server.rb' )
|
191
|
+
Config.command + " " + server_file
|
187
192
|
end
|
188
193
|
|
189
194
|
def stop_service(t=5)
|
190
|
-
TCPSocket.new(
|
191
|
-
@client ||= DRbObject.new(nil,"druby://#{
|
195
|
+
TCPSocket.new(Config.ip,Config.port)
|
196
|
+
@client ||= DRbObject.new(nil,"druby://#{Config.ip}:#{Config.port}")
|
192
197
|
@client.stop_proxy
|
193
198
|
sleep 1
|
194
199
|
rescue
|
@@ -201,14 +206,23 @@ module RubyProxy
|
|
201
206
|
def wait_until_server_start_time(t)
|
202
207
|
t.times do |tt|
|
203
208
|
begin
|
204
|
-
|
209
|
+
#~ raise CannotStartServer, "" unless @server_thread.alive?
|
210
|
+
TCPSocket.new(Config.ip,Config.port)
|
205
211
|
@@logger.info "server is starting"
|
212
|
+
do_at_exit
|
206
213
|
return true
|
207
214
|
rescue Exception
|
208
215
|
sleep 1
|
209
216
|
end
|
210
217
|
end
|
211
|
-
raise RuntimeError,"start drbserver fail
|
218
|
+
raise RuntimeError,"start drbserver fail"
|
219
|
+
end
|
220
|
+
|
221
|
+
def do_at_exit
|
222
|
+
at_exit do
|
223
|
+
@@logger.info "try to stop service"
|
224
|
+
stop_service
|
225
|
+
end
|
212
226
|
end
|
213
227
|
|
214
228
|
end
|
@@ -218,4 +232,4 @@ end
|
|
218
232
|
if $0 == __FILE__
|
219
233
|
a = ATU::Hello.new
|
220
234
|
puts a.return_1
|
221
|
-
end
|
235
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module RubyProxy
|
2
|
+
class Config
|
3
|
+
@config = {
|
4
|
+
:ip => '127.0.0.1',
|
5
|
+
:port=> 8000,
|
6
|
+
:command => 'ruby'
|
7
|
+
}
|
8
|
+
class <<self
|
9
|
+
def ip
|
10
|
+
@config[:ip]
|
11
|
+
end
|
12
|
+
|
13
|
+
def ip=(ip)
|
14
|
+
@config[:ip] = ip
|
15
|
+
end
|
16
|
+
|
17
|
+
def port=(port)
|
18
|
+
@config[:port] = port
|
19
|
+
end
|
20
|
+
|
21
|
+
def port
|
22
|
+
@config[:port]
|
23
|
+
end
|
24
|
+
|
25
|
+
def command
|
26
|
+
@config[:command]
|
27
|
+
end
|
28
|
+
|
29
|
+
def command=(command)
|
30
|
+
@config[:command] = command
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module RubyProxy
|
2
|
+
class Error < RuntimeError; end
|
3
|
+
# can not connect to proxy server
|
4
|
+
class NotConError < Error; end
|
5
|
+
#config command config error
|
6
|
+
class CommandNotFoundError < Error; end
|
7
|
+
# start server fail error
|
8
|
+
class CannotStartServer < Error; end
|
9
|
+
end
|
data/lib/ruby_proxy/proxy.rb
CHANGED
@@ -6,7 +6,7 @@ module RubyProxy
|
|
6
6
|
class Proxy
|
7
7
|
# loading proxy class, default folder: atu
|
8
8
|
# you can use Proxy.load_path << "" to add load path
|
9
|
-
ProxyLoad.load
|
9
|
+
#~ ProxyLoad.load
|
10
10
|
@@logger = Logger.new(STDOUT)
|
11
11
|
@@logger.level = Logger::INFO
|
12
12
|
|
@@ -21,9 +21,9 @@ module RubyProxy
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.proxy_load(
|
25
|
-
ProxyLoad.load_path << dir_or_file
|
26
|
-
ProxyLoad.
|
24
|
+
def self.proxy_load(file_or_gem)
|
25
|
+
#~ ProxyLoad.load_path << dir_or_file
|
26
|
+
ProxyLoad.load_file(file_or_gem)
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.proxy_type(klass_name)
|
@@ -44,7 +44,7 @@ module RubyProxy
|
|
44
44
|
klass_name_array.shift if klass_name_array[0] == "ATU"
|
45
45
|
klass_name_array.each do |m|
|
46
46
|
if atu.nil?
|
47
|
-
atu =
|
47
|
+
atu = Kernel.const_get(m)
|
48
48
|
else
|
49
49
|
atu = atu.const_get(m)
|
50
50
|
end
|
@@ -2,8 +2,9 @@ require 'logger'
|
|
2
2
|
module RubyProxy
|
3
3
|
class ProxyLoad
|
4
4
|
@@logger = Logger.new(STDOUT)
|
5
|
-
@@logger.level = Logger::
|
6
|
-
|
5
|
+
@@logger.level = Logger::ERROR
|
6
|
+
#~ @@logger.info $:.join(':')
|
7
|
+
@load_path = []
|
7
8
|
class <<self
|
8
9
|
attr_accessor :load_path
|
9
10
|
def load
|
@@ -12,21 +13,18 @@ module RubyProxy
|
|
12
13
|
Dir[p.chomp("/") + "/*.rb"].each do |file|
|
13
14
|
load_file(file)
|
14
15
|
end
|
15
|
-
elsif File.file?(p)
|
16
|
-
load_file(p)
|
17
16
|
else
|
18
|
-
|
17
|
+
load_file(p)
|
19
18
|
end
|
20
|
-
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
22
|
def load_file(file)
|
25
23
|
@@logger.debug "require file : #{file}"
|
26
|
-
|
27
|
-
rescue LoadError
|
28
|
-
@@logger.warn "require file : #{file} fail,exception
|
29
|
-
|
24
|
+
require file
|
25
|
+
rescue LoadError=>e
|
26
|
+
@@logger.warn "require file : #{file} fail,exception:\n#{e}"
|
27
|
+
raise
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
data/lib/ruby_proxy/server.rb
CHANGED
@@ -1,18 +1,28 @@
|
|
1
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'..')
|
2
|
+
|
3
|
+
require 'rubygems'
|
1
4
|
require 'drb'
|
5
|
+
require 'ruby_proxy/config'
|
2
6
|
require 'ruby_proxy/proxy'
|
3
7
|
require 'drb/timeridconv'
|
4
8
|
module RubyProxy
|
5
9
|
class DRbServer
|
6
|
-
@ip = "127.0.0.1"
|
7
|
-
@port = 9000
|
8
10
|
class << self
|
9
|
-
|
11
|
+
attr_accessor :ip,:port
|
10
12
|
end
|
11
13
|
def self.start_service
|
12
14
|
DRb.install_id_conv(DRb::TimerIdConv.new)
|
13
|
-
DRb.start_service("druby://#{
|
14
|
-
DRb.
|
15
|
+
DRb.start_service("druby://#{Config.ip}:#{Config.port}",Proxy)
|
16
|
+
#~ trap("INT") { DRb.stop_service }
|
17
|
+
# for ruby1.9
|
18
|
+
begin
|
19
|
+
DRb.thread.join
|
20
|
+
rescue Interrupt
|
21
|
+
ensure
|
22
|
+
DRb.stop_service
|
23
|
+
end
|
15
24
|
end
|
25
|
+
|
16
26
|
def self.stop_service
|
17
27
|
DRb.stop_service
|
18
28
|
end
|
@@ -20,15 +30,18 @@ module RubyProxy
|
|
20
30
|
end
|
21
31
|
|
22
32
|
if $0 == __FILE__
|
23
|
-
['INT'].each do |signal|
|
24
|
-
trap(signal) {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
puts "start server
|
33
|
+
#~ ['INT'].each do |signal|
|
34
|
+
#~ trap(signal) {
|
35
|
+
#~ puts 'exit...'
|
36
|
+
#~ RubyProxy::DRbServer.stop_service
|
37
|
+
#~ }
|
38
|
+
#~ end
|
39
|
+
#~ puts "start server ip:#{ARGV[0] || "127.0.0.1"}"
|
40
|
+
#~ puts "start server port:#{ARGV[1] || 9000}"
|
30
41
|
RubyProxy::DRbServer.ip = ARGV[0] unless ARGV[0].nil?
|
31
42
|
RubyProxy::DRbServer.port = ARGV[1] unless ARGV[1].nil?
|
32
|
-
|
43
|
+
puts "start server ip: #{RubyProxy::DRbServer.ip}"
|
44
|
+
puts "start server port:#{RubyProxy::DRbServer.port}"
|
45
|
+
#~ Dir.chdir ARGV[2] unless ARGV[2].nil?
|
33
46
|
RubyProxy::DRbServer.start_service
|
34
47
|
end
|
data/lib/ruby_proxy/version.rb
CHANGED
data/lib/test.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
2
|
+
#~ $LOAD_PATH << 'C:\jruby-1.5.6\lib\ruby\gems\1.8\gems\sikuli-0.2.3\lib'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ruby_proxy'
|
5
|
+
|
6
|
+
ATU::require 'rubygems'
|
7
|
+
ATU::require 'java'
|
8
|
+
|
9
|
+
ATU::require 'sikuli'
|
10
|
+
|
11
|
+
screen = ATU::Sikuli::Screen.new
|
12
|
+
screen.click(10,10)
|
13
|
+
#~ browser = ATU::Watir::Browser.new(:ff)
|
14
|
+
|
15
|
+
#~ browser.goto("http://google.hk")
|
data/unittests/all_tests.rb
CHANGED
File without changes
|
data/unittests/setup.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
|
-
$LOAD_PATH.unshift File.join(__FILE__,'..','
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'..','lib') unless $LOADED
|
3
3
|
$LOADED = true
|
4
4
|
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
7
|
require 'ruby_proxy'
|
8
8
|
|
9
|
-
$all_tests = Dir['test_*.rb']
|
9
|
+
$all_tests = Dir['test_*.rb']
|
@@ -7,7 +7,7 @@ module B
|
|
7
7
|
end
|
8
8
|
|
9
9
|
|
10
|
-
module ATU
|
10
|
+
#~ module ATU
|
11
11
|
class Hello
|
12
12
|
def initialize
|
13
13
|
end
|
@@ -77,6 +77,7 @@ module ATU
|
|
77
77
|
var = 1
|
78
78
|
yield var
|
79
79
|
end
|
80
|
+
|
80
81
|
def b(*arg)
|
81
82
|
var = 1
|
82
83
|
yield var if block_given?
|
@@ -90,15 +91,15 @@ module ATU
|
|
90
91
|
|
91
92
|
class Hello7
|
92
93
|
def to_a
|
93
|
-
puts "call to_a"
|
94
|
+
#~ puts "call to_a"
|
94
95
|
[1,2,3]
|
95
96
|
end
|
96
97
|
def type(a)
|
97
|
-
puts "call type"
|
98
|
+
#~ puts "call type"
|
98
99
|
"a"
|
99
100
|
end
|
100
101
|
def to_s
|
101
|
-
puts "call to_s"
|
102
|
+
#~ puts "call to_s"
|
102
103
|
return "b"
|
103
104
|
end
|
104
105
|
def normal
|
@@ -108,5 +109,5 @@ module ATU
|
|
108
109
|
|
109
110
|
end
|
110
111
|
|
111
|
-
end
|
112
|
+
#~ end
|
112
113
|
|
File without changes
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
|
+
require 'setup'
|
3
|
+
|
4
|
+
class TestConfig < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@config = RubyProxy::Config
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_config_default
|
10
|
+
assert_equal(8000, @config.port)
|
11
|
+
assert_equal('127.0.0.1', @config.ip)
|
12
|
+
assert_equal('ruby', @config.command)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_config_personal
|
16
|
+
@config.port = 1111
|
17
|
+
assert_equal(1111, @config.port)
|
18
|
+
@config.ip = '1.1.1.1'
|
19
|
+
assert_equal('1.1.1.1', @config.ip)
|
20
|
+
@config.command = 'ruby'
|
21
|
+
assert_equal('ruby', @config.command)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/unittests/test_drb_proxy.rb
CHANGED
@@ -6,24 +6,20 @@ class Me
|
|
6
6
|
def a
|
7
7
|
"a"
|
8
8
|
end
|
9
|
-
|
10
9
|
end
|
11
10
|
|
12
11
|
|
13
12
|
class TestDrbProxy < Test::Unit::TestCase
|
14
|
-
|
13
|
+
|
15
14
|
def setup
|
16
|
-
|
17
|
-
@@atu = File.expand_path(File.join(__FILE__,'..','support','atu'))
|
18
|
-
RubyProxy::DRbClient.proxy_load(@@atu)
|
15
|
+
ATU::require 'support/atu/hello'
|
19
16
|
end
|
20
17
|
|
21
|
-
def
|
18
|
+
def test_server_start_ok
|
22
19
|
assert_kind_of(DRbObject,RubyProxy::DRbClient.client)
|
23
20
|
end
|
24
21
|
def test_atu_ok
|
25
22
|
a = ATU::Hello.new
|
26
|
-
#~ puts "aaa= #{a}"
|
27
23
|
assert_equal(1,a.return_1)
|
28
24
|
assert_equal("1",a.return_str_1)
|
29
25
|
end
|
@@ -47,38 +43,30 @@ class TestDrbProxy < Test::Unit::TestCase
|
|
47
43
|
a = Me.new
|
48
44
|
assert_equal("a",a.a)
|
49
45
|
a = ATU::Hello.new
|
50
|
-
|
51
|
-
assert_equal([1,"1"],a.return_vars(1,"1",3,4))
|
52
|
-
assert_equal([1,"1"],a.return_vars(1,"1",3,4))
|
53
|
-
assert_equal([1,"1"],a.return_vars(1,"1",3,4))
|
54
|
-
assert_equal([1,"1"],a.return_vars(1,"1",3,4))
|
55
|
-
assert_equal([1,"1"],a.return_vars(1,"1",3,4))
|
46
|
+
assert_equal([1,"1"],a.return_vars(1,"1",3,4))
|
56
47
|
end
|
57
48
|
|
58
49
|
def test_support_thread
|
59
50
|
a = Me.new
|
60
51
|
assert_equal("a",a.a)
|
52
|
+
|
61
53
|
t = Thread.new do
|
62
54
|
a = ATU::Hello.new
|
63
55
|
for i in 1..100 do
|
64
56
|
assert_equal(1,a.return_1)
|
65
57
|
assert_equal(1,a.return_1)
|
66
|
-
|
67
|
-
#sleep 1
|
68
58
|
end
|
69
59
|
end
|
60
|
+
|
70
61
|
b = ATU::Hello.new
|
71
62
|
assert_equal(1,b.return_1)
|
72
63
|
assert_equal("1",b.return_str_1)
|
73
|
-
#sleep 20
|
74
|
-
|
75
|
-
assert_equal("1",b.return_str_1)
|
76
64
|
t.join
|
77
65
|
c = ATU::Hello.new
|
78
66
|
assert_equal(1,c.return_1)
|
79
67
|
end
|
80
68
|
|
81
|
-
def
|
69
|
+
def test_method_missing_and_more_time
|
82
70
|
a = ATU::Hello3.new(1,"2")
|
83
71
|
i=1
|
84
72
|
1.upto(100) do |i|
|
@@ -86,21 +74,18 @@ class TestDrbProxy < Test::Unit::TestCase
|
|
86
74
|
end
|
87
75
|
end
|
88
76
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
77
|
def test_atu_gue
|
93
78
|
assert_raise(NameError) do
|
94
79
|
ATU::ExistNo.new
|
95
80
|
end
|
96
81
|
end
|
97
82
|
|
98
|
-
def test_atu_sikuli
|
99
|
-
screen = ATU::Sikuli::Region.new(0,0,1440,900)
|
100
|
-
assert_not_nil(screen)
|
101
|
-
end
|
102
|
-
|
103
|
-
def
|
83
|
+
#~ def test_atu_sikuli
|
84
|
+
#~ screen = ATU::Sikuli::Region.new(0,0,1440,900)
|
85
|
+
#~ assert_not_nil(screen)
|
86
|
+
#~ end
|
87
|
+
|
88
|
+
def test_multi_modules
|
104
89
|
a = ATU::M1::Hello4.new
|
105
90
|
assert_equal("one",a.one("test"))
|
106
91
|
end
|
@@ -123,13 +108,13 @@ class TestDrbProxy < Test::Unit::TestCase
|
|
123
108
|
# I will do fixing it later.
|
124
109
|
def test_block_ok
|
125
110
|
a = ATU::M1::Hello6.new
|
126
|
-
assert_equal(1,a.
|
111
|
+
assert_equal(1,a.b() {|i| i})
|
127
112
|
end
|
128
113
|
|
129
114
|
def test_file_path
|
130
115
|
assert_equal([__FILE__],ATU::M1::Hello6.a(__FILE__))
|
131
|
-
path = File.join(__FILE__,'
|
132
|
-
assert_equal(
|
116
|
+
path = File.expand_path File.join(File.dirname(__FILE__),'support','atu','hello.rb')
|
117
|
+
assert_equal(File.exist?(path),ATU::M1::Hello6.file_exist?(path))
|
133
118
|
end
|
134
119
|
|
135
120
|
#now pass it
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,88 +1,77 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-proxy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
- yafei
|
7
|
+
authors:
|
8
|
+
- yafei Lee
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2011-09-25 00:00:00 +08:00
|
18
|
-
default_executable:
|
12
|
+
date: 2012-04-19 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
22
|
-
email: lyfi2003@sina.com
|
14
|
+
description: Ruby Proxy for two or more ruby processes.
|
15
|
+
email: lyfi2003@gmail.com
|
23
16
|
executables: []
|
24
|
-
|
25
17
|
extensions: []
|
26
|
-
|
27
18
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
|
30
|
-
- lib/atu/key.rb
|
31
|
-
- lib/atu/sikuli-script.jar
|
32
|
-
- lib/atu/sikuli.rb
|
33
|
-
- lib/ext/drb_ext.rb
|
19
|
+
files:
|
20
|
+
- lib/ruby_proxy/config.rb
|
34
21
|
- lib/ruby_proxy/client.rb
|
35
|
-
- lib/ruby_proxy/
|
22
|
+
- lib/ruby_proxy/exceptions.rb
|
36
23
|
- lib/ruby_proxy/proxy_load.rb
|
37
24
|
- lib/ruby_proxy/server.rb
|
38
25
|
- lib/ruby_proxy/version.rb
|
26
|
+
- lib/ruby_proxy/proxy.rb
|
39
27
|
- lib/ruby_proxy.rb
|
28
|
+
- lib/atu/sikuli.rb
|
29
|
+
- lib/atu/sikuli-script.jar
|
30
|
+
- lib/atu/key.rb
|
31
|
+
- lib/test.rb
|
32
|
+
- lib/ext/drb_ext.rb
|
33
|
+
- unittests/test_drb_proxy.rb
|
34
|
+
- unittests/your_jruby_sikuli_config_ok.rb
|
35
|
+
- unittests/test_config.rb
|
40
36
|
- unittests/all_tests.rb
|
41
|
-
- unittests/
|
42
|
-
- unittests/support/atu/hello.rb
|
37
|
+
- unittests/support/config.yml
|
43
38
|
- unittests/support/image/search.png
|
44
39
|
- unittests/support/image/start.png
|
45
|
-
- unittests/
|
40
|
+
- unittests/support/atu/hello.rb
|
46
41
|
- unittests/test_sikuli_api.rb
|
47
|
-
- unittests/
|
48
|
-
has_rdoc: true
|
42
|
+
- unittests/setup.rb
|
49
43
|
homepage: https://github.com/windy/ruby_proxy
|
50
44
|
licenses: []
|
51
|
-
|
52
45
|
post_install_message:
|
53
46
|
rdoc_options: []
|
54
|
-
|
55
|
-
require_paths:
|
47
|
+
require_paths:
|
56
48
|
- lib
|
57
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
50
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
64
|
-
version: "0"
|
65
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
56
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
- 0
|
72
|
-
version: "0"
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
73
61
|
requirements: []
|
74
|
-
|
75
|
-
|
76
|
-
rubygems_version: 1.3.7
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.8.22
|
77
64
|
signing_key:
|
78
65
|
specification_version: 3
|
79
|
-
summary: Ruby Proxy for
|
80
|
-
test_files:
|
66
|
+
summary: Ruby Proxy for two or more ruby processes.
|
67
|
+
test_files:
|
68
|
+
- unittests/test_drb_proxy.rb
|
69
|
+
- unittests/your_jruby_sikuli_config_ok.rb
|
70
|
+
- unittests/test_config.rb
|
81
71
|
- unittests/all_tests.rb
|
82
|
-
- unittests/
|
83
|
-
- unittests/support/atu/hello.rb
|
72
|
+
- unittests/support/config.yml
|
84
73
|
- unittests/support/image/search.png
|
85
74
|
- unittests/support/image/start.png
|
86
|
-
- unittests/
|
75
|
+
- unittests/support/atu/hello.rb
|
87
76
|
- unittests/test_sikuli_api.rb
|
88
|
-
- unittests/
|
77
|
+
- unittests/setup.rb
|