snailgun 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ If you use ruby-1.9.2-p0 on Snow Leopard snailgun won't work out of the Box!
2
+
3
+ I have included a small patch to the ruby-sources that make it work:
4
+
5
+ (this is assuming you use rvm)
6
+
7
+ cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/socket
8
+ patch -p1 < wherever_snailgun_was_installed/ruby-1.9.2-p0.patch
9
+ ruby extconf.rb
10
+ make clean
11
+ make clean install
12
+
13
+ Patch was taken from http://redmine.ruby-lang.org/repositories/revision/ruby-19?rev=29242
14
+
15
+ thieso@gmail.com 20101024
data/README-textmate ADDED
@@ -0,0 +1,26 @@
1
+ To get ultra fast CMD-R results in textmate you need to patch the run_script.rb that comes with textmate:
2
+
3
+ cd /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/
4
+
5
+ patch -p0 < wherever_snailgun_was_installed/textmate.patch
6
+
7
+ To run test in never before seen speed simply cd into your rails-app (tested with rails 3) and say:
8
+
9
+ > snailgun
10
+
11
+ the output should read something like:
12
+ Now entering subshell for RAILS_ENV=test. Use 'exit' to terminate snailgun
13
+ Server starting for RAILS_ENV=test
14
+ .. some seconds later ...
15
+ Server ready for RAILS_ENV=test
16
+
17
+ Now you can either use fruby instead of ruby to start tests "by hand":
18
+
19
+ fruby -Itest test/unit/your_test.rb
20
+
21
+ or - in TextMate - simply navigate to your_test.rb and hit CMD-R
22
+
23
+ enjoy!
24
+
25
+ thieso@gmail.com 20101024 at #rchh
26
+
data/README.markdown CHANGED
@@ -213,3 +213,5 @@ Credits:
213
213
 
214
214
  * Jan X <jan.h.xie@gmail.com>
215
215
  * George Ogata <george.ogata@gmail.com>
216
+ * Niklas Hofer <niklas+dev@lanpartei.de>
217
+ * Thies C. Arntzen <thieso@gmail.com>
data/bin/fautotest CHANGED
@@ -5,5 +5,5 @@
5
5
 
6
6
  ENV["RAILS_ENV"] = "test"
7
7
  Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=)
8
- ARGV[0,0] = ["-e","gem 'ZenTest'","-e","load 'autotest'","--"]
8
+ ARGV[0,0] = ["-e","gem 'ZenTest'","-e","load Gem.bin_path('ZenTest', 'autotest')","--"]
9
9
  load File.join(File.dirname(__FILE__), "fruby")
data/bin/fruby CHANGED
@@ -15,7 +15,7 @@ elsif File.directory?('tmp/sockets/snailgun')
15
15
  sockname = "tmp/sockets/snailgun/#{env}"
16
16
  end
17
17
 
18
- unless sockname
18
+ unless sockname and File.exists? sockname
19
19
  STDERR.puts <<EOS
20
20
  Unable to find path to snailgun socket.
21
21
  - did you run this in a session with a snailgun parent?
@@ -28,7 +28,7 @@ server = UNIXSocket.open(sockname)
28
28
  server.send_io(STDIN)
29
29
  server.send_io(STDOUT)
30
30
  server.send_io(STDERR)
31
- args = Marshal.dump([ARGV, Dir.pwd, Process.getpgrp])
31
+ args = Marshal.dump([ARGV, ENV.to_hash, Dir.pwd, Process.getpgrp])
32
32
  server.write [args.size].pack("N")
33
33
  server.write args
34
34
  begin
data/bin/snailgun CHANGED
@@ -1,5 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Copyright (C) Brian Candler 2009. Released under the Ruby licence.
3
+
4
+ # Turn on copy-on-write garbage collection in REE: see
5
+ # http://www.rubyenterpriseedition.com/documentation.html#_copy_on_write_friendliness
6
+ begin
7
+ GC.copy_on_write_friendly = true
8
+ rescue NoMethodError
9
+ end
10
+
3
11
  $:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
4
12
  require 'snailgun/server'
5
13
  require 'optparse'
@@ -66,33 +74,43 @@ when :rails
66
74
  end
67
75
  pids = {}
68
76
  fix_rake # TODO: separate process for rake (but then need to choose right RAILS_ENV)
69
- envs.split(/[\s,]+/).uniq.each do |env|
77
+
78
+ start_for_envs = envs.split(/[\s,]+/).uniq
79
+ start_for_envs.each do |env|
70
80
  pids[env] = fork do
81
+ STDERR.puts "Server starting for RAILS_ENV=#{env}"
71
82
  server = Snailgun::Server.new("#{sockdir}/#{env}")
72
83
  ENV['RAILS_ENV'] = env
73
84
  load conf
74
- require File.expand_path(RAILS_ROOT + '/config/environment')
85
+ if File.exist?('./config/environment.rb')
86
+ require './config/environment.rb'
87
+ end
75
88
  # We can get some drastic test speedups by preloading test frameworks
76
89
  # (although user could do that in config/environments/test.rb)
77
90
  if env != 'test'
78
91
  # do nothing
79
- elsif File.exist?('test/test_helper.rb')
80
- require 'test_help'
92
+ elsif File.exist?('./test/test_helper.rb')
93
+ require './test/test_helper'
81
94
  elsif File.exist?('spec/spec_helper.rb')
82
95
  require 'spec'
83
96
  require 'spec/rails'
84
97
  end
85
98
  if Rails.respond_to?(:configuration) && Rails.configuration.cache_classes
86
- STDERR.puts <<EOS
99
+ STDERR.puts <<-EOS
87
100
  WARNING: Snailgun doesn't work well with `cache_classes`. Strongly recommend
88
101
  `config.cache_classes = false` in config/environments/#{env}.rb
89
102
  EOS
90
103
  end
91
- STDERR.puts "Started server for #{env}" if verbose
104
+ STDERR.puts "Server ready for RAILS_ENV=#{env}"
92
105
  server.run
93
106
  end
94
107
  end
95
- STDERR.puts "Now entering subshell. Use 'exit' to terminate snailgun"
108
+ if start_for_envs.size == 1
109
+ ENV['RAILS_ENV'] = start_for_envs.first
110
+ STDERR.puts "Now entering subshell for RAILS_ENV=#{ENV['RAILS_ENV']}. Use 'exit' to terminate snailgun"
111
+ else
112
+ STDERR.puts "Now entering subshell Don't forget to set your RAILS_ENV!. Use 'exit' to terminate snailgun"
113
+ end
96
114
  Snailgun::Server.shell
97
115
  pids.each do |env,pid|
98
116
  Process.kill('TERM',pid)
@@ -32,8 +32,9 @@ module Snailgun
32
32
  STDOUT.reopen(client.recv_io)
33
33
  STDERR.reopen(client.recv_io)
34
34
  nbytes = client.read(4).unpack("N").first
35
- args, cwd, pgid = Marshal.load(client.read(nbytes))
35
+ args, env, cwd, pgid = Marshal.load(client.read(nbytes))
36
36
  Dir.chdir(cwd)
37
+ $LOAD_PATH << env['RUBYLIB']
37
38
  begin
38
39
  Process.setpgid(0, pgid)
39
40
  rescue Errno::EPERM
@@ -77,6 +78,11 @@ module Snailgun
77
78
  opts.on("-r LIB") do |v|
78
79
  require v
79
80
  end
81
+ # opts.on("-rcatch_exception") do |v|
82
+ # end
83
+ opts.on("-KU") do |v|
84
+ $KCODE = 'u' if RUBY_VERSION < "1.9"
85
+ end
80
86
  end.order!(args)
81
87
 
82
88
  ARGV.replace(args)
@@ -0,0 +1,54 @@
1
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: Makefile
2
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: ancdata.o
3
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: basicsocket.o
4
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: constants.o
5
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: constdefs.c
6
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: constdefs.h
7
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: extconf.h
8
+ diff -u socket/extconf.rb /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket/extconf.rb
9
+ --- socket/extconf.rb 2010-05-19 15:48:50.000000000 +0200
10
+ +++ /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket/extconf.rb 2010-10-24 10:44:17.000000000 +0200
11
+ @@ -117,7 +117,7 @@
12
+ }
13
+ end
14
+
15
+ -if (have_func("sendmsg") | have_func("recvmsg")) && /64-darwin/ !~ RUBY_PLATFORM
16
+ +if have_func("sendmsg") | have_func("recvmsg")
17
+ # CMSG_ macros are broken on 64bit darwin, because of use of __DARWIN_ALIGN.
18
+ have_struct_member('struct msghdr', 'msg_control', ['sys/types.h', 'sys/socket.h'])
19
+ have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h'])
20
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: init.o
21
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: ipsocket.o
22
+ Common subdirectories: socket/lib and /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket/lib
23
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: mkmf.log
24
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: option.o
25
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: raddrinfo.o
26
+ diff -u socket/rubysocket.h /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket/rubysocket.h
27
+ --- socket/rubysocket.h 2010-04-28 09:16:30.000000000 +0200
28
+ +++ /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket/rubysocket.h 2010-10-24 10:43:51.000000000 +0200
29
+ @@ -138,6 +138,17 @@
30
+ };
31
+ #endif
32
+
33
+ +#if defined __APPLE__ && defined __MACH__
34
+ +/*
35
+ + * CMSG_ macros are broken on 64bit darwin, because __DARWIN_ALIGN
36
+ + * aligns up to __darwin_size_t which is 64bit, but CMSG_DATA is
37
+ + * 32bit-aligned.
38
+ + */
39
+ +#undef __DARWIN_ALIGNBYTES
40
+ +#define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1)
41
+ +#endif
42
+ +
43
+ +
44
+ #if defined(_AIX)
45
+ #ifndef CMSG_SPACE
46
+ # define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
47
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: socket.bundle
48
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: socket.o
49
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: sockssocket.o
50
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: tcpserver.o
51
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: tcpsocket.o
52
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: udpsocket.o
53
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: unixserver.o
54
+ Only in /Users/thieso/.rvm/src/ruby-1.9.2-p0/ext/socket: unixsocket.o
data/textmate.patch ADDED
@@ -0,0 +1,25 @@
1
+ --- run_script.rb.orig 2010-10-25 09:23:45.000000000 +0200
2
+ +++ run_script.rb 2010-10-25 09:24:06.000000000 +0200
3
+ @@ -90,6 +90,22 @@
4
+ return path, '', path
5
+ end
6
+
7
+ +def snailgun_socket
8
+ + Pathname.new(Dir.pwd).ascend do |path|
9
+ + if File.exists?(path.join("config", "boot.rb"))
10
+ + if File.exists?(path.join("tmp", "sockets", "snailgun", "test"))
11
+ + return path.join("tmp", "sockets", "snailgun", "test").to_s
12
+ + end
13
+ + end
14
+ + end
15
+ + nil
16
+ +end
17
+ +
18
+ +if socket = snailgun_socket
19
+ + ENV['SNAILGUN_SOCK'] = socket
20
+ + cmd[0] = 'fruby'
21
+ +end
22
+ +
23
+ TextMate::Executor.run( cmd, :version_args => ["--version"],
24
+ :script_args => args ) do |line, type|
25
+ if is_test_script and type == :out
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snailgun
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Candler
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-12 00:00:00 +00:00
12
+ date: 2010-10-24 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -35,6 +35,10 @@ files:
35
35
  - bin/snailgun
36
36
  - lib/snailgun/server.rb
37
37
  - README.markdown
38
+ - README-snowleopard
39
+ - ruby-1.9.2-p0.patch
40
+ - textmate.patch
41
+ - README-textmate
38
42
  has_rdoc: true
39
43
  homepage: http://github.com/candlerb/snailgun
40
44
  licenses: []