Permalink
Browse files

Merge branch 'master' of http://github.com/thieso2/snailgun into thie…

…so2-master
  • Loading branch information...
candlerb committed Oct 24, 2010
2 parents ed34f82 + c0e02e0 commit f4da0b07b0cbe36b298751f8a705e6c4c85c6659
Showing with 61 additions and 4 deletions.
  1. +26 −0 README-textmate
  2. +1 −1 bin/fruby
  3. +7 −1 lib/snailgun/server.rb
  4. +2 −2 snailgun.gemspec
  5. +25 −0 textmate.patch
View
@@ -0,0 +1,26 @@
+To get ultra fast CMD-R results in textmate you need to patch the run_script.rb that comes with textmate:
+
+cd /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/
+
+patch -p0 < wherever_snailgun_was_installed/textmate.patch
+
+To run test in never before seen speed simply cd into your rails-app (tested with rails 3) and say:
+
+> snailgun
+
+the output should read something like:
+Now entering subshell for RAILS_ENV=test. Use 'exit' to terminate snailgun
+Server starting for RAILS_ENV=test
+.. some seconds later ...
+Server ready for RAILS_ENV=test
+
+Now you can either use fruby instead of ruby to start tests "by hand":
+
+fruby -Itest test/unit/your_test.rb
+
+or - in TextMate - simply navigate to your_test.rb and hit CMD-R
+
+enjoy!
+
+thieso@gmail.com 20101024 at #rchh
+
View
@@ -28,7 +28,7 @@ server = UNIXSocket.open(sockname)
server.send_io(STDIN)
server.send_io(STDOUT)
server.send_io(STDERR)
-args = Marshal.dump([ARGV, Dir.pwd, Process.getpgrp])
+args = Marshal.dump([ARGV, ENV.to_hash, Dir.pwd, Process.getpgrp])
server.write [args.size].pack("N")
server.write args
begin
View
@@ -32,8 +32,9 @@ def run
STDOUT.reopen(client.recv_io)
STDERR.reopen(client.recv_io)
nbytes = client.read(4).unpack("N").first
- args, cwd, pgid = Marshal.load(client.read(nbytes))
+ args, env, cwd, pgid = Marshal.load(client.read(nbytes))
Dir.chdir(cwd)
+ $LOAD_PATH << env['RUBYLIB']
begin
Process.setpgid(0, pgid)
rescue Errno::EPERM
@@ -77,6 +78,11 @@ def start_ruby(args)
opts.on("-r LIB") do |v|
require v
end
+ # opts.on("-rcatch_exception") do |v|
+ # end
+ opts.on("-KU") do |v|
+ $KCODE = 'u' if RUBY_VERSION < "1.9"
+ end
end.order!(args)
ARGV.replace(args)
View
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{snailgun}
- s.version = "1.0.6.2"
+ s.version = "1.0.6.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Brian Candler"]
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.email = %q{b.candler@pobox.com}
s.files = [
"bin/fautotest", "bin/fconsole", "bin/fcucumber", "bin/frake", "bin/fruby", "bin/snailgun",
- "lib/snailgun/server.rb", "README.markdown", "README-snowleopard", "ruby-1.9.2-p0.patch"
+ "lib/snailgun/server.rb", "README.markdown", "README-snowleopard", "ruby-1.9.2-p0.patch", "textmate.patch", "README-textmate"
]
s.executables = ["fautotest", "fconsole", "fcucumber", "frake", "fruby", "snailgun"]
s.extra_rdoc_files = ["README.markdown"]
View
@@ -0,0 +1,25 @@
+--- /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb 2010-10-24 15:18:39.000000000 +0200
++++ /tmp/run_script.rb 2010-10-24 15:18:37.000000000 +0200
+@@ -90,22 +90,6 @@
+ return path, '', path
+ end
+
+-def snailgun_socket
+- Pathname.new(Dir.pwd).ascend do |path|
+- if File.exists?(path.join("config", "boot.rb"))
+- if File.exists?(path.join("tmp", "sockets", "snailgun", "test"))
+- return path.join("tmp", "sockets", "snailgun", "test").to_s
+- end
+- end
+- end
+- nil
+-end
+-
+-if socket = snailgun_socket
+- ENV['SNAILGUN_SOCK'] = socket
+- cmd[0] = 'fruby'
+-end
+-
+ TextMate::Executor.run( cmd, :version_args => ["--version"],
+ :script_args => args ) do |line, type|
+ if is_test_script and type == :out

0 comments on commit f4da0b0

Please sign in to comment.