Hello! I've added autoflushing on filesystem changes! #13

Closed
wants to merge 4 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+541 −5
Split
View
@@ -1,3 +1,2 @@
---
BUNDLE_BIN: bin
-BUNDLE_DISABLE_SHARED_GEMS: "1"
View
@@ -1,2 +1,3 @@
.release-notes.txt
command-t.recipe
+.DS_Store
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use ruby-1.8.7-p334@commandt
@iangreenleaf

iangreenleaf Jun 24, 2011

Guessing you didn't mean to include this in the pull request.

View
@@ -3,3 +3,4 @@ gem 'mechanize'
gem 'rake'
gem 'rr'
gem 'rspec', '>= 2.0.0.rc'
+gem 'rb-fsevent'
View
@@ -6,6 +6,7 @@ GEM
nokogiri (>= 1.2.1)
nokogiri (1.4.4)
rake (0.8.7)
+ rb-fsevent (0.4.0)
rr (1.0.2)
rspec (2.5.0)
rspec-core (~> 2.5.0)
@@ -22,5 +23,6 @@ PLATFORMS
DEPENDENCIES
mechanize
rake
+ rb-fsevent
rr
rspec (>= 2.0.0.rc)
View
View
@@ -146,6 +146,8 @@ you can build the extension with:
cd ~/.vim/ruby/command-t
ruby extconf.rb
make
+ cd ../rb-fsevent/ext
+ ruby extconf.rb
Note: If you are an RVM user, you must perform the build using the same
version of Ruby that Vim itself is linked against. This will often be the
View
@@ -145,7 +145,7 @@ ruby << EOF
require 'command-t/vim'
require 'command-t/controller'
$command_t = CommandT::Controller.new
- rescue LoadError
+ rescue LoadError => e
load_path_modified = false
::VIM::evaluate('&runtimepath').to_s.split(',').each do |path|
lib = "#{path}/ruby"
@@ -159,6 +159,6 @@ ruby << EOF
# could get here if C extension was not compiled, or was compiled
# for the wrong architecture or Ruby version
require 'command-t/stub'
- $command_t = CommandT::Stub.new
+ $command_t = CommandT::Stub.new(e)
end
EOF
@@ -24,12 +24,18 @@
require 'command-t/ext' # CommandT::Matcher
require 'command-t/finder'
require 'command-t/scanner/file_scanner'
+require 'rb-fsevent/lib/rb-fsevent'
module CommandT
class FileFinder < Finder
def initialize path = Dir.pwd, options = {}
@scanner = FileScanner.new path, options
@matcher = Matcher.new @scanner, options
+ fsevent = FSEvent.new
+ fsevent.watch Dir.pwd, { :latency => 1 } do |directories|
+ flush
+ end
+ Thread.new { fsevent.run }
end
end # class FileFinder
end # CommandT
View
@@ -28,11 +28,17 @@ class Stub
'For more information type: :help command-t']
def show_file_finder
- warn *@@load_error
+ warn *error_message
end
def flush
- warn *@@load_error
+ warn *error_message
+ end
+ def initialize(e)
+ @e = e
+ end
+ def error_message
+ [@e.message] + @e.backtrace
end
private
View
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Thibaud Guillaume-Gentil
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file not shown.
@@ -0,0 +1,128 @@
+
+SHELL = /bin/sh
+
+#### Start of system configuration section. ####
+
+srcdir = .
+topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
+hdrdir = $(topdir)
+VPATH = $(srcdir):$(topdir):$(hdrdir)
+exec_prefix = $(prefix)
+prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
+sharedstatedir = $(prefix)/com
+mandir = $(DESTDIR)/usr/share/man
+psdir = $(docdir)
+oldincludedir = $(DESTDIR)/usr/include
+localedir = $(datarootdir)/locale
+bindir = $(exec_prefix)/bin
+libexecdir = $(exec_prefix)/libexec
+sitedir = $(DESTDIR)/Library/Ruby/Site
+htmldir = $(docdir)
+vendorarchdir = $(vendorlibdir)/$(sitearch)
+includedir = $(prefix)/include
+infodir = $(DESTDIR)/usr/share/info
+vendorlibdir = $(vendordir)/$(ruby_version)
+sysconfdir = $(prefix)/etc
+libdir = $(exec_prefix)/lib
+sbindir = $(exec_prefix)/sbin
+rubylibdir = $(libdir)/ruby/$(ruby_version)
+docdir = $(datarootdir)/doc/$(PACKAGE)
+dvidir = $(docdir)
+vendordir = $(libdir)/ruby/vendor_ruby
+datarootdir = $(prefix)/share
+pdfdir = $(docdir)
+archdir = $(rubylibdir)/$(arch)
+sitearchdir = $(sitelibdir)/$(sitearch)
+datadir = $(datarootdir)
+localstatedir = $(prefix)/var
+sitelibdir = $(sitedir)/$(ruby_version)
+
+CC = gcc
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
+
+RUBY_EXTCONF_H =
+CFLAGS = -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common $(cflags)
+INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
+DEFS =
+CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
+CXXFLAGS = $(CFLAGS)
+ldflags = -L. -arch i386 -arch x86_64
+dldflags =
+archflag =
+DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
+LDSHARED = cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = ruby
+RUBY_SO_NAME = ruby
+arch = universal-darwin10.0
+sitearch = universal-darwin10.0
+ruby_version = 1.8
+ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
+RUBY = $(ruby)
+RM = rm -f
+MAKEDIRS = mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+
+#### End of system configuration section. ####
+
+preload =
+
+libpath = . $(libdir)
+LIBPATH = -L. -L$(libdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+
+extout =
+extout_prefix =
+target_prefix =
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl
+SRCS =
+OBJS =
+TARGET =
+DLLIB =
+EXTSTATIC =
+STATIC_LIB =
+
+BINDIR = $(bindir)
+RUBYCOMMONDIR = $(sitedir)$(target_prefix)
+RUBYLIBDIR = $(sitelibdir)$(target_prefix)
+RUBYARCHDIR = $(sitearchdir)$(target_prefix)
+
+TARGET_SO = $(DLLIB)
+CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
+CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
+
+all: Makefile
+static: $(STATIC_LIB)
+
+clean:
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
+
+distclean: clean
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: Makefile
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
@@ -0,0 +1,50 @@
+# Workaround to make Rubygems believe it builds a native gem
+require 'mkmf'
+create_makefile('none')
+
+if `uname -s`.chomp != 'Darwin'
+ puts "Warning! Only Darwin (Mac OS X) systems are supported, nothing will be compiled"
+else
+ gem_root = File.expand_path(File.join('..'))
+ darwin_version = `uname -r`.to_i
+ sdk_version = { 9 => '10.5', 10 => '10.6', 11 => '10.7' }[darwin_version]
+
+ raise "Only Darwin systems greater than 8 (Mac OS X 10.5+) are supported" unless sdk_version
+
+ core_flags = %W{
+ -isysroot /Developer/SDKs/MacOSX#{sdk_version}.sdk
+ -mmacosx-version-min=#{sdk_version} -mdynamic-no-pic -std=gnu99
+ }
+
+ cflags = core_flags + %w{-Os -pipe}
+
+ wflags = %w{
+ -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch
+ -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable
+ -Wunused-value -Wuninitialized -Wunknown-pragmas -Wshadow
+ -Wfour-char-constants -Wsign-compare -Wnewline-eof -Wconversion
+ -Wshorten-64-to-32 -Wglobal-constructors -pedantic
+ }
+
+ ldflags = %w{
+ -dead_strip -framework CoreServices
+ }
+
+ gcc_opts = core_flags + ldflags
+
+ gcc_opts += %w{
+ -D DEBUG=true
+ } if ENV['FWDEBUG'] == "true"
+
+ compile_command = "CFLAGS='#{cflags.join(' ')} #{wflags.join(' ')}' /usr/bin/gcc #{gcc_opts.join(' ')} -o '#{gem_root}/bin/fsevent_watch' fsevent/fsevent_watch.c"
+
+ STDERR.puts(compile_command)
+
+ # Compile the actual fsevent_watch binary
+ system "mkdir -p #{File.join(gem_root, 'bin')}"
+ system compile_command
+
+ unless File.executable?("#{gem_root}/bin/fsevent_watch")
+ raise "Compilation of fsevent_watch failed (see README)"
+ end
+end
Oops, something went wrong.