iCuke 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,27 @@
1
+ == 0.4.8 (2010-04-22)
2
+
3
+ === Stability
4
+ * Try quitting XCode and restarting it if we aren't able to load the simulator
5
+
6
+ == 0.4.7 (2010-04-22)
7
+
8
+ === Bugfixes
9
+ * Work around a bug in some Ruby 1.8.7.* Net::HTTP code which causes the simulator to raise NoMethodError (Rob Holland, Aslak Hellesøy)
10
+
11
+ == 0.4.6 (2010-04-21)
12
+
13
+ === Bugfixes
14
+ * Depend on cucumber and nokogiri
15
+ * Escape values and labels in XML so we don't produce invalid markup
16
+
17
+ == 0.4.5 (2010-04-21)
18
+
19
+ === Bugfixes
20
+ * More reliable keyboard switching
21
+
22
+ == 0.4.4 (2010-04-21)
23
+
24
+ === Bugfixes
25
+ * Allow ' in xpath queries
26
+ * Allow typing spaces in inputs
27
+ * Correct swipe behaviour in all directions (Rob Holland, Dominic Baggott)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.4.8
data/iCuke.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{iCuke}
8
- s.version = "0.4.7"
8
+ s.version = "0.4.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rob Holland"]
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".gitignore",
22
+ "History.txt",
22
23
  "LICENSE",
23
24
  "README.rdoc",
24
25
  "Rakefile",
@@ -6,6 +6,7 @@ require 'timeout'
6
6
 
7
7
  module ICuke
8
8
  class Simulator
9
+ include Timeout
9
10
  include HTTParty
10
11
  base_uri 'http://localhost:50000'
11
12
 
@@ -22,41 +23,67 @@ module ICuke
22
23
  simulator = Appscript.app('iPhone Simulator.app')
23
24
  simulator.quit if simulator.is_running?
24
25
 
25
- xcode = Appscript.app('Xcode.app')
26
- xcode.launch
27
- xcode.open project_file
28
- project = xcode.active_project_document.project
29
-
30
- initial_build_configuration_type = project.active_build_configuration_type.get
31
- project.active_build_configuration_type.set project.build_configuration_types[options[:configuration]]
32
-
33
- if options[:target]
34
- initial_target = project.active_target.get
35
- project.active_target.set project.targets[options[:target]]
36
- end
37
-
38
- executable = project.active_executable.get
39
- options[:env].each_pair do |name, value|
40
- executable.make :new => :environment_variable,
41
- :with_properties => { :name => name, :value => value, :active => true }
26
+ begin
27
+ project = open_project(project_file)
28
+
29
+ settings = {
30
+ :active_build_configuration_type => project.build_configuration_types[options[:configuration]]
31
+ }
32
+ if options[:target]
33
+ settings[:active_target] = project.targets[options[:target]]
34
+ end
35
+
36
+ with_settings(project, settings) do
37
+ executable = project.active_executable.get
38
+ options[:env].each_pair do |name, value|
39
+ executable.make :new => :environment_variable,
40
+ :with_properties => { :name => name, :value => value, :active => true }
41
+ end
42
+
43
+ project.launch_
44
+
45
+ timeout(30) do
46
+ sleep(0.5) until simulator.is_running?
47
+ end
48
+ end
49
+ rescue Timeout::Error
50
+ xcode = Appscript.app('Xcode.app')
51
+ xcode.quit if xcode.is_running?
52
+ sleep(0.5) until !xcode.is_running?
53
+ retry
42
54
  end
43
- project.launch_
44
55
 
45
- Timeout::timeout(30) do
56
+ timeout(30) do
46
57
  begin
47
58
  view
48
59
  rescue Errno::ECONNREFUSED
49
- sleep(0.1)
60
+ sleep(0.5)
50
61
  retry
51
62
  end
52
63
  end
53
- ensure
54
- # Restore the active build settings
55
- if initial_build_configuration_type
56
- project.active_build_configuration_type.set initial_build_configuration_type
64
+ end
65
+
66
+ def open_project(project_file)
67
+ xcode = Appscript.app('Xcode.app')
68
+ unless xcode.active_project_document.get and xcode.active_project_document.project.path.get == project_file
69
+ xcode.launch
70
+ xcode.open project_file
71
+ end
72
+ xcode.active_project_document.project
73
+ end
74
+
75
+ def with_settings(project, settings, &block)
76
+ initial_settings = {}
77
+
78
+ settings.each_key { |setting| initial_settings[setting] = project.send(setting).get }
79
+ settings.each_pair do |setting, value|
80
+ project.send(setting).set value
57
81
  end
58
- if initial_target
59
- project.active_target.set initial_target
82
+
83
+ yield
84
+ ensure
85
+ initial_settings.each_pair do |setting, value|
86
+ project.send(setting).set value
60
87
  end
61
88
  end
62
89
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 7
9
- version: 0.4.7
8
+ - 8
9
+ version: 0.4.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rob Holland
@@ -76,6 +76,7 @@ extra_rdoc_files:
76
76
  - README.rdoc
77
77
  files:
78
78
  - .gitignore
79
+ - History.txt
79
80
  - LICENSE
80
81
  - README.rdoc
81
82
  - Rakefile