Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove vendor stuff and depend on listen

  • Loading branch information...
commit c98167e16d576dd9a349991a4c900a9e3f911452 1 parent 43b8733
@thibaudgg thibaudgg authored
Showing with 1 addition and 6,084 deletions.
  1. +0 −44 Rakefile
  2. BIN  bin/fsevent_watch_guard_guard
  3. +0 −64 ext/extconf.rb
  4. +0 −226 ext/fsevent/fsevent_watch.c
  5. +0 −23 ext/fsevent_watch/.gitignore
  6. +0 −38 ext/fsevent_watch/Info.plist
  7. +0 −21 ext/fsevent_watch/LICENSE
  8. +0 −254 ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj
  9. +0 −394 ext/fsevent_watch/fsevent_watch/TSICTString.c
  10. +0 −74 ext/fsevent_watch/fsevent_watch/TSICTString.h
  11. +0 −160 ext/fsevent_watch/fsevent_watch/cli.c
  12. +0 −45 ext/fsevent_watch/fsevent_watch/cli.h
  13. +0 −34 ext/fsevent_watch/fsevent_watch/common.h
  14. +0 −20 ext/fsevent_watch/fsevent_watch/compat.c
  15. +0 −40 ext/fsevent_watch/fsevent_watch/compat.h
  16. +0 −509 ext/fsevent_watch/fsevent_watch/main.c
  17. +0 −82 ext/fsevent_watch/xcconfig/Common.xcconfig
  18. +0 −19 ext/fsevent_watch/xcconfig/Debug.xcconfig
  19. +0 −23 ext/fsevent_watch/xcconfig/Release.xcconfig
  20. +0 −17 ext/fsevent_watch/xcconfig/fsevent_watch.xcconfig
  21. +0 −47 ext/rakefile.rb
  22. +0 −33 ext/rb-fsevent.xcconfig
  23. +1 −1  guard.gemspec
  24. +0 −19 lib/vendor/darwin/.gitignore
  25. +0 −6 lib/vendor/darwin/Gemfile
  26. +0 −8 lib/vendor/darwin/Guardfile
  27. +0 −20 lib/vendor/darwin/LICENSE
  28. +0 −255 lib/vendor/darwin/README.rdoc
  29. +0 −21 lib/vendor/darwin/Rakefile
  30. BIN  lib/vendor/darwin/bin/fsevent_watch
  31. +0 −23 lib/vendor/darwin/ext/fsevent_watch/.gitignore
  32. +0 −38 lib/vendor/darwin/ext/fsevent_watch/Info.plist
  33. +0 −21 lib/vendor/darwin/ext/fsevent_watch/LICENSE
  34. +0 −254 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj
  35. +0 −394 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.c
  36. +0 −74 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.h
  37. +0 −160 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.c
  38. +0 −45 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.h
  39. +0 −34 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/common.h
  40. +0 −20 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.c
  41. +0 −40 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.h
  42. +0 −509 lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/main.c
  43. +0 −82 lib/vendor/darwin/ext/fsevent_watch/xcconfig/Common.xcconfig
  44. +0 −19 lib/vendor/darwin/ext/fsevent_watch/xcconfig/Debug.xcconfig
  45. +0 −23 lib/vendor/darwin/ext/fsevent_watch/xcconfig/Release.xcconfig
  46. +0 −17 lib/vendor/darwin/ext/fsevent_watch/xcconfig/fsevent_watch.xcconfig
  47. +0 −47 lib/vendor/darwin/ext/rakefile.rb
  48. +0 −33 lib/vendor/darwin/ext/rb-fsevent.xcconfig
  49. +0 −2  lib/vendor/darwin/lib/rb-fsevent.rb
  50. +0 −105 lib/vendor/darwin/lib/rb-fsevent/fsevent.rb
  51. +0 −3  lib/vendor/darwin/lib/rb-fsevent/version.rb
  52. +0 −25 lib/vendor/darwin/rb-fsevent.gemspec
  53. 0  lib/vendor/darwin/spec/fixtures/custom 'path/.gitignore
  54. 0  lib/vendor/darwin/spec/fixtures/folder1/file1.txt
  55. 0  lib/vendor/darwin/spec/fixtures/folder1/folder2/file2.txt
  56. +0 −75 lib/vendor/darwin/spec/rb-fsevent/fsevent_spec.rb
  57. +0 −23 lib/vendor/darwin/spec/spec_helper.rb
  58. +0 −3  lib/vendor/linux/.gitignore
  59. +0 −4 lib/vendor/linux/.yardopts
  60. +0 −20 lib/vendor/linux/MIT-LICENSE
  61. +0 −66 lib/vendor/linux/README.md
  62. +0 −54 lib/vendor/linux/Rakefile
  63. +0 −1  lib/vendor/linux/VERSION
  64. +0 −17 lib/vendor/linux/lib/rb-inotify.rb
  65. +0 −139 lib/vendor/linux/lib/rb-inotify/event.rb
  66. +0 −31 lib/vendor/linux/lib/rb-inotify/native.rb
  67. +0 −89 lib/vendor/linux/lib/rb-inotify/native/flags.rb
  68. +0 −308 lib/vendor/linux/lib/rb-inotify/notifier.rb
  69. +0 −83 lib/vendor/linux/lib/rb-inotify/watcher.rb
  70. +0 −53 lib/vendor/linux/rb-inotify.gemspec
  71. +0 −6 lib/vendor/windows/.gitignore
  72. +0 −4 lib/vendor/windows/Gemfile
  73. +0 −34 lib/vendor/windows/README.md
  74. +0 −18 lib/vendor/windows/Rakefile
  75. +0 −14 lib/vendor/windows/lib/rb-fchange.rb
  76. +0 −29 lib/vendor/windows/lib/rb-fchange/event.rb
  77. +0 −45 lib/vendor/windows/lib/rb-fchange/native.rb
  78. +0 −78 lib/vendor/windows/lib/rb-fchange/native/flags.rb
  79. +0 −149 lib/vendor/windows/lib/rb-fchange/notifier.rb
  80. +0 −3  lib/vendor/windows/lib/rb-fchange/version.rb
  81. +0 −99 lib/vendor/windows/lib/rb-fchange/watcher.rb
  82. +0 −34 lib/vendor/windows/rb-fchange.gemspec
  83. 0  lib/vendor/windows/spec/fixtures/custom 'path/.gitignore
  84. 0  lib/vendor/windows/spec/fixtures/folder1/file1.txt
  85. 0  lib/vendor/windows/spec/fixtures/folder1/folder2/file2.txt
  86. +0 −119 lib/vendor/windows/spec/rb-fchange/fchange_spec.rb
  87. +0 −21 lib/vendor/windows/spec/spec_helper.rb
  88. 0  spec/fixtures/folder1/file1.txt
View
44 Rakefile
@@ -4,50 +4,6 @@ require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
-desc "Build vendored gems"
-task :build_vendor do
- raise unless File.exist?('Rakefile')
- # Destroy vendor
- sh "rm -rf lib/vendor && mkdir lib/vendor"
-
- # Clone the correct gems
- sh "git clone https://github.com/thibaudgg/rb-fsevent.git lib/vendor/darwin"
- sh "cd lib/vendor/darwin && git checkout 10c7980fa7b9678f787b7f4671f3b67f3a7571f1"
- sh "git clone https://github.com/nex3/rb-inotify.git lib/vendor/linux"
- sh "cd lib/vendor/linux && git checkout 01e7487e7a8d8f26b13c6835a321390c6618ccb7"
- sh "git clone https://github.com/stereobooster/rb-fchange.git lib/vendor/windows"
- sh "cd lib/vendor/windows && git checkout d655a602b73f11e6cca986cc3f9fe2846f2dc771"
-
- # Strip out the .git directories
- %w[darwin linux windows].each {|platform| sh "rm -rf lib/vendor/#{platform}/.git"}
-
- # Move ext directory of darwin to root
- sh "mkdir -p ext"
- sh "cp -r lib/vendor/darwin/ext/* ext/"
-
- # Alter darwin extconf.rb
- extconf_path = File.expand_path("../ext/extconf.rb", __FILE__)
- extconf_contents = File.read(extconf_path)
- extconf_contents.sub!(/puts "Warning/, '#\0')
- extconf_contents.gsub!(/bin\/fsevent_watch/, 'bin/fsevent_watch_guard')
- File.open(extconf_path, 'w') { |f| f << extconf_contents }
-
- # Alter lib/vendor/darwin/lib/rb-fsevent/fsevent.rb
- fsevent_path = File.expand_path("../lib/vendor/darwin/lib/rb-fsevent/fsevent.rb", __FILE__)
- fsevent_contents = File.read(fsevent_path)
- fsevent_contents.sub!(/fsevent_watch/, 'fsevent_watch_guard')
- fsevent_contents.sub!(/'\.\.'/, "'..', '..', '..', '..'")
-
- File.open(fsevent_path, 'w') { |f| f << fsevent_contents }
-end
-
-desc "Compile mac executable"
-task :build_mac_exec do
- Dir.chdir(File.expand_path("../ext", __FILE__)) do
- system("ruby extconf.rb") or raise
- end
-end
-
require 'rbconfig'
namespace(:spec) do
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/i
View
BIN  bin/fsevent_watch_guard_guard
Binary file not shown
View
64 ext/extconf.rb
@@ -1,64 +0,0 @@
-# Workaround to make Rubygems believe it builds a native gem
-require 'mkmf'
-create_makefile('none')
-
-# TODO: determine whether we really need to be working around instead of with mkmf
-
-if `uname -s`.chomp != 'Darwin'
- ##puts "Warning! Only Darwin (Mac OS X) systems are supported, nothing will be compiled"
-else
- begin
- xcode_path = %x[xcode-select -print-path].to_s.strip!
- rescue Errno::ENOENT
- end
-
- raise "Could not find a suitable Xcode installation" unless xcode_path
-
- 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 "#{xcode_path}/SDKs/MacOSX#{sdk_version}.sdk"
- -mmacosx-version-min=#{sdk_version} -mdynamic-no-pic -std=gnu99
- }
-
- cflags = core_flags + %w{-Os -pipe}
-
- arch_sig = `uname -m`
- cflags << '-arch i386' if arch_sig =~ /i386$/i
-
- 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
- }
-
- cc_opts = core_flags + ldflags
-
- cc_opts += %w{
- -D DEBUG=true
- } if ENV['FWDEBUG'] == "true"
-
- cc_bin = `which clang || which gcc`.to_s.strip!
-
- compile_command = "CFLAGS='#{cflags.join(' ')} #{wflags.join(' ')}' #{cc_bin} #{cc_opts.join(' ')} -o '#{gem_root}/bin/fsevent_watch_guard_guard' 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_guard_guard")
- raise "Compilation of fsevent_watch failed (see README)"
- end
-end
View
226 ext/fsevent/fsevent_watch.c
@@ -1,226 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <CoreServices/CoreServices.h>
-
-
-// Structure for storing metadata parsed from the commandline
-static struct {
- FSEventStreamEventId sinceWhen;
- CFTimeInterval latency;
- FSEventStreamCreateFlags flags;
- CFMutableArrayRef paths;
-} config = {
- (UInt64) kFSEventStreamEventIdSinceNow,
- (double) 0.3,
- (UInt32) kFSEventStreamCreateFlagNone,
- NULL
-};
-
-// Prototypes
-static void append_path(const char *path);
-static inline void parse_cli_settings(int argc, const char *argv[]);
-static void callback(FSEventStreamRef streamRef,
- void *clientCallBackInfo,
- size_t numEvents,
- void *eventPaths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[]);
-
-
-// Resolve a path and append it to the CLI settings structure
-// The FSEvents API will, internally, resolve paths using a similar scheme.
-// Performing this ahead of time makes things less confusing, IMHO.
-static void append_path(const char *path)
-{
-#ifdef DEBUG
- fprintf(stderr, "\n");
- fprintf(stderr, "append_path called for: %s\n", path);
-#endif
-
- char fullPath[PATH_MAX];
-
- if (realpath(path, fullPath) == NULL) {
-#ifdef DEBUG
- fprintf(stderr, " realpath not directly resolvable from path\n");
-#endif
-
- if (path[0] != '/') {
-#ifdef DEBUG
- fprintf(stderr, " passed path is not absolute\n");
-#endif
- size_t len;
- getcwd(fullPath, sizeof(fullPath));
-#ifdef DEBUG
- fprintf(stderr, " result of getcwd: %s\n", fullPath);
-#endif
- len = strlen(fullPath);
- fullPath[len] = '/';
- strlcpy(&fullPath[len + 1], path, sizeof(fullPath) - (len + 1));
- } else {
-#ifdef DEBUG
- fprintf(stderr, " assuming path does not YET exist\n");
-#endif
- strlcpy(fullPath, path, sizeof(fullPath));
- }
- }
-
-#ifdef DEBUG
- fprintf(stderr, " resolved path to: %s\n", fullPath);
- fprintf(stderr, "\n");
- fflush(stderr);
-#endif
-
- CFStringRef pathRef = CFStringCreateWithCString(kCFAllocatorDefault,
- fullPath,
- kCFStringEncodingUTF8);
- CFArrayAppendValue(config.paths, pathRef);
- CFRelease(pathRef);
-}
-
-// Parse commandline settings
-static inline void parse_cli_settings(int argc, const char *argv[])
-{
- config.paths = CFArrayCreateMutable(NULL,
- (CFIndex)0,
- &kCFTypeArrayCallBacks);
-
- for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "--since-when") == 0) {
- config.sinceWhen = strtoull(argv[++i], NULL, 0);
- } else if (strcmp(argv[i], "--latency") == 0) {
- config.latency = strtod(argv[++i], NULL);
- } else if (strcmp(argv[i], "--no-defer") == 0) {
- config.flags |= kFSEventStreamCreateFlagNoDefer;
- } else if (strcmp(argv[i], "--watch-root") == 0) {
- config.flags |= kFSEventStreamCreateFlagWatchRoot;
- } else if (strcmp(argv[i], "--ignore-self") == 0) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
- config.flags |= kFSEventStreamCreateFlagIgnoreSelf;
-#else
- fprintf(stderr, "MacOSX10.6.sdk is required for --ignore-self\n");
-#endif
- } else {
- append_path(argv[i]);
- }
- }
-
- if (CFArrayGetCount(config.paths) == 0) {
- append_path(".");
- }
-
-#ifdef DEBUG
- fprintf(stderr, "config.sinceWhen %llu\n", config.sinceWhen);
- fprintf(stderr, "config.latency %f\n", config.latency);
- fprintf(stderr, "config.flags %#.8x\n", config.flags);
- fprintf(stderr, "config.paths\n");
-
- long numpaths = CFArrayGetCount(config.paths);
-
- for (long i = 0; i < numpaths; i++) {
- char path[PATH_MAX];
- CFStringGetCString(CFArrayGetValueAtIndex(config.paths, i),
- path,
- PATH_MAX,
- kCFStringEncodingUTF8);
- fprintf(stderr, " %s\n", path);
- }
-
- fprintf(stderr, "\n");
- fflush(stderr);
-#endif
-}
-
-static void callback(FSEventStreamRef streamRef,
- void *clientCallBackInfo,
- size_t numEvents,
- void *eventPaths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[])
-{
- char **paths = eventPaths;
-
-#ifdef DEBUG
- fprintf(stderr, "\n");
- fprintf(stderr, "FSEventStreamCallback fired!\n");
- fprintf(stderr, " numEvents: %lu\n", numEvents);
-
- for (size_t i = 0; i < numEvents; i++) {
- fprintf(stderr, " event path: %s\n", paths[i]);
- fprintf(stderr, " event flags: %#.8x\n", eventFlags[i]);
- fprintf(stderr, " event ID: %llu\n", eventIds[i]);
- }
-
- fprintf(stderr, "\n");
- fflush(stderr);
-#endif
-
- for (size_t i = 0; i < numEvents; i++) {
- fprintf(stdout, "%s", paths[i]);
- fprintf(stdout, ":");
- }
-
- fprintf(stdout, "\n");
- fflush(stdout);
-}
-
-int main(int argc, const char *argv[])
-{
- /*
- * a subprocess will initially inherit the process group of its parent. the
- * process group may have a control terminal associated with it, which would
- * be the first tty device opened by the group leader. typically the group
- * leader is your shell and the control terminal is your login device. a
- * subset of signals triggered on the control terminal are sent to all members
- * of the process group, in large part to facilitate sane and consistent
- * cleanup (ex: control terminal was closed).
- *
- * so why the overly descriptive lecture style comment?
- * 1. SIGINT and SIGQUIT are among the signals with this behavior
- * 2. a number of applications gank the above for their own use
- * 3. ruby's insanely useful "guard" is one of these applications
- * 4. despite having some level of understanding of POSIX signals and a few
- * of the scenarios that might cause problems, i learned this one only
- * after reading ruby 1.9's process.c
- * 5. if left completely undocumented, even slightly obscure bugfixes
- * may be removed as cruft by a future maintainer
- *
- * hindsight is 20/20 addition: if you're single-threaded and blocking on IO
- * with a subprocess, then handlers for deferrable signals might not get run
- * when you expect them to. In the case of Ruby 1.8, that means making use of
- * IO::select, which will preserve correct signal handling behavior.
- */
- if (setpgid(0,0) < 0) {
- fprintf(stderr, "Unable to set new process group.\n");
- return 1;
- }
-
- parse_cli_settings(argc, argv);
-
- FSEventStreamContext context = {0, NULL, NULL, NULL, NULL};
- FSEventStreamRef stream;
- stream = FSEventStreamCreate(kCFAllocatorDefault,
- (FSEventStreamCallback)&callback,
- &context,
- config.paths,
- config.sinceWhen,
- config.latency,
- config.flags);
-
-#ifdef DEBUG
- FSEventStreamShow(stream);
- fprintf(stderr, "\n");
- fflush(stderr);
-#endif
-
- FSEventStreamScheduleWithRunLoop(stream,
- CFRunLoopGetCurrent(),
- kCFRunLoopDefaultMode);
- FSEventStreamStart(stream);
- CFRunLoopRun();
- FSEventStreamFlushSync(stream);
- FSEventStreamStop(stream);
-
- return 0;
-}
View
23 ext/fsevent_watch/.gitignore
@@ -1,23 +0,0 @@
-# xcode
-build/*
-*.pbxuser
-!default.pbxuser
-*.mode1v3
-!default.mode1v3
-*.mode2v3
-!default.mode2v3
-*.perspectivev3
-!default.perspectivev3
-*.xcworkspace
-!default.xcworkspace
-xcuserdata
-profile
-*.moved-aside
-
-# macos
-.DS_Store
-Icon?
-._*
-.Spotlight-V100
-.Trashes
-
View
38 ext/fsevent_watch/Info.plist
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleIdentifier</key>
- <string>com.teaspoonofinsanity.fsevent_watch</string>
- <key>CFBundleExecutable</key>
- <string>fsevent_watch</string>
- <key>CFBundleName</key>
- <string>fsevent_watch</string>
- <key>LSMinimumSystemVersion</key>
- <string>MACOSX_DEPLOYMENT_TARGET</string>
- <key>CFBundleVersion</key>
- <string>CURRENT_PROJECT_VERSION</string>
- <key>FSEWOptimizationLevel</key>
- <string>OPTIMIZATION_LEVEL</string>
- <key>FSEWVersionInfoBuilder</key>
- <string>VERSION_INFO_BUILDER</string>
- <key>FSEWVersionInfoString</key>
- <string>VERSION_INFO_STRING</string>
- <key>BuildMachineOSBuild</key>
- <string>MAC_OS_X_PRODUCT_BUILD_VERSION</string>
- <key>BuildMachineOSVersion</key>
- <string>MAC_OS_X_VERSION_ACTUAL</string>
- <key>DTCompiler</key>
- <string>GCC_VERSION</string>
- <key>DTPlatformBuild</key>
- <string>PLATFORM_PRODUCT_BUILD_VERSION</string>
- <key>DTSDKBuild</key>
- <string>SDK_PRODUCT_BUILD_VERSION</string>
- <key>DTSDKName</key>
- <string>SDK_NAME</string>
- <key>DTXcode</key>
- <string>XCODE_VERSION_ACTUAL</string>
- <key>DTXcodeBuild</key>
- <string>XCODE_PRODUCT_BUILD_VERSION</string>
-</dict>
-</plist>
View
21 ext/fsevent_watch/LICENSE
@@ -1,21 +0,0 @@
-Copyright (c) 2011 Travis Tilley
-
-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.
-
View
254 ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj
@@ -1,254 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 46;
- objects = {
-
-/* Begin PBXBuildFile section */
- 6A20BF7F13FC9BC000C6C442 /* cli.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A20BF7C13FC9BC000C6C442 /* cli.c */; };
- 6A57F70413F5E614000BE6A9 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A57F70313F5E614000BE6A9 /* CoreServices.framework */; };
- 6A57F70713F5E614000BE6A9 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A57F70613F5E614000BE6A9 /* main.c */; };
- 6A81FCE8143429DF00F83EDD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */; };
- 6A81FCEC14342A6300F83EDD /* TSICTString.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A81FCEA14342A6300F83EDD /* TSICTString.c */; };
- EDF2B90D143584E800C6EF62 /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = EDF2B90C143584E800C6EF62 /* compat.c */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXBuildRule section */
- 6A0B980414AA652A00952375 /* PBXBuildRule */ = {
- isa = PBXBuildRule;
- compilerSpec = com.apple.compilers.proxy.script;
- filePatterns = "*.rl";
- fileType = pattern.proxy;
- isEditable = 1;
- name = "Ragel source to C source";
- outputFiles = (
- "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).c",
- );
- script = "/usr/bin/env ragel $(INPUT_FILE_BASE).rl -G2 -o $(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).c\n/usr/bin/env ragel $(INPUT_FILE_BASE).rl -V -o $(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).dot\n";
- };
-/* End PBXBuildRule section */
-
-/* Begin PBXFileReference section */
- 6A20BF7C13FC9BC000C6C442 /* cli.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cli.c; sourceTree = "<group>"; };
- 6A20BF7D13FC9BC000C6C442 /* cli.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cli.h; sourceTree = "<group>"; };
- 6A20BF7E13FC9BC000C6C442 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
- 6A57F6FF13F5E614000BE6A9 /* fsevent_watch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fsevent_watch; sourceTree = BUILT_PRODUCTS_DIR; };
- 6A57F70313F5E614000BE6A9 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
- 6A57F70613F5E614000BE6A9 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
- 6A68C5E31440CBDF0040623D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
- 6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
- 6A81FCEA14342A6300F83EDD /* TSICTString.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TSICTString.c; sourceTree = "<group>"; };
- 6A81FCEB14342A6300F83EDD /* TSICTString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSICTString.h; sourceTree = "<group>"; };
- 6A8F495414AC05470094EE00 /* Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
- 6A8F495514AC05470094EE00 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
- 6A8F495614AC05470094EE00 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
- 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = fsevent_watch.xcconfig; sourceTree = "<group>"; };
- 6AD3022F13F8D758007F24E8 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = "<group>"; };
- EDF2B90C143584E800C6EF62 /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 6A57F6FC13F5E614000BE6A9 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 6A81FCE8143429DF00F83EDD /* CoreFoundation.framework in Frameworks */,
- 6A57F70413F5E614000BE6A9 /* CoreServices.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 6A57F6F413F5E614000BE6A9 = {
- isa = PBXGroup;
- children = (
- 6A8F495314AC05470094EE00 /* xcconfig */,
- 6A68C5E31440CBDF0040623D /* Info.plist */,
- 6A57F70513F5E614000BE6A9 /* fsevent_watch */,
- 6A57F70213F5E614000BE6A9 /* Frameworks */,
- 6A57F70013F5E614000BE6A9 /* Products */,
- );
- indentWidth = 2;
- sourceTree = "<group>";
- tabWidth = 2;
- };
- 6A57F70013F5E614000BE6A9 /* Products */ = {
- isa = PBXGroup;
- children = (
- 6A57F6FF13F5E614000BE6A9 /* fsevent_watch */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- 6A57F70213F5E614000BE6A9 /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */,
- 6A57F70313F5E614000BE6A9 /* CoreServices.framework */,
- );
- name = Frameworks;
- sourceTree = "<group>";
- };
- 6A57F70513F5E614000BE6A9 /* fsevent_watch */ = {
- isa = PBXGroup;
- children = (
- 6A81FCEA14342A6300F83EDD /* TSICTString.c */,
- 6A81FCEB14342A6300F83EDD /* TSICTString.h */,
- 6A20BF7C13FC9BC000C6C442 /* cli.c */,
- 6A20BF7D13FC9BC000C6C442 /* cli.h */,
- 6A20BF7E13FC9BC000C6C442 /* common.h */,
- 6A57F70613F5E614000BE6A9 /* main.c */,
- 6AD3022F13F8D758007F24E8 /* compat.h */,
- EDF2B90C143584E800C6EF62 /* compat.c */,
- );
- path = fsevent_watch;
- sourceTree = "<group>";
- };
- 6A8F495314AC05470094EE00 /* xcconfig */ = {
- isa = PBXGroup;
- children = (
- 6A8F495414AC05470094EE00 /* Common.xcconfig */,
- 6A8F495514AC05470094EE00 /* Debug.xcconfig */,
- 6A8F495614AC05470094EE00 /* Release.xcconfig */,
- 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */,
- );
- path = xcconfig;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 6A57F6FE13F5E614000BE6A9 /* fsevent_watch */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 6A57F70C13F5E614000BE6A9 /* Build configuration list for PBXNativeTarget "fsevent_watch" */;
- buildPhases = (
- 6A8F497D14AC134E0094EE00 /* plist */,
- 6A57F6FB13F5E614000BE6A9 /* Sources */,
- 6A57F6FC13F5E614000BE6A9 /* Frameworks */,
- );
- buildRules = (
- 6A0B980414AA652A00952375 /* PBXBuildRule */,
- );
- dependencies = (
- );
- name = fsevent_watch;
- productName = fsevent_watch;
- productReference = 6A57F6FF13F5E614000BE6A9 /* fsevent_watch */;
- productType = "com.apple.product-type.tool";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 6A57F6F613F5E614000BE6A9 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0420;
- ORGANIZATIONNAME = TeaspoonOfInsanity;
- };
- buildConfigurationList = 6A57F6F913F5E614000BE6A9 /* Build configuration list for PBXProject "fsevent_watch" */;
- compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- );
- mainGroup = 6A57F6F413F5E614000BE6A9;
- productRefGroup = 6A57F70013F5E614000BE6A9 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 6A57F6FE13F5E614000BE6A9 /* fsevent_watch */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXShellScriptBuildPhase section */
- 6A8F497D14AC134E0094EE00 /* plist */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- "$(SRCROOT)/Info.plist",
- );
- name = plist;
- outputPaths = (
- "$(DERIVED_FILE_DIR)/Info.plist",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/bash;
- shellScript = "${CC:-cc} -E -P -x c -Wno-trigraphs -traditional -CC \\\n-DCURRENT_PROJECT_VERSION=\"${CURRENT_PROJECT_VERSION}\" \\\n-DGCC_VERSION=\"${GCC_VERSION}\" \\\n-DMACOSX_DEPLOYMENT_TARGET=\"${MACOSX_DEPLOYMENT_TARGET}\" \\\n-DMAC_OS_X_PRODUCT_BUILD_VERSION=\"${MAC_OS_X_PRODUCT_BUILD_VERSION}\" \\\n-DMAC_OS_X_VERSION_ACTUAL=\"${MAC_OS_X_VERSION_ACTUAL}\" \\\n-DOPTIMIZATION_LEVEL=\"${OPTIMIZATION_LEVEL}\" \\\n-DPLATFORM_PRODUCT_BUILD_VERSION=\"${PLATFORM_PRODUCT_BUILD_VERSION}\" \\\n-DSDK_NAME=\"${SDK_NAME}\" \\\n-DSDK_PRODUCT_BUILD_VERSION=\"${SDK_PRODUCT_BUILD_VERSION}\" \\\n-DVERSION_INFO_BUILDER=\"${VERSION_INFO_BUILDER}\" \\\n-DVERSION_INFO_STRING=\"${VERSION_INFO_STRING}\" \\\n-DXCODE_PRODUCT_BUILD_VERSION=\"${XCODE_PRODUCT_BUILD_VERSION}\" \\\n-DXCODE_VERSION_ACTUAL=\"${XCODE_VERSION_ACTUAL}\" \\\n\"${SRCROOT}/Info.plist\" \\\n-o \"${DERIVED_FILE_DIR}/Info.plist\"\n";
- };
-/* End PBXShellScriptBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 6A57F6FB13F5E614000BE6A9 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 6A57F70713F5E614000BE6A9 /* main.c in Sources */,
- 6A20BF7F13FC9BC000C6C442 /* cli.c in Sources */,
- 6A81FCEC14342A6300F83EDD /* TSICTString.c in Sources */,
- EDF2B90D143584E800C6EF62 /* compat.c in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 6A57F70A13F5E614000BE6A9 /* Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 6A8F495514AC05470094EE00 /* Debug.xcconfig */;
- buildSettings = {
- };
- name = Debug;
- };
- 6A57F70B13F5E614000BE6A9 /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 6A8F495614AC05470094EE00 /* Release.xcconfig */;
- buildSettings = {
- };
- name = Release;
- };
- 6A57F70D13F5E614000BE6A9 /* Debug */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */;
- buildSettings = {
- };
- name = Debug;
- };
- 6A57F70E13F5E614000BE6A9 /* Release */ = {
- isa = XCBuildConfiguration;
- baseConfigurationReference = 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */;
- buildSettings = {
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 6A57F6F913F5E614000BE6A9 /* Build configuration list for PBXProject "fsevent_watch" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 6A57F70A13F5E614000BE6A9 /* Debug */,
- 6A57F70B13F5E614000BE6A9 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 6A57F70C13F5E614000BE6A9 /* Build configuration list for PBXNativeTarget "fsevent_watch" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 6A57F70D13F5E614000BE6A9 /* Debug */,
- 6A57F70E13F5E614000BE6A9 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 6A57F6F613F5E614000BE6A9 /* Project object */;
-}
View
394 ext/fsevent_watch/fsevent_watch/TSICTString.c
@@ -1,394 +0,0 @@
-//
-// TSICTString.c
-// TSITString
-//
-// Created by Travis Tilley on 9/27/11.
-//
-
-#include "TSICTString.h"
-
-
-const char* const TNetstringTypes = ",#^!~}]Z";
-const char* const OTNetstringTypes = ",#^!~{[Z";
-const UInt8 TNetstringSeparator = ':';
-
-TSITStringFormat TSITStringDefaultFormat = kTSITStringFormatTNetstring;
-
-static const CFRange BeginningRange = {0,0};
-
-static CFTypeID kCFDataTypeID = -1UL;
-static CFTypeID kCFStringTypeID = -1UL;
-static CFTypeID kCFNumberTypeID = -1UL;
-static CFTypeID kCFBooleanTypeID = -1UL;
-static CFTypeID kCFNullTypeID = -1UL;
-static CFTypeID kCFArrayTypeID = -1UL;
-static CFTypeID kCFDictionaryTypeID = -1UL;
-
-
-__attribute__((constructor)) void Init_TSICTString(void)
-{
- kCFDataTypeID = CFDataGetTypeID();
- kCFStringTypeID = CFStringGetTypeID();
- kCFNumberTypeID = CFNumberGetTypeID();
- kCFBooleanTypeID = CFBooleanGetTypeID();
- kCFNullTypeID = CFNullGetTypeID();
- kCFArrayTypeID = CFArrayGetTypeID();
- kCFDictionaryTypeID = CFDictionaryGetTypeID();
-}
-
-
-void TSICTStringSetDefaultFormat(TSITStringFormat format)
-{
- if (format == kTSITStringFormatDefault) {
- TSITStringDefaultFormat = kTSITStringFormatTNetstring;
- } else {
- TSITStringDefaultFormat = format;
- }
-}
-
-TSITStringFormat TSICTStringGetDefaultFormat(void)
-{
- return TSITStringDefaultFormat;
-}
-
-
-void TSICTStringDestroy(TStringIRep* rep)
-{
- CFRelease(rep->data);
- free(rep->length);
- free(rep);
-}
-
-
-static inline TStringIRep* TSICTStringCreateWithDataOfTypeAndFormat(CFDataRef data, TSITStringTag type, TSITStringFormat format)
-{
- if (format == kTSITStringFormatDefault) {
- format = TSICTStringGetDefaultFormat();
- }
-
- TStringIRep* rep = calloc(1, sizeof(TStringIRep));
- rep->data = CFDataCreateCopy(kCFAllocatorDefault, data);
- rep->type = type;
- rep->format = format;
- rep->length = calloc(10, sizeof(char));
-
- CFIndex len = CFDataGetLength(rep->data);
- if (snprintf(rep->length, 10, "%lu", len)) {
- return rep;
- } else {
- TSICTStringDestroy(rep);
- return NULL;
- }
-}
-
-static inline CFDataRef TSICTStringCreateDataFromIntermediateRepresentation(TStringIRep* rep)
-{
- CFIndex len = CFDataGetLength(rep->data);
- CFMutableDataRef buffer = CFDataCreateMutableCopy(kCFAllocatorDefault, (len + 12), rep->data);
- UInt8* bufferBytes = CFDataGetMutableBytePtr(buffer);
-
- size_t prefixLength = strlen(rep->length) + 1;
- CFDataReplaceBytes(buffer, BeginningRange, (const UInt8*)rep->length, (CFIndex)prefixLength);
-
- if (rep->format == kTSITStringFormatTNetstring) {
- const UInt8 ftag = (UInt8)TNetstringTypes[rep->type];
- CFDataAppendBytes(buffer, &ftag, 1);
- bufferBytes[(prefixLength - 1)] = TNetstringSeparator;
- } else if (rep->format == kTSITStringFormatOTNetstring) {
- const UInt8 ftag = (UInt8)OTNetstringTypes[rep->type];
- bufferBytes[(prefixLength - 1)] = ftag;
- }
-
- CFDataRef dataRep = CFDataCreateCopy(kCFAllocatorDefault, buffer);
- CFRelease(buffer);
-
- return dataRep;
-}
-
-static inline CFStringRef TSICTStringCreateStringFromIntermediateRepresentation(TStringIRep* rep)
-{
- CFDataRef data = TSICTStringCreateDataFromIntermediateRepresentation(rep);
- CFStringRef string = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, kCFStringEncodingUTF8);
- CFRelease(data);
- return string;
-}
-
-static inline CFDataRef TSICTStringCreateDataWithDataOfTypeAndFormat(CFDataRef data, TSITStringTag type, TSITStringFormat format)
-{
- CFRetain(data);
-
- if (format == kTSITStringFormatDefault) {
- format = TSICTStringGetDefaultFormat();
- }
-
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, type, format);
- if (rep == NULL) {
- return NULL;
- }
-
- CFDataRef result = TSICTStringCreateDataFromIntermediateRepresentation(rep);
-
- TSICTStringDestroy(rep);
- CFRelease(data);
-
- return result;
-}
-
-static inline void TSICTStringAppendObjectToMutableDataWithFormat(CFTypeRef object, CFMutableDataRef buffer, TSITStringFormat format)
-{
- if (object == NULL) {
- object = kCFNull;
- }
-
- CFRetain(object);
-
- TStringIRep* objRep = TSICTStringCreateWithObjectAndFormat(object, format);
- CFDataRef objData = TSICTStringCreateDataFromIntermediateRepresentation(objRep);
- CFDataAppendBytes(buffer, (CFDataGetBytePtr(objData)), CFDataGetLength(objData));
- CFRelease(objData);
- TSICTStringDestroy(objRep);
-
- CFRelease(object);
-}
-
-static void ArrayBufferAppendCallback(const void* item, void* context)
-{
- TStringCollectionCallbackContext* cx = (TStringCollectionCallbackContext*)context;
- CFMutableDataRef buffer = cx->buffer;
- TSITStringFormat format = cx->format;
-
- TSICTStringAppendObjectToMutableDataWithFormat(item, buffer, format);
-}
-
-static void DictionaryBufferAppendCallback(const void* key, const void* value, void* context)
-{
- TStringCollectionCallbackContext* cx = (TStringCollectionCallbackContext*)context;
- CFMutableDataRef buffer = cx->buffer;
- TSITStringFormat format = cx->format;
-
- TSICTStringAppendObjectToMutableDataWithFormat(key, buffer, format);
- TSICTStringAppendObjectToMutableDataWithFormat(value, buffer, format);
-}
-
-
-CFDataRef TSICTStringCreateRenderedData(TStringIRep* rep)
-{
- return TSICTStringCreateDataFromIntermediateRepresentation(rep);
-}
-
-CFDataRef TSICTStringCreateRenderedDataFromObjectWithFormat(CFTypeRef object, TSITStringFormat format)
-{
- if (object == NULL) {
- object = kCFNull;
- }
-
- CFRetain(object);
-
- TStringIRep* rep = TSICTStringCreateWithObjectAndFormat(object, format);
- CFDataRef data = TSICTStringCreateDataFromIntermediateRepresentation(rep);
-
- TSICTStringDestroy(rep);
- CFRelease(object);
-
- return data;
-}
-
-CFStringRef TSICTStringCreateRenderedString(TStringIRep* rep)
-{
- return TSICTStringCreateStringFromIntermediateRepresentation(rep);
-}
-
-CFStringRef TSICTStringCreateRenderedStringFromObjectWithFormat(CFTypeRef object, TSITStringFormat format)
-{
- if (object == NULL) {
- object = kCFNull;
- }
-
- CFRetain(object);
-
- TStringIRep* rep = TSICTStringCreateWithObjectAndFormat(object, format);
- CFStringRef string = TSICTStringCreateStringFromIntermediateRepresentation(rep);
-
- TSICTStringDestroy(rep);
- CFRelease(object);
-
- return string;
-}
-
-
-TStringIRep* TSICTStringCreateWithObjectAndFormat(CFTypeRef object, TSITStringFormat format)
-{
- if (object == NULL) {
- return TSICTStringCreateNullWithFormat(format);
- }
- CFRetain(object);
-
- CFTypeID cfType = CFGetTypeID(object);
- TStringIRep* rep = NULL;
-
- if (cfType == kCFDataTypeID) {
- rep = TSICTStringCreateWithDataOfTypeAndFormat(object, kTSITStringTagString, format);
- } else if (cfType == kCFStringTypeID) {
- rep = TSICTStringCreateWithStringAndFormat(object, format);
- } else if (cfType == kCFNumberTypeID) {
- rep = TSICTStringCreateWithNumberAndFormat(object, format);
- } else if (cfType == kCFBooleanTypeID) {
- if (CFBooleanGetValue(object)) {
- rep = TSICTStringCreateTrueWithFormat(format);
- } else {
- rep = TSICTStringCreateFalseWithFormat(format);
- }
- } else if (cfType == kCFNullTypeID) {
- rep = TSICTStringCreateNullWithFormat(format);
- } else if (cfType == kCFArrayTypeID) {
- rep = TSICTStringCreateWithArrayAndFormat(object, format);
- } else if (cfType == kCFDictionaryTypeID) {
- rep = TSICTStringCreateWithDictionaryAndFormat(object, format);
- } else {
- rep = TSICTStringCreateInvalidWithFormat(format);
- }
-
- CFRelease(object);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateWithStringAndFormat(CFStringRef string, TSITStringFormat format)
-{
- CFRetain(string);
- CFDataRef data = CFStringCreateExternalRepresentation(kCFAllocatorDefault, string, kCFStringEncodingUTF8, '?');
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagString, format);
- CFRelease(data);
- CFRelease(string);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateWithNumberAndFormat(CFNumberRef number, TSITStringFormat format)
-{
- CFRetain(number);
- TSITStringTag tag = kTSITStringTagNumber;
- CFDataRef data;
- CFNumberType numType = CFNumberGetType(number);
-
- switch(numType) {
- case kCFNumberCharType:
- {
- int value;
- if (CFNumberGetValue(number, kCFNumberIntType, &value)) {
- if (value == 0 || value == 1) {
- tag = kTSITStringTagBool;
- } else {
- tag = kTSITStringTagString;
- }
- }
- break;
- }
- case kCFNumberFloat32Type:
- case kCFNumberFloat64Type:
- case kCFNumberFloatType:
- case kCFNumberDoubleType:
- {
- tag = kTSITStringTagFloat;
- break;
- }
- }
-
- if (tag == kTSITStringTagBool) {
- bool value;
- CFNumberGetValue(number, kCFNumberIntType, &value);
- if (value) {
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"true", 4);
- } else {
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"false", 5);
- }
- } else if (tag == kTSITStringTagFloat) {
- char buf[32];
- char *p, *e;
- double value;
-
- CFNumberGetValue(number, numType, &value);
- sprintf(buf, "%#.15g", value);
-
- e = buf + strlen(buf);
- p = e;
- while (p[-1]=='0' && ('0' <= p[-2] && p[-2] <= '9')) {
- p--;
- }
- memmove(p, e, strlen(e)+1);
-
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
- } else {
- char buf[32];
- SInt64 value;
- CFNumberGetValue(number, numType, &value);
- sprintf(buf, "%lli", value);
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
- }
-
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, tag, format);
- CFRelease(data);
- CFRelease(number);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateTrueWithFormat(TSITStringFormat format)
-{
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"true", 4);
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagBool, format);
- CFRelease(data);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateFalseWithFormat(TSITStringFormat format)
-{
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"false", 5);
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagBool, format);
- CFRelease(data);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateNullWithFormat(TSITStringFormat format)
-{
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, NULL, 0);
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagNull, format);
- CFRelease(data);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateInvalidWithFormat(TSITStringFormat format)
-{
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, NULL, 0);
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagInvalid, format);
- CFRelease(data);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateWithArrayAndFormat(CFArrayRef array, TSITStringFormat format)
-{
- CFRetain(array);
-
- CFMutableDataRef buffer = CFDataCreateMutable(kCFAllocatorDefault, 0);
-
- CFRange all = CFRangeMake(0, CFArrayGetCount(array));
- TStringCollectionCallbackContext cx = {buffer, format};
- CFArrayApplyFunction(array, all, ArrayBufferAppendCallback, &cx);
-
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(buffer, kTSITStringTagList, format);
- CFRelease(buffer);
- CFRelease(array);
- return rep;
-}
-
-TStringIRep* TSICTStringCreateWithDictionaryAndFormat(CFDictionaryRef dictionary, TSITStringFormat format)
-{
- CFRetain(dictionary);
-
- CFMutableDataRef buffer = CFDataCreateMutable(kCFAllocatorDefault, 0);
-
- TStringCollectionCallbackContext cx = {buffer, format};
- CFDictionaryApplyFunction(dictionary, DictionaryBufferAppendCallback, &cx);
-
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(buffer, kTSITStringTagDict, format);
- CFRelease(buffer);
- CFRelease(dictionary);
- return rep;
-}
View
74 ext/fsevent_watch/fsevent_watch/TSICTString.h
@@ -1,74 +0,0 @@
-//
-// TSICTString.h
-// TSITString
-//
-// Created by Travis Tilley on 9/27/11.
-//
-
-#ifndef TSICTString_H
-#define TSICTString_H
-
-#include <CoreFoundation/CoreFoundation.h>
-
-
-typedef enum {
- kTSITStringTagString = 0,
- kTSITStringTagNumber = 1,
- kTSITStringTagFloat = 2,
- kTSITStringTagBool = 3,
- kTSITStringTagNull = 4,
- kTSITStringTagDict = 5,
- kTSITStringTagList = 6,
- kTSITStringTagInvalid = 7,
-} TSITStringTag;
-
-extern const char* const TNetstringTypes;
-extern const char* const OTNetstringTypes;
-extern const UInt8 TNetstringSeparator;
-
-typedef enum {
- kTSITStringFormatDefault = 0,
- kTSITStringFormatOTNetstring = 1,
- kTSITStringFormatTNetstring = 2,
-} TSITStringFormat;
-
-extern TSITStringFormat TSITStringDefaultFormat;
-
-typedef struct TSITStringIntermediate {
- CFDataRef data;
- char* length;
- TSITStringTag type;
- TSITStringFormat format;
-} TStringIRep;
-
-typedef struct {
- CFMutableDataRef buffer;
- TSITStringFormat format;
-} TStringCollectionCallbackContext;
-
-
-void Init_TSICTString(void);
-
-void TSICTStringSetDefaultFormat(TSITStringFormat format);
-TSITStringFormat TSICTStringGetDefaultFormat(void);
-
-void TSICTStringDestroy(TStringIRep* rep);
-
-CFDataRef TSICTStringCreateRenderedData(TStringIRep* rep);
-CFDataRef TSICTStringCreateRenderedDataFromObjectWithFormat(CFTypeRef object, TSITStringFormat format);
-
-CFStringRef TSICTStringCreateRenderedString(TStringIRep* rep);
-CFStringRef TSICTStringCreateRenderedStringFromObjectWithFormat(CFTypeRef object, TSITStringFormat format);
-
-TStringIRep* TSICTStringCreateWithObjectAndFormat(CFTypeRef object, TSITStringFormat format);
-TStringIRep* TSICTStringCreateWithStringAndFormat(CFStringRef string, TSITStringFormat format);
-TStringIRep* TSICTStringCreateWithNumberAndFormat(CFNumberRef number, TSITStringFormat format);
-TStringIRep* TSICTStringCreateTrueWithFormat(TSITStringFormat format);
-TStringIRep* TSICTStringCreateFalseWithFormat(TSITStringFormat format);
-TStringIRep* TSICTStringCreateNullWithFormat(TSITStringFormat format);
-TStringIRep* TSICTStringCreateInvalidWithFormat(TSITStringFormat format);
-TStringIRep* TSICTStringCreateWithArrayAndFormat(CFArrayRef array, TSITStringFormat format);
-TStringIRep* TSICTStringCreateWithDictionaryAndFormat(CFDictionaryRef dictionary, TSITStringFormat format);
-
-
-#endif
View
160 ext/fsevent_watch/fsevent_watch/cli.c
@@ -1,160 +0,0 @@
-#include <getopt.h>
-#include "cli.h"
-
-const char* cli_info_purpose = "A flexible command-line interface for the FSEvents API";
-const char* cli_info_usage = "Usage: fsevent_watch [OPTIONS]... [PATHS]...";
-const char* cli_info_help[] = {
- " -h, --help you're looking at it",
- " -V, --version print version number and exit",
- " -s, --since-when=EventID fire historical events since ID",
- " -l, --latency=seconds latency period (default='0.5')",
- " -n, --no-defer enable no-defer latency modifier",
- " -r, --watch-root watch for when the root path has changed",
- // " -i, --ignore-self ignore current process",
- " -F, --file-events provide file level event data",
- " -f, --format=name output format (classic, niw, \n"
- " tnetstring, otnetstring)",
- 0
-};
-
-static void default_args (struct cli_info* args_info)
-{
- args_info->since_when_arg = kFSEventStreamEventIdSinceNow;
- args_info->latency_arg = 0.5;
- args_info->no_defer_flag = false;
- args_info->watch_root_flag = false;
- args_info->ignore_self_flag = false;
- args_info->file_events_flag = false;
- args_info->format_arg = kFSEventWatchOutputFormatClassic;
-}
-
-static void cli_parser_release (struct cli_info* args_info)
-{
- unsigned int i;
-
- for (i=0; i < args_info->inputs_num; ++i) {
- free(args_info->inputs[i]);
- }
-
- if (args_info->inputs_num) {
- free(args_info->inputs);
- }
-
- args_info->inputs_num = 0;
-}
-
-void cli_parser_init (struct cli_info* args_info)
-{
- default_args(args_info);
-
- args_info->inputs = 0;
- args_info->inputs_num = 0;
-}
-
-void cli_parser_free (struct cli_info* args_info)
-{
- cli_parser_release(args_info);
-}
-
-void cli_print_version (void)
-{
- printf("%s %s\n", CLI_NAME, CLI_VERSION);
-#ifdef COMPILED_AT
- printf("Compiled %s\n", COMPILED_AT);
-#endif
-}
-
-void cli_print_help (void)
-{
- cli_print_version();
-
- printf("\n%s\n", cli_info_purpose);
- printf("\n%s\n", cli_info_usage);
- printf("\n");
-
- int i = 0;
- while (cli_info_help[i]) {
- printf("%s\n", cli_info_help[i++]);
- }
-}
-
-int cli_parser (int argc, const char** argv, struct cli_info* args_info)
-{
- static struct option longopts[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "since-when", required_argument, NULL, 's' },
- { "latency", required_argument, NULL, 'l' },
- { "no-defer", no_argument, NULL, 'n' },
- { "watch-root", no_argument, NULL, 'r' },
- { "ignore-self", no_argument, NULL, 'i' },
- { "file-events", no_argument, NULL, 'F' },
- { "format", required_argument, NULL, 'f' },
- { 0, 0, 0, 0 }
- };
-
- const char* shortopts = "hVs:l:nriFf:";
-
- int c = -1;
-
- while ((c = getopt_long(argc, (char * const*)argv, shortopts, longopts, NULL)) != -1) {
- switch(c) {
- case 's': // since-when
- args_info->since_when_arg = strtoull(optarg, NULL, 0);
- break;
- case 'l': // latency
- args_info->latency_arg = strtod(optarg, NULL);
- break;
- case 'n': // no-defer
- args_info->no_defer_flag = true;
- break;
- case 'r': // watch-root
- args_info->watch_root_flag = true;
- break;
- case 'i': // ignore-self
- args_info->ignore_self_flag = true;
- break;
- case 'F': // file-events
- args_info->file_events_flag = true;
- break;
- case 'f': // format
- if (strcmp(optarg, "classic") == 0) {
- args_info->format_arg = kFSEventWatchOutputFormatClassic;
- } else if (strcmp(optarg, "niw") == 0) {
- args_info->format_arg = kFSEventWatchOutputFormatNIW;
- } else if (strcmp(optarg, "tnetstring") == 0) {
- args_info->format_arg = kFSEventWatchOutputFormatTNetstring;
- } else if (strcmp(optarg, "otnetstring") == 0) {
- args_info->format_arg = kFSEventWatchOutputFormatOTNetstring;
- } else {
- fprintf(stderr, "Unknown output format: %s\n", optarg);
- exit(EXIT_FAILURE);
- }
- break;
- case 'V': // version
- cli_print_version();
- exit(EXIT_SUCCESS);
- break;
- case 'h': // help
- case '?': // invalid option
- case ':': // missing argument
- cli_print_help();
- exit((c == 'h') ? EXIT_SUCCESS : EXIT_FAILURE);
- break;
- }
- }
-
- if (optind < argc) {
- int i = 0;
- args_info->inputs_num = (unsigned int)(argc - optind);
- args_info->inputs =
- (char**)(malloc ((args_info->inputs_num)*sizeof(char*)));
- while (optind < argc)
- if (argv[optind++] != argv[0]) {
- args_info->inputs[i++] = strdup(argv[optind-1]);
- }
- }
-
- return EXIT_SUCCESS;
-}
-
View
45 ext/fsevent_watch/fsevent_watch/cli.h
@@ -1,45 +0,0 @@
-#ifndef CLI_H
-#define CLI_H
-
-#ifndef CLI_NAME
-#define CLI_NAME "fsevent_watch"
-#endif /* CLI_NAME */
-
-#ifndef PROJECT_VERSION
-#error "PROJECT_VERSION not set"
-#endif /* PROJECT_VERSION */
-
-#ifndef CLI_VERSION
-#define _str(s) #s
-#define _xstr(s) _str(s)
-#define CLI_VERSION _xstr(PROJECT_VERSION)
-#endif /* CLI_VERSION */
-
-#include "common.h"
-
-struct cli_info {
- UInt64 since_when_arg;
- double latency_arg;
- bool no_defer_flag;
- bool watch_root_flag;
- bool ignore_self_flag;
- bool file_events_flag;
- enum FSEventWatchOutputFormat format_arg;
-
- char** inputs;
- unsigned inputs_num;
-};
-
-extern const char* cli_info_purpose;
-extern const char* cli_info_usage;
-extern const char* cli_info_help[];
-
-void cli_print_help(void);
-void cli_print_version(void);
-
-int cli_parser (int argc, const char** argv, struct cli_info* args_info);
-void cli_parser_init (struct cli_info* args_info);
-void cli_parser_free (struct cli_info* args_info);
-
-
-#endif /* CLI_H */
View
34 ext/fsevent_watch/fsevent_watch/common.h
@@ -1,34 +0,0 @@
-#ifndef fsevent_watch_common_h
-#define fsevent_watch_common_h
-
-#include <CoreFoundation/CoreFoundation.h>
-#ifdef __OBJC__
-#import <Foundation/Foundation.h>
-#endif
-
-#include <CoreServices/CoreServices.h>
-#include <unistd.h>
-#include "compat.h"
-#include "TSICTString.h"
-
-#define COMPILED_AT __DATE__ " " __TIME__
-
-#define FLAG_CHECK(flags, flag) ((flags) & (flag))
-
-#define FPRINTF_FLAG_CHECK(flags, flag, msg, fd) \
- do { \
- if (FLAG_CHECK(flags, flag)) { \
- fprintf(fd, "%s", msg "\n"); } } \
- while (0)
-
-#define FLAG_CHECK_STDERR(flags, flag, msg) \
- FPRINTF_FLAG_CHECK(flags, flag, msg, stderr)
-
-enum FSEventWatchOutputFormat {
- kFSEventWatchOutputFormatClassic,
- kFSEventWatchOutputFormatNIW,
- kFSEventWatchOutputFormatTNetstring,
- kFSEventWatchOutputFormatOTNetstring
-};
-
-#endif /* fsevent_watch_common_h */
View
20 ext/fsevent_watch/fsevent_watch/compat.c
@@ -1,20 +0,0 @@
-#include "compat.h"
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
-FSEventStreamCreateFlags kFSEventStreamCreateFlagIgnoreSelf = 0x00000008;
-#endif
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
-FSEventStreamCreateFlags kFSEventStreamCreateFlagFileEvents = 0x00000010;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemCreated = 0x00000100;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemRemoved = 0x00000200;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemRenamed = 0x00000800;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemModified = 0x00001000;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemChangeOwner = 0x00004000;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemXattrMod = 0x00008000;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemIsFile = 0x00010000;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemIsDir = 0x00020000;
-FSEventStreamEventFlags kFSEventStreamEventFlagItemIsSymlink = 0x00040000;
-#endif
View
40 ext/fsevent_watch/fsevent_watch/compat.h
@@ -1,40 +0,0 @@
-/**
- * @headerfile compat.h
- * FSEventStream flag compatibility shim
- *
- * In order to compile a binary against an older SDK yet still support the
- * features present in later OS releases, we need to define any missing enum
- * constants not present in the older SDK. This allows us to safely defer
- * feature detection to runtime (and avoid recompilation).
- */
-
-
-#ifndef fsevent_watch_compat_h
-#define fsevent_watch_compat_h
-
-#ifndef __CORESERVICES__
-#include <CoreServices/CoreServices.h>
-#endif // __CORESERVICES__
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
-// ignoring events originating from the current process introduced in 10.6
-extern FSEventStreamCreateFlags kFSEventStreamCreateFlagIgnoreSelf;
-#endif
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
-// file-level events introduced in 10.7
-extern FSEventStreamCreateFlags kFSEventStreamCreateFlagFileEvents;
-extern FSEventStreamEventFlags kFSEventStreamEventFlagItemCreated,
- kFSEventStreamEventFlagItemRemoved,
- kFSEventStreamEventFlagItemInodeMetaMod,
- kFSEventStreamEventFlagItemRenamed,
- kFSEventStreamEventFlagItemModified,
- kFSEventStreamEventFlagItemFinderInfoMod,
- kFSEventStreamEventFlagItemChangeOwner,
- kFSEventStreamEventFlagItemXattrMod,
- kFSEventStreamEventFlagItemIsFile,
- kFSEventStreamEventFlagItemIsDir,
- kFSEventStreamEventFlagItemIsSymlink;
-#endif
-
-#endif // fsevent_watch_compat_h
View
509 ext/fsevent_watch/fsevent_watch/main.c
@@ -1,509 +0,0 @@
-#include "common.h"
-#include "cli.h"
-
-// TODO: set on fire. cli.{h,c} handle both parsing and defaults, so there's
-// no need to set those here. also, in order to scope metadata by path,
-// each stream will need its own configuration... so this won't work as
-// a global any more. In the end the goal is to make the output format
-// able to declare not just that something happened and what flags were
-// attached, but what path it was watching that caused those events (so
-// that the path itself can be used for routing that information to the
-// relevant callback).
-//
-// Structure for storing metadata parsed from the commandline
-static struct {
- FSEventStreamEventId sinceWhen;
- CFTimeInterval latency;
- FSEventStreamCreateFlags flags;
- CFMutableArrayRef paths;
- enum FSEventWatchOutputFormat format;
-} config = {
- (UInt64) kFSEventStreamEventIdSinceNow,
- (double) 0.3,
- (CFOptionFlags) kFSEventStreamCreateFlagNone,
- NULL,
- kFSEventWatchOutputFormatClassic
-};
-
-// Prototypes
-static void append_path(const char* path);
-static inline void parse_cli_settings(int argc, const char* argv[]);
-static void callback(FSEventStreamRef streamRef,
- void* clientCallBackInfo,
- size_t numEvents,
- void* eventPaths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[]);
-
-
-// Resolve a path and append it to the CLI settings structure
-// The FSEvents API will, internally, resolve paths using a similar scheme.
-// Performing this ahead of time makes things less confusing, IMHO.
-static void append_path(const char* path)
-{
-#ifdef DEBUG
- fprintf(stderr, "\n");
- fprintf(stderr, "append_path called for: %s\n", path);
-#endif
-
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
-
-#ifdef DEBUG
- fprintf(stderr, "compiled against 10.6+, using CFURLCreateFileReferenceURL\n");
-#endif
-
- CFURLRef url = CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8*)path, (CFIndex)strlen(path), false);
- CFURLRef placeholder = CFURLCopyAbsoluteURL(url);
- CFRelease(url);
-
- CFMutableArrayRef imaginary = NULL;
-
- // if we don't have an existing url, spin until we get to a parent that
- // does exist, saving any imaginary components for appending back later
- while(!CFURLResourceIsReachable(placeholder, NULL)) {
-#ifdef DEBUG
- fprintf(stderr, "path does not exist\n");
-#endif
-
- CFStringRef child;
-
- if (imaginary == NULL) {
- imaginary = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
- }
-
- child = CFURLCopyLastPathComponent(placeholder);
- CFArrayInsertValueAtIndex(imaginary, 0, child);
- CFRelease(child);
-
- url = CFURLCreateCopyDeletingLastPathComponent(NULL, placeholder);
- CFRelease(placeholder);
- placeholder = url;
-
-#ifdef DEBUG
- fprintf(stderr, "parent: ");
- CFShow(placeholder);
-#endif
- }
-
-#ifdef DEBUG
- fprintf(stderr, "path exists\n");
-#endif
-
- // realpath() doesn't always return the correct case for a path, so this
- // is a funky workaround that converts a path into a (volId/inodeId) pair
- // and asks what the path should be for that. since it looks at the actual
- // inode instead of returning the same case passed in like realpath()
- // appears to do for HFS+, it should always be correct.
- url = CFURLCreateFileReferenceURL(NULL, placeholder, NULL);
- CFRelease(placeholder);
- placeholder = CFURLCreateFilePathURL(NULL, url, NULL);
- CFRelease(url);
-
-#ifdef DEBUG
- fprintf(stderr, "path resolved to: ");
- CFShow(placeholder);
-#endif
-
- // if we stripped off any imaginary path components, append them back on
- if (imaginary != NULL) {
- CFIndex count = CFArrayGetCount(imaginary);
- for (CFIndex i = 0; i<count; i++) {
- CFStringRef component = CFArrayGetValueAtIndex(imaginary, i);
-#ifdef DEBUG
- fprintf(stderr, "appending component: ");
- CFShow(component);
-#endif
- url = CFURLCreateCopyAppendingPathComponent(NULL, placeholder, component, false);
- CFRelease(placeholder);
- placeholder = url;
- }
- CFRelease(imaginary);
- }
-
-#ifdef DEBUG
- fprintf(stderr, "result: ");
- CFShow(placeholder);
-#endif
-
- CFStringRef cfPath = CFURLCopyFileSystemPath(placeholder, kCFURLPOSIXPathStyle);
- CFArrayAppendValue(config.paths, cfPath);
- CFRelease(cfPath);
- CFRelease(placeholder);
-
-#else
-
-#ifdef DEBUG
- fprintf(stderr, "compiled against 10.5, using realpath()\n");
-#endif
-
- char fullPath[PATH_MAX + 1];
-
- if (realpath(path, fullPath) == NULL) {
-#ifdef DEBUG
- fprintf(stderr, " realpath not directly resolvable from path\n");
-#endif
-
- if (path[0] != '/') {
-#ifdef DEBUG
- fprintf(stderr, " passed path is not absolute\n");
-#endif
- size_t len;
- getcwd(fullPath, sizeof(fullPath));
-#ifdef DEBUG
- fprintf(stderr, " result of getcwd: %s\n", fullPath);
-#endif
- len = strlen(fullPath);
- fullPath[len] = '/';
- strlcpy(&fullPath[len + 1], path, sizeof(fullPath) - (len + 1));
- } else {
-#ifdef DEBUG
- fprintf(stderr, " assuming path does not YET exist\n");
-#endif
- strlcpy(fullPath, path, sizeof(fullPath));
- }
- }
-
-#ifdef DEBUG
- fprintf(stderr, " resolved path to: %s\n", fullPath);
- fprintf(stderr, "\n");
-#endif
-
- CFStringRef pathRef = CFStringCreateWithCString(kCFAllocatorDefault,
- fullPath,
- kCFStringEncodingUTF8);
- CFArrayAppendValue(config.paths, pathRef);
- CFRelease(pathRef);
-
-#endif
-}
-
-// Parse commandline settings
-static inline void parse_cli_settings(int argc, const char* argv[])
-{
- // runtime os version detection
- SInt32 osMajorVersion, osMinorVersion;
- if (!(Gestalt(gestaltSystemVersionMajor, &osMajorVersion) == noErr)) {
- osMajorVersion = 0;
- }
- if (!(Gestalt(gestaltSystemVersionMinor, &osMinorVersion) == noErr)) {
- osMinorVersion = 0;
- }
-
- if ((osMajorVersion == 10) & (osMinorVersion < 5)) {
- fprintf(stderr, "The FSEvents API is unavailable on this version of macos!\n");
- exit(EXIT_FAILURE);
- }
-
- struct cli_info args_info;
- cli_parser_init(&args_info);
-
- if (cli_parser(argc, argv, &args_info) != 0) {
- exit(EXIT_FAILURE);
- }
-
- config.paths = CFArrayCreateMutable(NULL,
- (CFIndex)0,
- &kCFTypeArrayCallBacks);
-
- config.sinceWhen = args_info.since_when_arg;
- config.latency = args_info.latency_arg;
- config.format = args_info.format_arg;
-
- if (args_info.no_defer_flag) {
- config.flags |= kFSEventStreamCreateFlagNoDefer;
- }
- if (args_info.watch_root_flag) {
- config.flags |= kFSEventStreamCreateFlagWatchRoot;
- }
-
- if (args_info.ignore_self_flag) {
- if ((osMajorVersion == 10) & (osMinorVersion >= 6)) {
- config.flags |= kFSEventStreamCreateFlagIgnoreSelf;
- } else {
- fprintf(stderr, "MacOSX 10.6 or later is required for --ignore-self\n");
- exit(EXIT_FAILURE);
- }
- }
-
- if (args_info.file_events_flag) {
- if ((osMajorVersion == 10) & (osMinorVersion >= 7)) {
- config.flags |= kFSEventStreamCreateFlagFileEvents;
- } else {
- fprintf(stderr, "MacOSX 10.7 or later required for --file-events\n");
- exit(EXIT_FAILURE);
- }
- }
-
- if (args_info.inputs_num == 0) {
- append_path(".");
- } else {
- for (unsigned int i=0; i < args_info.inputs_num; ++i) {
- append_path(args_info.inputs[i]);
- }
- }
-
- cli_parser_free(&args_info);
-
-#ifdef DEBUG
- fprintf(stderr, "config.sinceWhen %llu\n", config.sinceWhen);
- fprintf(stderr, "config.latency %f\n", config.latency);
-
-// STFU clang
-#if __LP64__
- fprintf(stderr, "config.flags %#.8x\n", config.flags);
-#else
- fprintf(stderr, "config.flags %#.8lx\n", config.flags);
-#endif
-
- FLAG_CHECK_STDERR(config.flags, kFSEventStreamCreateFlagUseCFTypes,
- " Using CF instead of C types");
- FLAG_CHECK_STDERR(config.flags, kFSEventStreamCreateFlagNoDefer,
- " NoDefer latency modifier enabled");
- FLAG_CHECK_STDERR(config.flags, kFSEventStreamCreateFlagWatchRoot,
- " WatchRoot notifications enabled");
- FLAG_CHECK_STDERR(config.flags, kFSEventStreamCreateFlagIgnoreSelf,
- " IgnoreSelf enabled");
- FLAG_CHECK_STDERR(config.flags, kFSEventStreamCreateFlagFileEvents,
- " FileEvents enabled");
-
- fprintf(stderr, "config.paths\n");
-
- long numpaths = CFArrayGetCount(config.paths);
-
- for (long i = 0; i < numpaths; i++) {
- char path[PATH_MAX];
- CFStringGetCString(CFArrayGetValueAtIndex(config.paths, i),
- path,
- PATH_MAX,
- kCFStringEncodingUTF8);
- fprintf(stderr, " %s\n", path);
- }
-
- fprintf(stderr, "\n");
-#endif
-}
-
-// original output format for rb-fsevent
-static void classic_output_format(size_t numEvents,
- char** paths)
-{
- for (size_t i = 0; i < numEvents; i++) {
- fprintf(stdout, "%s:", paths[i]);
- }
- fprintf(stdout, "\n");
-}
-
-// output format used in the Yoshimasa Niwa branch of rb-fsevent
-static void niw_output_format(size_t numEvents,
- char** paths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[])
-{
- for (size_t i = 0; i < numEvents; i++) {
- fprintf(stdout, "%lu:%llu:%s\n",
- (unsigned long)eventFlags[i],
- (unsigned long long)eventIds[i],
- paths[i]);
- }
- fprintf(stdout, "\n");
-}
-
-static void tstring_output_format(size_t numEvents,
- char** paths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[],
- TSITStringFormat format)
-{
- CFMutableArrayRef events = CFArrayCreateMutable(kCFAllocatorDefault,
- 0, &kCFTypeArrayCallBacks);
-
- for (size_t i = 0; i < numEvents; i++) {
- CFMutableDictionaryRef event = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- CFStringRef path = CFStringCreateWithBytes(kCFAllocatorDefault,
- (const UInt8*)paths[i],
- (CFIndex)strlen(paths[i]),
- kCFStringEncodingUTF8,
- false);
- CFDictionarySetValue(event, CFSTR("path"), path);
-
- CFNumberRef flags = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &eventFlags[i]);
- CFDictionarySetValue(event, CFSTR("flags"), flags);
-
- CFNumberRef ident = CFNumberCreate(kCFAllocatorDefault, kCFNumberLongLongType, &eventIds[i]);
- CFDictionarySetValue(event, CFSTR("id"), ident);
-
- CFArrayAppendValue(events, event);
-
- CFRelease(event);
- CFRelease(path);
- CFRelease(flags);
- CFRelease(ident);
- }
-
- CFMutableDictionaryRef meta = CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- CFDictionarySetValue(meta, CFSTR("events"), events);
-
- CFNumberRef num = CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &numEvents);
- CFDictionarySetValue(meta, CFSTR("numEvents"), num);
-
- CFDataRef data = TSICTStringCreateRenderedDataFromObjectWithFormat(meta, format);
- fprintf(stdout, "%s", CFDataGetBytePtr(data));
-
- CFRelease(events);
- CFRelease(num);
- CFRelease(meta);
- CFRelease(data);
-}
-
-static void callback(__attribute__((unused)) FSEventStreamRef streamRef,
- __attribute__((unused)) void* clientCallBackInfo,
- size_t numEvents,
- void* eventPaths,
- const FSEventStreamEventFlags eventFlags[],
- const FSEventStreamEventId eventIds[])
-{
- char** paths = eventPaths;
-
-
-#ifdef DEBUG
- fprintf(stderr, "\n");
- fprintf(stderr, "FSEventStreamCallback fired!\n");
- fprintf(stderr, " numEvents: %lu\n", numEvents);
-
- for (size_t i = 0; i < numEvents; i++) {
- fprintf(stderr, "\n");
- fprintf(stderr, " event ID: %llu\n", eventIds[i]);
-
-// STFU clang
-#if __LP64__
- fprintf(stderr, " event flags: %#.8x\n", eventFlags[i]);
-#else
- fprintf(stderr, " event flags: %#.8lx\n", eventFlags[i]);
-#endif
-
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagMustScanSubDirs,
- " Recursive scanning of directory required");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagUserDropped,
- " Buffering problem: events dropped user-side");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagKernelDropped,
- " Buffering problem: events dropped kernel-side");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagEventIdsWrapped,
- " Event IDs have wrapped");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagHistoryDone,
- " All historical events have been processed");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagRootChanged,
- " Root path has changed");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagMount,
- " A new volume was mounted at this path");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagUnmount,
- " A volume was unmounted from this path");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemCreated,
- " Item created");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemRemoved,
- " Item removed");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemInodeMetaMod,
- " Item metadata modified");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemRenamed,
- " Item renamed");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemModified,
- " Item modified");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemFinderInfoMod,
- " Item Finder Info modified");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemChangeOwner,
- " Item changed ownership");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemXattrMod,
- " Item extended attributes modified");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemIsFile,
- " Item is a file");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemIsDir,
- " Item is a directory");
- FLAG_CHECK_STDERR(eventFlags[i], kFSEventStreamEventFlagItemIsSymlink,
- " Item is a symbolic link");
-
- fprintf(stderr, " event path: %s\n", paths[i]);
- fprintf(stderr, "\n");
- }
-
- fprintf(stderr, "\n");
-#endif
-
- if (config.format == kFSEventWatchOutputFormatClassic) {
- classic_output_format(numEvents, paths);
- } else if (config.format == kFSEventWatchOutputFormatNIW) {
- niw_output_format(numEvents, paths, eventFlags, eventIds);
- } else if (config.format == kFSEventWatchOutputFormatTNetstring) {
- tstring_output_format(numEvents, paths, eventFlags, eventIds,
- kTSITStringFormatTNetstring);
- } else if (config.format == kFSEventWatchOutputFormatOTNetstring) {
- tstring_output_format(numEvents, paths, eventFlags, eventIds,
- kTSITStringFormatOTNetstring);
- }
-
- fflush(stdout);
-}
-
-int main(int argc, const char* argv[])
-{
- /*
- * a subprocess will initially inherit the process group of its parent. the
- * process group may have a control terminal associated with it, which would
- * be the first tty device opened by the group leader. typically the group
- * leader is your shell and the control terminal is your login device. a
- * subset of signals triggered on the control terminal are sent to all members
- * of the process group, in large part to facilitate sane and consistent
- * cleanup (ex: control terminal was closed).
- *
- * so why the overly descriptive lecture style comment?
- * 1. SIGINT and SIGQUIT are among the signals with this behavior
- * 2. a number of applications gank the above for their own use
- * 3. ruby's insanely useful "guard" is one of these applications
- * 4. despite having some level of understanding of POSIX signals and a few
- * of the scenarios that might cause problems, i learned this one only
- * after reading ruby 1.9's process.c
- * 5. if left completely undocumented, even slightly obscure bugfixes
- * may be removed as cruft by a future maintainer
- *
- * hindsight is 20/20 addition: if you're single-threaded and blocking on IO
- * with a subprocess, then handlers for deferrable signals might not get run
- * when you expect them to. In the case of Ruby 1.8, that means making use of
- * IO::select, which will preserve correct signal handling behavior.
- */
- if (setpgid(0,0) < 0) {
- fprintf(stderr, "Unable to set new process group.\n");
- return 1;
- }
-
- parse_cli_settings(argc, argv);
-
- FSEventStreamContext context = {0, NULL, NULL, NULL, NULL};
- FSEventStreamRef stream;
- stream = FSEventStreamCreate(kCFAllocatorDefault,
- (FSEventStreamCallback)&callback,
- &context,
- config.paths,
- config.sinceWhen,
- config.latency,
- config.flags);
-
-#ifdef DEBUG
- FSEventStreamShow(stream);
- fprintf(stderr, "\n");
-#endif
-
- FSEventStreamScheduleWithRunLoop(stream,
- CFRunLoopGetCurrent(),
- kCFRunLoopDefaultMode);
- FSEventStreamStart(stream);
- CFRunLoopRun();
- FSEventStreamFlushSync(stream);
- FSEventStreamStop(stream);
-
- return 0;
-}
View
82 ext/fsevent_watch/xcconfig/Common.xcconfig
@@ -1,82 +0,0 @@
-// local defines
-COMMON_CFLAGS = -pipe
-COMMON_GCC_PREPROCESSOR_DEFINITIONS = NS_BUILD_32_LIKE_64 NS_BLOCK_ASSERTIONS
-
-
-// architectures
-ARCHS = $(ARCHS_STANDARD_32_64_BIT)
-VALID_ARCHS = i386 x86_64
-SDKROOT = macosx
-SUPPORTED_PLATFORMS = macosx
-ONLY_ACTIVE_ARCH = NO
-
-
-// build options
-DEBUG_INFORMATION_FORMAT = dwarf
-GCC_VERSION = com.apple.compilers.llvm.clang.1_0
-RUN_CLANG_STATIC_ANALYZER = YES
-
-
-// deployment
-MACOSX_DEPLOYMENT_TARGET = 10.6
-
-
-// linking
-DEAD_CODE_STRIPPING = YES
-PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
-LINK_WITH_STANDARD_LIBRARIES = YES
-
-
-// search paths
-FRAMEWORK_SEARCH_PATHS = $(value) $(SYSTEM_LIBRARY_DIR)/Frameworks $(LOCAL_LIBRARY_DIR)/Frameworks
-
-
-// code generation
-GCC_DYNAMIC_NO_PIC = NO
-GCC_FAST_OBJC_DISPATCH = YES
-GCC_GENERATE_DEBUGGING_SYMBOLS = YES
-GCC_STRICT_ALIASING = YES
-LLVM_LTO = YES
-
-
-// language
-GCC_C_LANGUAGE_STANDARD = gnu99
-OTHER_CFLAGS = $(COMMON_CFLAGS)
-
-
-// preprocessing
-GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_GCC_PREPROCESSOR_DEFINITIONS)
-
-
-// warnings
-CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
-CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES
-CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES
-CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
-GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES
-GCC_TREAT_WARNINGS_AS_ERRORS = NO
-GCC_WARN_64_TO_32_BIT_CONVERSION = YES
-GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
-GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
-GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
-GCC_WARN_ABOUT_MISSING_NEWLINE = YES
-GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO
-GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
-GCC_WARN_ABOUT_RETURN_TYPE = YES
-GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES
-GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
-GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO
-GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
-GCC_WARN_MISSING_PARENTHESES = YES
-GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO
-GCC_WARN_SHADOW = YES
-GCC_WARN_SIGN_COMPARE = YES
-GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
-GCC_WARN_UNINITIALIZED_AUTOS = YES
-GCC_WARN_UNKNOWN_PRAGMAS = YES
-GCC_WARN_UNUSED_FUNCTION = YES
-GCC_WARN_UNUSED_LABEL = YES
-GCC_WARN_UNUSED_PARAMETER = NO
-GCC_WARN_UNUSED_VALUE = YES
-GCC_WARN_UNUSED_VARIABLE = YES
-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
View
19 ext/fsevent_watch/xcconfig/Debug.xcconfig
@@ -1,19 +0,0 @@
-#include "Common.xcconfig"
-
-
-// deployment
-COPY_PHASE_STRIP = NO
-STRIP_INSTALLED_PRODUCT = NO
-
-
-// code generation
-GCC_OPTIMIZATION_LEVEL = 0
-GCC_GENERATE_DEBUGGING_SYMBOLS = YES
-
-
-// language
-OTHER_CFLAGS = $(COMMON_CFLAGS) -fcatch-undefined-behavior -ftrapv -fverbose-asm
-
-
-// preprocessing
-GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_GCC_PREPROCESSOR_DEFINITIONS) DEBUG DEBUG_$(USER)
View
23 ext/fsevent_watch/xcconfig/Release.xcconfig
@@ -1,23 +0,0 @@
-#include "Common.xcconfig"
-
-
-// build options
-VALIDATE_PRODUCT = YES
-
-
-// code signing
-CODE_SIGN_IDENTITY = 3rd Party Mac Developer Application: Travis Tilley
-
-
-// deployment
-COPY_PHASE_STRIP = YES
-STRIP_INSTALLED_PRODUCT = YES
-
-
-// code generation
-GCC_OPTIMIZATION_LEVEL = 4
-GCC_UNROLL_LOOPS = YES
-
-
-// preprocessing
-GCC_PREPROCESSOR_DEFINITIONS = $(COMMON_GCC_PREPROCESSOR_DEFINITIONS) NDEBUG
View
17 ext/fsevent_watch/xcconfig/fsevent_watch.xcconfig
@@ -1,17 +0,0 @@
-// linking
-MACH_O_TYPE = mh_execute
-OTHER_LDFLAGS = -sectcreate __TEXT __info_plist "$(DERIVED_FILE_DIR)/Info.plist"
-GENERATE_MASTER_OBJECT_FILE = YES
-
-
-// packaging
-INFOPLIST_FILE = Info.plist
-PRODUCT_NAME = $(TARGET_NAME)
-
-
-// versioning
-CURRENT_PROJECT_VERSION = 0.1.1
-
-
-// preprocessing
-GCC_PREPROCESSOR_DEFINITIONS = $(inherited) PROJECT_VERSION="$(CURRENT_PROJECT_VERSION)"
View
47 ext/rakefile.rb
@@ -1,47 +0,0 @@
-# vim: fileencoding=UTF-8 nobomb sw=2 ts=2 et
-
-XCODEBUILD = '/usr/bin/xcodebuild'
-XCCONFIG = File.expand_path('rb-fsevent.xcconfig')
-
-namespace :xcode do
- $target = 'fsevent_watch'
- $configuration = ENV['FWDEBUG'] ? 'Debug' : 'Release'
-
- def xcb(action, extra='')
- command = [
- XCODEBUILD,
- "-target", $target,
- "-configuration", $configuration,
- action,
- "-xcconfig", XCCONFIG,
- extra
- ].join(' ')
-
- Dir.chdir 'fsevent_watch' do
- results = `#{command}`
- STDERR.puts results
- raise "xcodebuild failure" unless $?.success?
- end
- end
-
- desc 'run xcodebuild clean'
- task :clean do
- xcb 'clean'
- end
-
- desc 'run xcodebuild build'
- task :build => :clean do
- xcb 'build'
- end
-
- desc 'run xcodebuild install'
- task :install => :build do
- xcb 'install', "DEPLOYMENT_LOCATION='YES'"
- end
-
- task :remove_turds do
- rm_rf File.join('fsevent_watch', 'build')
- end
-end
-
-task :default => ['xcode:install', 'xcode:remove_turds']
View
33 ext/rb-fsevent.xcconfig
@@ -1,33 +0,0 @@
-// settings in this file will override those defined in the xcode project
-
-// - deployment -
-INSTALL_MODE_FLAG = u+w,go-w,a+rX
-MACOSX_DEPLOYMENT_TARGET = 10.5
-DSTROOT = ../../
-INSTALL_PATH = /bin
-SKIP_INSTALL = NO
-
-// - build locations -
-SYMROOT = build
-OBJROOT = $(SYMROOT)
-
-// - architectures -
-ARCHS = $(NATIVE_ARCH_ACTUAL)
-SDKROOT =
-
-// - build options -
-GCC_VERSION = com.apple.compilers.llvm.clang.1_0
-
-// etc
-RUN_CLANG_STATIC_ANALYZER = YES
-DEAD_CODE_STRIPPING = YES
-PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
-LD_NO_PIE = NO
-GCC_GENERATE_DEBUGGING_SYMBOLS = YES
-LLVM_LTO = NO
-LLVM_LTO[arch=x86_64] = YES
-GCC_C_LANGUAGE_STANDARD = gnu99
-GCC_ENABLE_OBJC_EXCEPTIONS = YES
-GCC_ENABLE_OBJC_GC = unsupported
-GCC_ENABLE_EXCEPTIONS = YES
-
View
2  guard.gemspec
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.rubyforge_project = 'guard'
s.add_dependency 'thor', '~> 0.14.6'
- s.add_dependency 'ffi', '>= 0.5.0'
+ s.add_dependency 'listen', '>= 0.3.1'
s.add_development_dependency 'bundler'
s.add_development_dependency 'rspec', '~> 2.8.0'
View
19 lib/vendor/darwin/.gitignore
@@ -1,19 +0,0 @@
-pkg/*
-*.gem
-.bundle
-Gemfile.lock
-
-## MAC OS
-.DS_Store
-.Trashes
-.com.apple.timemachine.supported
-.fseventsd
-Desktop DB
-Desktop DF
-
-# /bin/fsevent_watch
-/ext/Makefile
-
-## editor/IDE
-.idea
-
View
6 lib/vendor/darwin/Gemfile
@@ -1,6 +0,0 @@
-source "http://rubygems.org"
-
-gemspec
-
-gem "rake"
-
View
8 lib/vendor/darwin/Guardfile
@@ -1,8 +0,0 @@
-# A sample Guardfile
-# More info at http://github.com/guard/guard#readme
-
-guard 'rspec', :version => 2 do
- watch(%r(^spec/(.*)_spec.rb))
- watch(%r(^lib/(.*)\.rb)) { |m| "spec/#{m[1]}_spec.rb" }
- watch('spec/spec_helper.rb') { "spec" }
-end
View
20 lib/vendor/darwin/LICENSE
@@ -1,20 +0,0 @@
-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.
View
255 lib/vendor/darwin/README.rdoc
@@ -1,255 +0,0 @@
-= rb-fsevent
-
-Very simple & usable Mac OSX FSEvents API
-
-- RubyCocoa not required!
-- Signals are working (really)
-- Tested on MRI 1.8.7 & 1.9.2, JRuby 1.6.3
-- Tested on 10.6 & 10.7 (though 10.5 should work just as well)
-- Tested with XCode 3.2.6, 4.0.2, 4.1, 4.2b5
-
-== Install
-
- gem install rb-fsevent
-
-== Usage
-
-=== Singular path
-
- require 'rb-fsevent'
-
- fsevent = FSEvent.new
- fsevent.watch Dir.pwd do |directories|
- puts "Detected change inside: #{directories.inspect}"
- end
- fsevent.run
-
-=== Multiple paths
-
- require 'rb-fsevent'
-
- paths = ['/tmp/path/one', '/tmp/path/two', Dir.p