guard 1.0.3 → 1.1.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +0 -6
- data/README.md +38 -30
- data/lib/guard.rb +158 -285
- data/lib/guard/cli.rb +16 -2
- data/lib/guard/dsl.rb +41 -20
- data/lib/guard/dsl_describer.rb +1 -1
- data/lib/guard/group.rb +1 -1
- data/lib/guard/guard.rb +39 -5
- data/lib/guard/guardfile.rb +70 -0
- data/lib/guard/runner.rb +179 -0
- data/lib/guard/ui.rb +1 -1
- data/lib/guard/version.rb +2 -4
- data/lib/guard/watcher.rb +1 -0
- metadata +16 -77
- data/bin/fsevent_watch_guard_guard +0 -0
- data/lib/guard/listener.rb +0 -376
- data/lib/guard/listeners/darwin.rb +0 -62
- data/lib/guard/listeners/linux.rb +0 -93
- data/lib/guard/listeners/polling.rb +0 -55
- data/lib/guard/listeners/windows.rb +0 -63
- data/lib/vendor/darwin/Gemfile +0 -6
- data/lib/vendor/darwin/Guardfile +0 -8
- data/lib/vendor/darwin/LICENSE +0 -20
- data/lib/vendor/darwin/README.rdoc +0 -255
- data/lib/vendor/darwin/Rakefile +0 -21
- data/lib/vendor/darwin/bin/fsevent_watch +0 -0
- data/lib/vendor/darwin/ext/fsevent_watch/Info.plist +0 -38
- data/lib/vendor/darwin/ext/fsevent_watch/LICENSE +0 -21
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj +0 -254
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.c +0 -394
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.h +0 -74
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.c +0 -160
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.h +0 -45
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/common.h +0 -34
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.c +0 -20
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.h +0 -40
- data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/main.c +0 -509
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Common.xcconfig +0 -82
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Debug.xcconfig +0 -19
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Release.xcconfig +0 -23
- data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/fsevent_watch.xcconfig +0 -17
- data/lib/vendor/darwin/ext/rakefile.rb +0 -47
- data/lib/vendor/darwin/ext/rb-fsevent.xcconfig +0 -33
- data/lib/vendor/darwin/lib/rb-fsevent.rb +0 -2
- data/lib/vendor/darwin/lib/rb-fsevent/fsevent.rb +0 -111
- data/lib/vendor/darwin/lib/rb-fsevent/version.rb +0 -3
- data/lib/vendor/darwin/rb-fsevent.gemspec +0 -25
- data/lib/vendor/darwin/spec/fixtures/folder1/file1.txt +0 -0
- data/lib/vendor/darwin/spec/fixtures/folder1/folder2/file2.txt +0 -0
- data/lib/vendor/darwin/spec/rb-fsevent/fsevent_spec.rb +0 -88
- data/lib/vendor/darwin/spec/spec_helper.rb +0 -23
- data/lib/vendor/linux/MIT-LICENSE +0 -20
- data/lib/vendor/linux/README.md +0 -66
- data/lib/vendor/linux/Rakefile +0 -54
- data/lib/vendor/linux/VERSION +0 -1
- data/lib/vendor/linux/lib/rb-inotify.rb +0 -17
- data/lib/vendor/linux/lib/rb-inotify/event.rb +0 -139
- data/lib/vendor/linux/lib/rb-inotify/native.rb +0 -31
- data/lib/vendor/linux/lib/rb-inotify/native/flags.rb +0 -89
- data/lib/vendor/linux/lib/rb-inotify/notifier.rb +0 -308
- data/lib/vendor/linux/lib/rb-inotify/watcher.rb +0 -83
- data/lib/vendor/linux/rb-inotify.gemspec +0 -53
- data/lib/vendor/windows/Gemfile +0 -4
- data/lib/vendor/windows/README.md +0 -34
- data/lib/vendor/windows/Rakefile +0 -18
- data/lib/vendor/windows/lib/rb-fchange.rb +0 -14
- data/lib/vendor/windows/lib/rb-fchange/event.rb +0 -29
- data/lib/vendor/windows/lib/rb-fchange/native.rb +0 -45
- data/lib/vendor/windows/lib/rb-fchange/native/flags.rb +0 -78
- data/lib/vendor/windows/lib/rb-fchange/notifier.rb +0 -149
- data/lib/vendor/windows/lib/rb-fchange/version.rb +0 -3
- data/lib/vendor/windows/lib/rb-fchange/watcher.rb +0 -99
- data/lib/vendor/windows/rb-fchange.gemspec +0 -34
- data/lib/vendor/windows/spec/fixtures/folder1/file1.txt +0 -0
- data/lib/vendor/windows/spec/fixtures/folder1/folder2/file2.txt +0 -0
- data/lib/vendor/windows/spec/rb-fchange/fchange_spec.rb +0 -119
- data/lib/vendor/windows/spec/spec_helper.rb +0 -21
@@ -1,82 +0,0 @@
|
|
1
|
-
// local defines
|
2
|
-
COMMON_CFLAGS = -pipe
|
3
|
-
COMMON_GCC_PREPROCESSOR_DEFINITIONS = NS_BUILD_32_LIKE_64 NS_BLOCK_ASSERTIONS
|
4
|
-
|
5
|
-
|
6
|
-
// architectures
|
7
|
-
ARCHS = $(ARCHS_STANDARD_32_64_BIT)
|
8
|
-
VALID_ARCHS = i386 x86_64
|
9
|
-
SDKROOT = macosx
|
10
|
-
SUPPORTED_PLATFORMS = macosx
|
11
|
-
ONLY_ACTIVE_ARCH = NO
|
12
|
-
|
13
|
-
|
14
|
-
// build options
|
15
|
-
DEBUG_INFORMATION_FORMAT = dwarf
|
16
|
-
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
|
17
|
-
RUN_CLANG_STATIC_ANALYZER = YES
|
18
|
-
|
19
|
-
|
20
|
-
// deployment
|
21
|
-
MACOSX_DEPLOYMENT_TARGET = 10.6
|
22
|
-
|
23
|
-
|
24
|
-
// linking
|
25
|
-
DEAD_CODE_STRIPPING = YES
|
26
|
-
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
|
27
|
-
LINK_WITH_STANDARD_LIBRARIES = YES
|
28
|
-
|
29
|
-
|
30
|
-
// search paths
|
31
|
-
FRAMEWORK_SEARCH_PATHS = $(value) $(SYSTEM_LIBRARY_DIR)/Frameworks $(LOCAL_LIBRARY_DIR)/Frameworks
|
32
|
-
|
33
|
-
|
34
|
-
// code generation
|
35
|
-
GCC_DYNAMIC_NO_PIC = NO
|
36
|
-
GCC_FAST_OBJC_DISPATCH = YES
|
37
|
-
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
38
|
-
GCC_STRICT_ALIASING = YES
|
39
|
-
LLVM_LTO = YES
|
40
|
-
|
41
|
-
|
42
|
-
// language
|
43
|
-
GCC_C_LANGUAGE_STANDARD = gnu99
|
44
|
-
OTHER_CFLAGS = $(COMMON_CFLAGS)
|
45
|
-
|
46
|
-
|
47
|
-
// preprocessing
|
48
|
-
GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_GCC_PREPROCESSOR_DEFINITIONS)
|
49
|
-
|
50
|
-
|
51
|
-
// warnings
|
52
|
-
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
|
53
|
-
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES
|
54
|
-
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
|
55
|
-
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
|
56
|
-
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES
|
57
|
-
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
58
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
|
59
|
-
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
|
60
|
-
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
|
61
|
-
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
62
|
-
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
|
63
|
-
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO
|
64
|
-
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
|
65
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES
|
66
|
-
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES
|
67
|
-
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
|
68
|
-
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO
|
69
|
-
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
|
70
|
-
GCC_WARN_MISSING_PARENTHESES = YES
|
71
|
-
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO
|
72
|
-
GCC_WARN_SHADOW = YES
|
73
|
-
GCC_WARN_SIGN_COMPARE = YES
|
74
|
-
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
|
75
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
76
|
-
GCC_WARN_UNKNOWN_PRAGMAS = YES
|
77
|
-
GCC_WARN_UNUSED_FUNCTION = YES
|
78
|
-
GCC_WARN_UNUSED_LABEL = YES
|
79
|
-
GCC_WARN_UNUSED_PARAMETER = NO
|
80
|
-
GCC_WARN_UNUSED_VALUE = YES
|
81
|
-
GCC_WARN_UNUSED_VARIABLE = YES
|
82
|
-
WARNING_CFLAGS = -Wall -Wextra -Wpointer-arith -Wformat=2 -Wfloat-equal -Wstrict-overflow=4 -Wbad-function-cast -Winline -Wconversion -Wstrict-aliasing -Wno-unused-parameter -Wno-arc-performSelector-leaks
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#include "Common.xcconfig"
|
2
|
-
|
3
|
-
|
4
|
-
// deployment
|
5
|
-
COPY_PHASE_STRIP = NO
|
6
|
-
STRIP_INSTALLED_PRODUCT = NO
|
7
|
-
|
8
|
-
|
9
|
-
// code generation
|
10
|
-
GCC_OPTIMIZATION_LEVEL = 0
|
11
|
-
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
12
|
-
|
13
|
-
|
14
|
-
// language
|
15
|
-
OTHER_CFLAGS = $(COMMON_CFLAGS) -fcatch-undefined-behavior -ftrapv -fverbose-asm
|
16
|
-
|
17
|
-
|
18
|
-
// preprocessing
|
19
|
-
GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_GCC_PREPROCESSOR_DEFINITIONS) DEBUG DEBUG_$(USER)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#include "Common.xcconfig"
|
2
|
-
|
3
|
-
|
4
|
-
// build options
|
5
|
-
VALIDATE_PRODUCT = YES
|
6
|
-
|
7
|
-
|
8
|
-
// code signing
|
9
|
-
CODE_SIGN_IDENTITY = 3rd Party Mac Developer Application: Travis Tilley
|
10
|
-
|
11
|
-
|
12
|
-
// deployment
|
13
|
-
COPY_PHASE_STRIP = YES
|
14
|
-
STRIP_INSTALLED_PRODUCT = YES
|
15
|
-
|
16
|
-
|
17
|
-
// code generation
|
18
|
-
GCC_OPTIMIZATION_LEVEL = 4
|
19
|
-
GCC_UNROLL_LOOPS = YES
|
20
|
-
|
21
|
-
|
22
|
-
// preprocessing
|
23
|
-
GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_GCC_PREPROCESSOR_DEFINITIONS) NDEBUG
|
@@ -1,17 +0,0 @@
|
|
1
|
-
// linking
|
2
|
-
MACH_O_TYPE = mh_execute
|
3
|
-
OTHER_LDFLAGS = -sectcreate __TEXT __info_plist "$(DERIVED_FILE_DIR)/Info.plist"
|
4
|
-
GENERATE_MASTER_OBJECT_FILE = YES
|
5
|
-
|
6
|
-
|
7
|
-
// packaging
|
8
|
-
INFOPLIST_FILE = Info.plist
|
9
|
-
PRODUCT_NAME = $(TARGET_NAME)
|
10
|
-
|
11
|
-
|
12
|
-
// versioning
|
13
|
-
CURRENT_PROJECT_VERSION = 0.1.1
|
14
|
-
|
15
|
-
|
16
|
-
// preprocessing
|
17
|
-
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) PROJECT_VERSION="$(CURRENT_PROJECT_VERSION)"
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# vim: fileencoding=UTF-8 nobomb sw=2 ts=2 et
|
2
|
-
|
3
|
-
XCODEBUILD = '/usr/bin/xcodebuild'
|
4
|
-
XCCONFIG = File.expand_path('rb-fsevent.xcconfig')
|
5
|
-
|
6
|
-
namespace :xcode do
|
7
|
-
$target = 'fsevent_watch'
|
8
|
-
$configuration = ENV['FWDEBUG'] ? 'Debug' : 'Release'
|
9
|
-
|
10
|
-
def xcb(action, extra='')
|
11
|
-
command = [
|
12
|
-
XCODEBUILD,
|
13
|
-
"-target", $target,
|
14
|
-
"-configuration", $configuration,
|
15
|
-
action,
|
16
|
-
"-xcconfig", XCCONFIG,
|
17
|
-
extra
|
18
|
-
].join(' ')
|
19
|
-
|
20
|
-
Dir.chdir 'fsevent_watch' do
|
21
|
-
results = `#{command}`
|
22
|
-
STDERR.puts results
|
23
|
-
raise "xcodebuild failure" unless $?.success?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
desc 'run xcodebuild clean'
|
28
|
-
task :clean do
|
29
|
-
xcb 'clean'
|
30
|
-
end
|
31
|
-
|
32
|
-
desc 'run xcodebuild build'
|
33
|
-
task :build => :clean do
|
34
|
-
xcb 'build'
|
35
|
-
end
|
36
|
-
|
37
|
-
desc 'run xcodebuild install'
|
38
|
-
task :install => :build do
|
39
|
-
xcb 'install', "DEPLOYMENT_LOCATION='YES'"
|
40
|
-
end
|
41
|
-
|
42
|
-
task :remove_turds do
|
43
|
-
rm_rf File.join('fsevent_watch', 'build')
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
task :default => ['xcode:install', 'xcode:remove_turds']
|
@@ -1,33 +0,0 @@
|
|
1
|
-
// settings in this file will override those defined in the xcode project
|
2
|
-
|
3
|
-
// - deployment -
|
4
|
-
INSTALL_MODE_FLAG = u+w,go-w,a+rX
|
5
|
-
MACOSX_DEPLOYMENT_TARGET = 10.5
|
6
|
-
DSTROOT = ../../
|
7
|
-
INSTALL_PATH = /bin
|
8
|
-
SKIP_INSTALL = NO
|
9
|
-
|
10
|
-
// - build locations -
|
11
|
-
SYMROOT = build
|
12
|
-
OBJROOT = $(SYMROOT)
|
13
|
-
|
14
|
-
// - architectures -
|
15
|
-
ARCHS = $(NATIVE_ARCH_ACTUAL)
|
16
|
-
SDKROOT =
|
17
|
-
|
18
|
-
// - build options -
|
19
|
-
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
|
20
|
-
|
21
|
-
// etc
|
22
|
-
RUN_CLANG_STATIC_ANALYZER = YES
|
23
|
-
DEAD_CODE_STRIPPING = YES
|
24
|
-
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
|
25
|
-
LD_NO_PIE = NO
|
26
|
-
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
27
|
-
LLVM_LTO = NO
|
28
|
-
LLVM_LTO[arch=x86_64] = YES
|
29
|
-
GCC_C_LANGUAGE_STANDARD = gnu99
|
30
|
-
GCC_ENABLE_OBJC_EXCEPTIONS = YES
|
31
|
-
GCC_ENABLE_OBJC_GC = unsupported
|
32
|
-
GCC_ENABLE_EXCEPTIONS = YES
|
33
|
-
|
@@ -1,111 +0,0 @@
|
|
1
|
-
class FSEvent
|
2
|
-
class << self
|
3
|
-
class_eval <<-END
|
4
|
-
def root_path
|
5
|
-
"#{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..'))}"
|
6
|
-
end
|
7
|
-
END
|
8
|
-
class_eval <<-END
|
9
|
-
def watcher_path
|
10
|
-
"#{File.join(FSEvent.root_path, 'bin', 'fsevent_watch_guard')}"
|
11
|
-
end
|
12
|
-
END
|
13
|
-
end
|
14
|
-
|
15
|
-
attr_reader :paths, :callback
|
16
|
-
|
17
|
-
def initialize args = nil, &block
|
18
|
-
watch(args, &block) unless args.nil?
|
19
|
-
end
|
20
|
-
|
21
|
-
def watch(watch_paths, options=nil, &block)
|
22
|
-
@paths = watch_paths.kind_of?(Array) ? watch_paths : [watch_paths]
|
23
|
-
@callback = block
|
24
|
-
|
25
|
-
if options.kind_of?(Hash)
|
26
|
-
@options = parse_options(options)
|
27
|
-
elsif options.kind_of?(Array)
|
28
|
-
@options = options
|
29
|
-
else
|
30
|
-
@options = []
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def run
|
35
|
-
@pipe = open_pipe
|
36
|
-
@running = true
|
37
|
-
|
38
|
-
# please note the use of IO::select() here, as it is used specifically to
|
39
|
-
# preserve correct signal handling behavior in ruby 1.8.
|
40
|
-
while @running && IO::select([@pipe], nil, nil, nil)
|
41
|
-
if line = @pipe.readline
|
42
|
-
modified_dir_paths = line.split(':').select { |dir| dir != "\n" }
|
43
|
-
callback.call(modified_dir_paths)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
rescue Interrupt, IOError
|
47
|
-
ensure
|
48
|
-
stop
|
49
|
-
end
|
50
|
-
|
51
|
-
def stop
|
52
|
-
unless @pipe.nil?
|
53
|
-
Process.kill('KILL', @pipe.pid)
|
54
|
-
@pipe.close
|
55
|
-
end
|
56
|
-
rescue IOError
|
57
|
-
ensure
|
58
|
-
@running = false
|
59
|
-
end
|
60
|
-
|
61
|
-
if RUBY_VERSION < '1.9'
|
62
|
-
def open_pipe
|
63
|
-
IO.popen("#{self.class.watcher_path} #{options_string} #{shellescaped_paths}")
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def options_string
|
69
|
-
@options.join(' ')
|
70
|
-
end
|
71
|
-
|
72
|
-
def shellescaped_paths
|
73
|
-
@paths.map {|path| shellescape(path)}.join(' ')
|
74
|
-
end
|
75
|
-
|
76
|
-
# for Ruby 1.8.6 support
|
77
|
-
def shellescape(str)
|
78
|
-
# An empty argument will be skipped, so return empty quotes.
|
79
|
-
return "''" if str.empty?
|
80
|
-
|
81
|
-
str = str.dup
|
82
|
-
|
83
|
-
# Process as a single byte sequence because not all shell
|
84
|
-
# implementations are multibyte aware.
|
85
|
-
str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/n, "\\\\\\1")
|
86
|
-
|
87
|
-
# A LF cannot be escaped with a backslash because a backslash + LF
|
88
|
-
# combo is regarded as line continuation and simply ignored.
|
89
|
-
str.gsub!(/\n/, "'\n'")
|
90
|
-
|
91
|
-
return str
|
92
|
-
end
|
93
|
-
else
|
94
|
-
def open_pipe
|
95
|
-
IO.popen([self.class.watcher_path] + @options + @paths)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
def parse_options(options={})
|
102
|
-
opts = []
|
103
|
-
opts.concat(['--since-when', options[:since_when]]) if options[:since_when]
|
104
|
-
opts.concat(['--latency', options[:latency]]) if options[:latency]
|
105
|
-
opts.push('--no-defer') if options[:no_defer]
|
106
|
-
opts.push('--watch-root') if options[:watch_root]
|
107
|
-
# ruby 1.9's IO.popen(array-of-stuff) syntax requires all items to be strings
|
108
|
-
opts.map {|opt| "#{opt}"}
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "rb-fsevent/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "rb-fsevent"
|
7
|
-
s.version = FSEvent::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['Thibaud Guillaume-Gentil', 'Travis Tilley']
|
10
|
-
s.email = ['thibaud@thibaud.me', 'ttilley@gmail.com']
|
11
|
-
s.homepage = "http://rubygems.org/gems/rb-fsevent"
|
12
|
-
s.summary = "Very simple & usable FSEvents API"
|
13
|
-
s.description = "FSEvents API with Signals catching (without RubyCocoa)"
|
14
|
-
|
15
|
-
s.rubyforge_project = "rb-fsevent"
|
16
|
-
|
17
|
-
s.add_development_dependency 'bundler', '~> 1.0'
|
18
|
-
s.add_development_dependency 'rspec', '~> 2.5.0'
|
19
|
-
s.add_development_dependency 'guard-rspec', '~> 0.1.9'
|
20
|
-
|
21
|
-
s.files = Dir.glob('{bin,lib,ext}/**/*') + %w[LICENSE README.rdoc]
|
22
|
-
# s.extensions = ['ext/rakefile.rb']
|
23
|
-
s.require_path = 'lib'
|
24
|
-
end
|
25
|
-
|
File without changes
|
File without changes
|
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe FSEvent do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@results = []
|
7
|
-
@fsevent = FSEvent.new
|
8
|
-
@fsevent.watch @fixture_path.to_s, {:latency => 0.5} do |paths|
|
9
|
-
@results += paths
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it "shouldn't pass anything to watch when instantiated without a path" do
|
14
|
-
fsevent = FSEvent.new
|
15
|
-
fsevent.paths.should be_nil
|
16
|
-
fsevent.callback.should be_nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should pass path and block to watch when instantiated with them" do
|
20
|
-
blk = proc { }
|
21
|
-
fsevent = FSEvent.new(@fixture_path, &blk)
|
22
|
-
fsevent.paths.should == [@fixture_path]
|
23
|
-
fsevent.callback.should == blk
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should have a watcher_path that resolves to an executable file" do
|
27
|
-
File.exists?(FSEvent.watcher_path).should be_true
|
28
|
-
File.executable?(FSEvent.watcher_path).should be_true
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should work with path with an apostrophe" do
|
32
|
-
custom_path = @fixture_path.join("custom 'path")
|
33
|
-
file = custom_path.join("newfile.rb").to_s
|
34
|
-
File.delete file if File.exists? file
|
35
|
-
@fsevent.watch custom_path.to_s do |paths|
|
36
|
-
@results += paths
|
37
|
-
end
|
38
|
-
@fsevent.paths.should == ["#{custom_path}"]
|
39
|
-
run
|
40
|
-
FileUtils.touch file
|
41
|
-
stop
|
42
|
-
File.delete file
|
43
|
-
@results.should == [custom_path.to_s + '/']
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should catch new file" do
|
47
|
-
file = @fixture_path.join("newfile.rb")
|
48
|
-
File.delete file if File.exists? file
|
49
|
-
run
|
50
|
-
FileUtils.touch file
|
51
|
-
stop
|
52
|
-
File.delete file
|
53
|
-
@results.should == [@fixture_path.to_s + '/']
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should catch file update" do
|
57
|
-
file = @fixture_path.join("folder1/file1.txt")
|
58
|
-
File.exists?(file).should be_true
|
59
|
-
run
|
60
|
-
FileUtils.touch file
|
61
|
-
stop
|
62
|
-
@results.should == [@fixture_path.join("folder1/").to_s]
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should catch files update" do
|
66
|
-
file1 = @fixture_path.join("folder1/file1.txt")
|
67
|
-
file2 = @fixture_path.join("folder1/folder2/file2.txt")
|
68
|
-
File.exists?(file1).should be_true
|
69
|
-
File.exists?(file2).should be_true
|
70
|
-
run
|
71
|
-
FileUtils.touch file1
|
72
|
-
FileUtils.touch file2
|
73
|
-
stop
|
74
|
-
@results.should == [@fixture_path.join("folder1/").to_s, @fixture_path.join("folder1/folder2/").to_s]
|
75
|
-
end
|
76
|
-
|
77
|
-
def run
|
78
|
-
sleep 1
|
79
|
-
Thread.new { @fsevent.run }
|
80
|
-
sleep 1
|
81
|
-
end
|
82
|
-
|
83
|
-
def stop
|
84
|
-
sleep 1
|
85
|
-
@fsevent.stop
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|