Skip to content
Browse files

remove "script" commands in favor of the global "acoustic" command

  • Loading branch information...
1 parent 13fdafb commit 5b7a55271068bcee57e88308a489d0f820923b41 @jlong committed Apr 1, 2010
Showing with 23 additions and 30 deletions.
  1. +23 −4 bin/acoustic
  2. +0 −7 example/script/console
  3. +0 −19 example/script/server
View
27 bin/acoustic
@@ -7,13 +7,32 @@ require 'thor'
module Acoustic
class Runner < Thor
desc "server [PORT]", "start the application in the current directory on on PORT"
- def server(port="3000")
- `script/server #{port}`
+ def server(*args)
+ require 'boot'
+ require "acoustic/webrick_dispatcher"
+
+ first, second = (args.last || '').split(':')
+ ip = port = nil
+ case first
+ when /^\d+$/
+ port = first.to_i
+ when /\./
+ ip, port = first, second
+ end
+
+ Acoustic::DispatchServlet.dispatch(
+ :ip => ip || '0.0.0.0',
+ :port => port || 3000,
+ :server_root => "#{PROJECT_ROOT}/public"
+ )
end
desc "console", "boot IRB with the application in the current directory loaded"
- def console
- `script/console`
+ def console(*args)
+ libs = []
+ libs << "-r irb/completion"
+ libs << "-r #{ File.expand_path(File.dirname(__FILE__) + '/../') + '/boot' }"
+ exec "irb #{ libs.join(' ') } #{ args.join(' ') } --simple-prompt"
end
end
end
View
7 example/script/console
@@ -1,7 +0,0 @@
-#!/usr/bin/env ruby
-
-libs = []
-libs << "-r irb/completion"
-libs << "-r #{ File.expand_path(File.dirname(__FILE__) + '/../') + '/boot' }"
-
-exec "irb #{ libs.join(' ') } #{ ARGV.join(' ') } --simple-prompt"
View
19 example/script/server
@@ -1,19 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../') + '/boot'
-require "acoustic/webrick_dispatcher"
-
-first, second = (ARGV.last || '').split(':')
-ip = port = nil
-case first
-when /^\d+$/
- port = first.to_i
-when /\./
- ip, port = first, second
-end
-
-Acoustic::DispatchServlet.dispatch(
- :ip => ip || '0.0.0.0',
- :port => port || 3000,
- :server_root => "#{PROJECT_ROOT}/public"
-)

0 comments on commit 5b7a552

Please sign in to comment.
Something went wrong with that request. Please try again.