Skip to content

Commit

Permalink
Got it actually working as a standalone gem, though it still throws a…
Browse files Browse the repository at this point in the history
… bunch of errors
  • Loading branch information
netpro2k committed Nov 26, 2011
1 parent 64dbcc0 commit a869d1c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
4 changes: 1 addition & 3 deletions Gemfile
@@ -1,8 +1,6 @@
source :gemcutter

gem 'CFPropertyList'
gem 'eventmachine'
gem 'uuidtools'
gemspec

# load plugins
require 'yaml'
Expand Down
14 changes: 0 additions & 14 deletions bin/siriproxy
@@ -1,20 +1,6 @@
#!/usr/bin/env ruby
# @todo these 2 lines emulate "bundle exec"
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
#

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')

require 'rubygems'
require 'bundler'
require 'bundler/setup'

require 'yaml'
require 'ostruct'

require 'siriproxy'
require 'siriproxy/command_line'

SiriProxy::CommandLine.new
31 changes: 29 additions & 2 deletions lib/siriproxy/command_line.rb
@@ -1,4 +1,12 @@
require 'optparse'
require 'yaml'
require 'ostruct'

# @todo want to make SiriProxy::Commandline without having to
# require 'siriproxy'. Im sure theres a better way.
class SiriProxy

end

class SiriProxy::CommandLine

Expand All @@ -10,7 +18,8 @@ class SiriProxy::CommandLine
Usage: siriproxy COMMAND OPTIONS
Commands:
server (default) Start up the Siri proxy server
server Start up the Siri proxy server
bundle Install any dependancies needed by plugins
console Launch the plugin test console
help Show this usage information
Expand All @@ -23,16 +32,22 @@ def initialize
subcommand = ARGV.shift
case command
when 'server' then run_server(subcommand)
when 'bundle' then run_bundle
when 'console' then run_console
when 'help' then usage
else run_server()
else usage
end
end

def run_console
puts "Not yet implemented"
end

def run_bundle
setup_bundler_path
puts `bundle -V`
end

def run_server(subcommand='start')
load_code
start_server
Expand Down Expand Up @@ -75,7 +90,19 @@ def parse_options
@option_parser.parse!(ARGV)
end

def setup_bundler_path
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../../Gemfile",
Pathname.new(__FILE__).realpath)
end

def load_code
setup_bundler_path

require 'bundler'
require 'bundler/setup'

require 'siriproxy'
require 'siriproxy/connection'
require 'siriproxy/connection/iphone'
require 'siriproxy/connection/guzzoni'
Expand Down

0 comments on commit a869d1c

Please sign in to comment.