calabash-cucumber 0.9.93 → 0.9.94

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,9 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- calabash-cucumber (0.9.92)
4
+ calabash-cucumber (0.9.94)
5
5
  CFPropertyList
6
+ bundler (~> 1.1)
6
7
  cucumber
8
+ httpclient (~> 2.2.7)
7
9
  json
8
10
  location-one (~> 0.0.5)
9
11
  sim_launcher (= 0.3.8)
@@ -23,6 +25,7 @@ GEM
23
25
  geocoder (1.1.2)
24
26
  gherkin (2.11.1)
25
27
  json (>= 1.4.6)
28
+ httpclient (2.2.7)
26
29
  json (1.7.4)
27
30
  location-one (0.0.5)
28
31
  geocoder (~> 1.1)
data/bin/calabash-ios CHANGED
@@ -47,6 +47,10 @@ elsif cmd == 'check'
47
47
  elsif cmd == 'submit'
48
48
  calabash_submit(ARGV)
49
49
  exit 0
50
+ elsif cmd == 'version'
51
+ require 'calabash-cucumber'
52
+ puts Calabash::Cucumber::VERSION
53
+ exit 0
50
54
  elsif cmd == 'sim'
51
55
  if ARGV.length == 0
52
56
  print_usage
@@ -22,5 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency( "sim_launcher", "0.3.8") #Recommended by Pete for now
23
23
  s.add_dependency( "slowhandcuke" )
24
24
  s.add_dependency( "location-one", "~>0.0.5")
25
+ s.add_dependency( "httpclient","~> 2.2.7")
26
+ s.add_dependency( "bundler", "~> 1.1")
25
27
 
26
28
  end
@@ -1,3 +1,5 @@
1
+ require 'httpclient'
2
+
1
3
  module Calabash
2
4
  module Cucumber
3
5
  module Core
@@ -302,36 +304,16 @@ module Calabash
302
304
  end
303
305
 
304
306
  def http(options, data=nil)
305
- url = url_for(options[:path])
306
- if options[:method] == :post
307
- req = Net::HTTP::Post.new url.path
307
+ options[:uri] = url_for(options[:path])
308
+ options[:method] = options[:method] || :get
309
+ if data
308
310
  if options[:raw]
309
- req.body=data
311
+ options[:body] = data
310
312
  else
311
- req.body = data.to_json
313
+ options[:body] = data.to_json
312
314
  end
313
-
314
- else
315
- req = Net::HTTP::Get.new url.path
316
- if data
317
- if URI.respond_to? :encode_www_form
318
- url.query = URI.encode_www_form(data)
319
- else
320
- ##suport only "safe" ascii params for now
321
- url.query = enum.map do |k, v|
322
- "#{k.to_s}=#{v.to_s}"
323
- end.join('&')
324
- end
325
- resp = Net::HTTP.get_response(url)
326
- if resp.is_a? Net::HTTPSuccess
327
- return resp.body
328
- else
329
- raise "HTTP-level Error #{resp}"
330
- end
331
- end
332
-
333
315
  end
334
- make_http_request(url, req)
316
+ make_http_request(options)
335
317
  end
336
318
 
337
319
 
@@ -349,29 +331,48 @@ module Calabash
349
331
 
350
332
  CAL_HTTP_RETRY_COUNT=3
351
333
 
352
- def make_http_request(url, req)
334
+ def make_http_request(options)
353
335
  body = nil
354
336
  CAL_HTTP_RETRY_COUNT.times do |count|
355
337
  begin
356
- if not (@http) or not (@http.started?)
357
- @http = init_request(url)
358
- @http.start
338
+ if not @http
339
+ @http = init_request(options)
340
+ end
341
+ if options[:method] == :post
342
+ body = @http.post(options[:uri], options[:body]).body
343
+ else
344
+ body = @http.get(options[:uri], options[:body]).body
359
345
  end
360
- body = @http.request(req).body
361
346
  break
362
- rescue Errno::ECONNRESET, EOFError, Errno::ECONNREFUSED, Errno::EPIPE, Timeout::Error => e
363
-
347
+ rescue HTTPClient::TimeoutError => e
364
348
  if count < CAL_HTTP_RETRY_COUNT-1
365
- if e.is_a?(Timeout::Error)
366
- sleep(5)
367
- else
368
- sleep(0.3)
369
- end
370
- puts "Retrying.. #{e.class}: (#{e})"
349
+ sleep(0.5)
350
+ @http.reset_all
351
+ @http=nil
352
+ STDOUT.write "Retrying.. #{e.class}: (#{e})\n"
353
+ STDOUT.flush
354
+
371
355
  else
372
356
  puts "Failing... #{e.class}"
373
357
  raise e
374
358
  end
359
+ rescue Exception => e
360
+ case e
361
+ when Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ETIMEDOUT
362
+ if count < CAL_HTTP_RETRY_COUNT-1
363
+ sleep(0.5)
364
+ @http.reset_all
365
+ @http=nil
366
+ STDOUT.write "Retrying.. #{e.class}: (#{e})\n"
367
+ STDOUT.flush
368
+
369
+ else
370
+ puts "Failing... #{e.class}"
371
+ raise e
372
+ end
373
+ else
374
+ raise e
375
+ end
375
376
  end
376
377
  end
377
378
 
@@ -379,13 +380,10 @@ module Calabash
379
380
  end
380
381
 
381
382
  def init_request(url)
382
- http = Net::HTTP.new(url.host, url.port)
383
- if http.respond_to? :open_timeout=
384
- http.open_timeout==15
385
- end
386
- if http.respond_to?(:read_timeout=)
387
- http.read_timeout = 30
388
- end
383
+ http = HTTPClient.new
384
+ http.connect_timeout = 15
385
+ http.send_timeout = 15
386
+ http.receive_timeout = 15
389
387
  http
390
388
  end
391
389
  end
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = "0.9.93"
3
+ VERSION = "0.9.94"
4
4
  FRAMEWORK_VERSION = "0.9.93"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.93
4
+ version: 0.9.94
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-15 00:00:00.000000000 Z
12
+ date: 2012-08-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -107,6 +107,38 @@ dependencies:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
109
  version: 0.0.5
110
+ - !ruby/object:Gem::Dependency
111
+ name: httpclient
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 2.2.7
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 2.2.7
126
+ - !ruby/object:Gem::Dependency
127
+ name: bundler
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: '1.1'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '1.1'
110
142
  description: calabash-cucumber drives tests for native iOS apps. You must link your
111
143
  app with calabash-ios-server framework to execute tests.
112
144
  email: