Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add missing requires

  • Loading branch information...
commit b1c775f5bb8c7713bb43d0460b61acb698b7c4cb 1 parent 0519b9e
@jstorimer authored
Showing with 18 additions and 2 deletions.
  1. +9 −1 bin/spin
  2. +5 −0 lib/spin/socket.rb
  3. +4 −1 lib/spin/watcher.rb
View
10 bin/spin
@@ -1,17 +1,25 @@
#!/usr/bin/env ruby
+require 'spin/watcher'
+require 'spin/preloader'
require 'spin/socket'
# requires
# parse options (preload an extra path(s), add path(s) to watch)
-at_exit { File.delete(Spin::Socket.filepath) }
+
+trap("SIGINT") { exit }
+
# signal handlers
#
# spawn file watcher w/ pipe
reader = Spin::Watcher.spawn
+at_exit { File.delete(Spin::Socket.filepath) }
+push_socket = Spin::Socket.open
+
# preload rails
Spin::Preloader.require_files
+
# IO.select pipe + unix socket
# add files to be processed to the next test run obj
# include the recved io if applicable
View
5 lib/spin/socket.rb
@@ -2,6 +2,7 @@
require 'tempfile' # for Dir::tmpdir
require 'digest/md5'
+require 'socket'
module Spin
class Socket
@@ -11,6 +12,10 @@ def self.filepath
slug = Digest::MD5.hexdigest ['spin', Dir.pwd].join('-')
[Dir::tmpdir, slug].join('/')
end
+
+ def self.open
+ UNIXServer.open(filepath)
+ end
end
end
View
5 lib/spin/watcher.rb
@@ -1,3 +1,5 @@
+require 'listen'
+
module Spin
module Watcher
extend self
@@ -11,7 +13,8 @@ def spawn
fork {
rd.close
- Listen.to(AppDirectories + TestDirectories, :filter => /\.rb$/, :latency => 0.1) do |modified, added, removed|
+ dirs = AppDirectories + TestDirectories
+ Listen.to(*dirs, :filter => /\.rb$/, :latency => 0.1) do |modified, added, removed|
changed_files = [modified + added + removed].uniq
files_to_queue = changed_files.map { |file|
Please sign in to comment.
Something went wrong with that request. Please try again.