Permalink
Browse files

use sweatd from the system wide gem's bin path

  • Loading branch information...
mhorbul committed Feb 4, 2010
1 parent b752e2e commit 493b3529955ba73cc1722e44ea6f96a710bda9fe
Showing with 10 additions and 1 deletion.
  1. +10 −1 script/sweatshop
View
@@ -1,13 +1,22 @@
#!/usr/bin/env ruby
if ARGV.include?('-d')
+ require 'rubygems'
ARGV.delete('-d')
ARGV.unshift('start') unless ARGV.detect{|a| ['start', 'restart'].include?(a)}
root = File.expand_path(File.dirname(__FILE__) + '/..')
ARGV << "--rails=#{root}"
- system("ruby #{root}/vendor/gems/sweatshop/lib/sweatshop/sweatd.rb #{ARGV.join(' ')}")
+ version = ">= 0"
+
+ if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
+ version = $1
+ ARGV.shift
+ end
+
+ gem 'sweatshop', version
+ system("#{Gem.bin_path('sweatshop', 'sweatd', version)} #{ARGV.join(' ')}")
exit $?.exitstatus
else
puts "Loading Rails..."

0 comments on commit 493b352

Please sign in to comment.