iCuke 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/.gitignore +13 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +69 -0
  4. data/Rakefile +80 -0
  5. data/VERSION +1 -0
  6. data/app/iCuke/.gitignore +1 -0
  7. data/app/iCuke/Classes/FlipsideView.h +13 -0
  8. data/app/iCuke/Classes/FlipsideView.m +32 -0
  9. data/app/iCuke/Classes/FlipsideViewController.h +25 -0
  10. data/app/iCuke/Classes/FlipsideViewController.m +54 -0
  11. data/app/iCuke/Classes/MainView.h +15 -0
  12. data/app/iCuke/Classes/MainView.m +32 -0
  13. data/app/iCuke/Classes/MainViewController.h +16 -0
  14. data/app/iCuke/Classes/MainViewController.m +86 -0
  15. data/app/iCuke/Classes/iCukeAppDelegate.h +20 -0
  16. data/app/iCuke/Classes/iCukeAppDelegate.m +33 -0
  17. data/app/iCuke/FlipsideView.xib +444 -0
  18. data/app/iCuke/MainView.xib +520 -0
  19. data/app/iCuke/MainWindow.xib +355 -0
  20. data/app/iCuke/SniffingView.h +20 -0
  21. data/app/iCuke/SniffingView.m +191 -0
  22. data/app/iCuke/iCuke-Info.plist +30 -0
  23. data/app/iCuke/iCuke.xcodeproj/project.pbxproj +313 -0
  24. data/app/iCuke/iCuke_Prefix.pch +14 -0
  25. data/app/iCuke/main.m +16 -0
  26. data/ext/iCuke/.gitignore +2 -0
  27. data/ext/iCuke/DefaultsResponse.h +5 -0
  28. data/ext/iCuke/DefaultsResponse.m +67 -0
  29. data/ext/iCuke/EventResponse.h +5 -0
  30. data/ext/iCuke/EventResponse.m +122 -0
  31. data/ext/iCuke/Rakefile +22 -0
  32. data/ext/iCuke/Recorder.h +15 -0
  33. data/ext/iCuke/Recorder.m +85 -0
  34. data/ext/iCuke/RecorderResponse.h +5 -0
  35. data/ext/iCuke/RecorderResponse.m +59 -0
  36. data/ext/iCuke/SynthesizeSingleton.h +68 -0
  37. data/ext/iCuke/ViewResponse.h +5 -0
  38. data/ext/iCuke/ViewResponse.m +84 -0
  39. data/ext/iCuke/Viewer.h +8 -0
  40. data/ext/iCuke/Viewer.m +153 -0
  41. data/ext/iCuke/iCukeHTTPResponseHandler.h +50 -0
  42. data/ext/iCuke/iCukeHTTPResponseHandler.m +381 -0
  43. data/ext/iCuke/iCukeHTTPServer.h +53 -0
  44. data/ext/iCuke/iCukeHTTPServer.m +365 -0
  45. data/ext/iCuke/iCukeServer.h +16 -0
  46. data/ext/iCuke/iCukeServer.m +46 -0
  47. data/ext/iCuke/json/JSON.h +50 -0
  48. data/ext/iCuke/json/NSObject+SBJSON.h +68 -0
  49. data/ext/iCuke/json/NSObject+SBJSON.m +53 -0
  50. data/ext/iCuke/json/NSString+SBJSON.h +58 -0
  51. data/ext/iCuke/json/NSString+SBJSON.m +55 -0
  52. data/ext/iCuke/json/SBJSON.h +75 -0
  53. data/ext/iCuke/json/SBJSON.m +212 -0
  54. data/ext/iCuke/json/SBJsonBase.h +86 -0
  55. data/ext/iCuke/json/SBJsonBase.m +78 -0
  56. data/ext/iCuke/json/SBJsonParser.h +87 -0
  57. data/ext/iCuke/json/SBJsonParser.m +475 -0
  58. data/ext/iCuke/json/SBJsonWriter.h +129 -0
  59. data/ext/iCuke/json/SBJsonWriter.m +228 -0
  60. data/features/icuke.feature +17 -0
  61. data/features/support/env.rb +3 -0
  62. data/iCuke.gemspec +113 -0
  63. data/lib/icuke/cucumber.rb +211 -0
  64. data/lib/icuke/simulate.rb +132 -0
  65. data/lib/icuke/simulator.rb +107 -0
  66. data/lib/icuke.rb +1 -0
  67. metadata +163 -0
@@ -0,0 +1,107 @@
1
+ require 'httparty'
2
+ require 'appscript'
3
+ require 'timeout'
4
+
5
+ module ICuke
6
+ class Simulator
7
+ include HTTParty
8
+ base_uri 'http://localhost:50000'
9
+
10
+ class Error < StandardError; end
11
+
12
+ def launch(project_file, options = {})
13
+ options = {
14
+ :target => nil,
15
+ :configuration => 'Debug'
16
+ }.merge(options)
17
+
18
+ # If we don't kill the simulator first the rest of this function becomes
19
+ # a no-op and we don't land on the applications first page
20
+ simulator = Appscript.app('iPhone Simulator.app')
21
+ simulator.quit if simulator.is_running?
22
+
23
+ xcode = Appscript.app('Xcode.app')
24
+ xcode.launch
25
+ xcode.open project_file
26
+ project = xcode.active_project_document.project
27
+
28
+ initial_build_configuration_type = project.active_build_configuration_type.get
29
+ project.active_build_configuration_type.set project.build_configuration_types[options[:configuration]]
30
+
31
+ if options[:target]
32
+ initial_target = project.active_target.get
33
+ project.active_target.set project.targets[options[:target]]
34
+ end
35
+
36
+ executable = project.active_executable.get
37
+ options[:env].each_pair do |name, value|
38
+ executable.make :new => :environment_variable,
39
+ :with_properties => { :name => name, :value => value, :active => true }
40
+ end
41
+ project.launch_
42
+
43
+ Timeout::timeout(30) do
44
+ begin
45
+ view
46
+ rescue Errno::ECONNREFUSED
47
+ sleep(0.1)
48
+ retry
49
+ end
50
+ end
51
+ ensure
52
+ # Restore the active build settings
53
+ if initial_build_configuration_type
54
+ project.active_build_configuration_type.set initial_build_configuration_type
55
+ end
56
+ if initial_target
57
+ project.active_target.set initial_target
58
+ end
59
+ end
60
+
61
+ def quit
62
+ Appscript.app('iPhone Simulator.app').quit
63
+ end
64
+
65
+ def view
66
+ get('/view')
67
+ end
68
+
69
+ def record
70
+ get '/record'
71
+ end
72
+
73
+ def stop
74
+ get '/stop'
75
+ end
76
+
77
+ def save(path)
78
+ get '/save', :query => URI.escape(path)
79
+ end
80
+
81
+ def load(path)
82
+ get '/load', :query => URI.escape(path)
83
+ end
84
+
85
+ def play
86
+ get '/play'
87
+ end
88
+
89
+ def fire_event(event)
90
+ get '/event', :query => URI.escape(event.to_json)
91
+ end
92
+
93
+ def set_defaults(defaults)
94
+ get '/defaults', :query => URI.escape(defaults.to_json)
95
+ end
96
+
97
+ private
98
+
99
+ def get(path, options = {})
100
+ response = self.class.get(path, options)
101
+ if response.code != 200
102
+ raise Simulator::Error, response.body
103
+ end
104
+ response.body
105
+ end
106
+ end
107
+ end
data/lib/icuke.rb ADDED
@@ -0,0 +1 @@
1
+ require 'icuke/simulator'
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iCuke
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 5
9
+ version: 0.4.5
10
+ platform: ruby
11
+ authors:
12
+ - Rob Holland
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-04-21 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: cucumber
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: rb-appscript
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: httparty
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :runtime
55
+ version_requirements: *id003
56
+ description: Cucumber support for iPhone applications
57
+ email: rob@the-it-refinery.co.uk
58
+ executables: []
59
+
60
+ extensions:
61
+ - ext/iCuke/Rakefile
62
+ extra_rdoc_files:
63
+ - LICENSE
64
+ - README.rdoc
65
+ files:
66
+ - .gitignore
67
+ - LICENSE
68
+ - README.rdoc
69
+ - Rakefile
70
+ - VERSION
71
+ - app/iCuke/.gitignore
72
+ - app/iCuke/Classes/FlipsideView.h
73
+ - app/iCuke/Classes/FlipsideView.m
74
+ - app/iCuke/Classes/FlipsideViewController.h
75
+ - app/iCuke/Classes/FlipsideViewController.m
76
+ - app/iCuke/Classes/MainView.h
77
+ - app/iCuke/Classes/MainView.m
78
+ - app/iCuke/Classes/MainViewController.h
79
+ - app/iCuke/Classes/MainViewController.m
80
+ - app/iCuke/Classes/iCukeAppDelegate.h
81
+ - app/iCuke/Classes/iCukeAppDelegate.m
82
+ - app/iCuke/FlipsideView.xib
83
+ - app/iCuke/MainView.xib
84
+ - app/iCuke/MainWindow.xib
85
+ - app/iCuke/SniffingView.h
86
+ - app/iCuke/SniffingView.m
87
+ - app/iCuke/iCuke-Info.plist
88
+ - app/iCuke/iCuke.xcodeproj/project.pbxproj
89
+ - app/iCuke/iCuke_Prefix.pch
90
+ - app/iCuke/main.m
91
+ - ext/iCuke/.gitignore
92
+ - ext/iCuke/DefaultsResponse.h
93
+ - ext/iCuke/DefaultsResponse.m
94
+ - ext/iCuke/EventResponse.h
95
+ - ext/iCuke/EventResponse.m
96
+ - ext/iCuke/Rakefile
97
+ - ext/iCuke/Recorder.h
98
+ - ext/iCuke/Recorder.m
99
+ - ext/iCuke/RecorderResponse.h
100
+ - ext/iCuke/RecorderResponse.m
101
+ - ext/iCuke/SynthesizeSingleton.h
102
+ - ext/iCuke/ViewResponse.h
103
+ - ext/iCuke/ViewResponse.m
104
+ - ext/iCuke/Viewer.h
105
+ - ext/iCuke/Viewer.m
106
+ - ext/iCuke/iCukeHTTPResponseHandler.h
107
+ - ext/iCuke/iCukeHTTPResponseHandler.m
108
+ - ext/iCuke/iCukeHTTPServer.h
109
+ - ext/iCuke/iCukeHTTPServer.m
110
+ - ext/iCuke/iCukeServer.h
111
+ - ext/iCuke/iCukeServer.m
112
+ - ext/iCuke/json/JSON.h
113
+ - ext/iCuke/json/NSObject+SBJSON.h
114
+ - ext/iCuke/json/NSObject+SBJSON.m
115
+ - ext/iCuke/json/NSString+SBJSON.h
116
+ - ext/iCuke/json/NSString+SBJSON.m
117
+ - ext/iCuke/json/SBJSON.h
118
+ - ext/iCuke/json/SBJSON.m
119
+ - ext/iCuke/json/SBJsonBase.h
120
+ - ext/iCuke/json/SBJsonBase.m
121
+ - ext/iCuke/json/SBJsonParser.h
122
+ - ext/iCuke/json/SBJsonParser.m
123
+ - ext/iCuke/json/SBJsonWriter.h
124
+ - ext/iCuke/json/SBJsonWriter.m
125
+ - features/icuke.feature
126
+ - features/support/env.rb
127
+ - iCuke.gemspec
128
+ - lib/icuke.rb
129
+ - lib/icuke/cucumber.rb
130
+ - lib/icuke/simulate.rb
131
+ - lib/icuke/simulator.rb
132
+ has_rdoc: true
133
+ homepage: http://github.com/unboxed/iCuke
134
+ licenses: []
135
+
136
+ post_install_message:
137
+ rdoc_options:
138
+ - --charset=UTF-8
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ segments:
153
+ - 0
154
+ version: "0"
155
+ requirements: []
156
+
157
+ rubyforge_project:
158
+ rubygems_version: 1.3.6
159
+ signing_key:
160
+ specification_version: 3
161
+ summary: Cucumber support for iPhone applications
162
+ test_files: []
163
+