sim_launcher 0.1.0
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.
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/bin/sim_launcher +49 -0
- data/lib/sim_launcher/simulator.rb +37 -0
- data/lib/sim_launcher/version.rb +3 -0
- data/native/iphonesim +0 -0
- data/sim_launcher.gemspec +20 -0
- data/sim_launcher.rb +3 -0
- metadata +82 -0
data/.gitmodules
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/sim_launcher
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'sinatra'
|
5
|
+
|
6
|
+
require 'sim_launcher/simulator'
|
7
|
+
|
8
|
+
# SimLauncher starts on port 8881 by default. To specify a custom port just pass it as the first command line argument.
|
9
|
+
set :port, (ARGV[0] || 8881)
|
10
|
+
|
11
|
+
# otherwise sinatra won't always automagically launch its embedded
|
12
|
+
# http server when this script is executed
|
13
|
+
set :run, true
|
14
|
+
|
15
|
+
|
16
|
+
IPHONESIM_PATH = File.join( File.dirname(__FILE__), '..', 'native', 'iphonesim' )
|
17
|
+
|
18
|
+
shared_simulator = SimLauncher::Simulator.new( IPHONESIM_PATH )
|
19
|
+
|
20
|
+
get '/' do
|
21
|
+
<<EOS
|
22
|
+
<h1>SimLauncher is up and running</h1>
|
23
|
+
<a href="/showsdks">Here's a list of sdks that SimLauncher has detected</a>
|
24
|
+
EOS
|
25
|
+
end
|
26
|
+
|
27
|
+
get '/showsdks' do
|
28
|
+
'<pre>' +
|
29
|
+
shared_simulator.showsdks +
|
30
|
+
'</pre>'
|
31
|
+
end
|
32
|
+
|
33
|
+
get '/launch_ipad_app' do
|
34
|
+
app_path = params[:app_path]
|
35
|
+
raise 'no app_path provided' if app_path.nil?
|
36
|
+
|
37
|
+
sdk = params[:sdk]
|
38
|
+
|
39
|
+
shared_simulator.launch_ipad_app( app_path, sdk )
|
40
|
+
end
|
41
|
+
|
42
|
+
get '/launch_iphone_app' do
|
43
|
+
app_path = params[:app_path]
|
44
|
+
raise 'no app_path provided' if app_path.nil?
|
45
|
+
|
46
|
+
sdk = params[:sdk]
|
47
|
+
|
48
|
+
shared_simulator.launch_iphone_app( app_path, sdk )
|
49
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SimLauncher
|
2
|
+
class Simulator
|
3
|
+
|
4
|
+
def initialize( iphonesim_path )
|
5
|
+
@iphonesim_path = iphonesim_path
|
6
|
+
end
|
7
|
+
|
8
|
+
def showsdks
|
9
|
+
run_synchronous_command( 'showsdks' )
|
10
|
+
end
|
11
|
+
|
12
|
+
def launch_ios_app(app_path, sdk_version, device_family)
|
13
|
+
run_synchronous_command( :launch, app_path, sdk_version, device_family )
|
14
|
+
end
|
15
|
+
|
16
|
+
def launch_ipad_app( app_path, sdk )
|
17
|
+
sdk ||= '3.2'
|
18
|
+
launch_ios_app( app_path, sdk, 'ipad' )
|
19
|
+
end
|
20
|
+
|
21
|
+
def launch_iphone_app( app_path, sdk )
|
22
|
+
sdk ||= '4.0'
|
23
|
+
launch_ios_app( app_path, sdk, 'iphone' )
|
24
|
+
end
|
25
|
+
|
26
|
+
def run_synchronous_command( *args )
|
27
|
+
cmd = cmd_line_with_args( args )
|
28
|
+
puts "executing #{cmd}"
|
29
|
+
`#{cmd}`
|
30
|
+
end
|
31
|
+
|
32
|
+
def cmd_line_with_args( args )
|
33
|
+
cmd_sections = [@iphonesim_path] + args.map{ |x| "\"#{x.to_s}\"" } << '2>&1'
|
34
|
+
cmd_sections.join(' ')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/native/iphonesim
ADDED
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "sim_launcher/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "sim_launcher"
|
7
|
+
s.version = SimLauncher::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Pete Hodgson"]
|
10
|
+
s.email = ["rubygems@thepete.net"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/sim_launcher"
|
12
|
+
s.summary = %q{tiny HTTP server to launch an app in the iOS simulator}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_dependency "sinatra"
|
20
|
+
end
|
data/sim_launcher.rb
ADDED
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sim_launcher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Pete Hodgson
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-01-30 00:00:00 -08:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: sinatra
|
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: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
description:
|
33
|
+
email:
|
34
|
+
- rubygems@thepete.net
|
35
|
+
executables:
|
36
|
+
- sim_launcher
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files: []
|
40
|
+
|
41
|
+
files:
|
42
|
+
- .gitmodules
|
43
|
+
- Gemfile
|
44
|
+
- Rakefile
|
45
|
+
- bin/sim_launcher
|
46
|
+
- lib/sim_launcher/simulator.rb
|
47
|
+
- lib/sim_launcher/version.rb
|
48
|
+
- native/iphonesim
|
49
|
+
- sim_launcher.gemspec
|
50
|
+
- sim_launcher.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://rubygems.org/gems/sim_launcher
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.3.6
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: tiny HTTP server to launch an app in the iOS simulator
|
81
|
+
test_files: []
|
82
|
+
|