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.
Files changed (77) hide show
  1. data/CHANGELOG.md +0 -6
  2. data/README.md +38 -30
  3. data/lib/guard.rb +158 -285
  4. data/lib/guard/cli.rb +16 -2
  5. data/lib/guard/dsl.rb +41 -20
  6. data/lib/guard/dsl_describer.rb +1 -1
  7. data/lib/guard/group.rb +1 -1
  8. data/lib/guard/guard.rb +39 -5
  9. data/lib/guard/guardfile.rb +70 -0
  10. data/lib/guard/runner.rb +179 -0
  11. data/lib/guard/ui.rb +1 -1
  12. data/lib/guard/version.rb +2 -4
  13. data/lib/guard/watcher.rb +1 -0
  14. metadata +16 -77
  15. data/bin/fsevent_watch_guard_guard +0 -0
  16. data/lib/guard/listener.rb +0 -376
  17. data/lib/guard/listeners/darwin.rb +0 -62
  18. data/lib/guard/listeners/linux.rb +0 -93
  19. data/lib/guard/listeners/polling.rb +0 -55
  20. data/lib/guard/listeners/windows.rb +0 -63
  21. data/lib/vendor/darwin/Gemfile +0 -6
  22. data/lib/vendor/darwin/Guardfile +0 -8
  23. data/lib/vendor/darwin/LICENSE +0 -20
  24. data/lib/vendor/darwin/README.rdoc +0 -255
  25. data/lib/vendor/darwin/Rakefile +0 -21
  26. data/lib/vendor/darwin/bin/fsevent_watch +0 -0
  27. data/lib/vendor/darwin/ext/fsevent_watch/Info.plist +0 -38
  28. data/lib/vendor/darwin/ext/fsevent_watch/LICENSE +0 -21
  29. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch.xcodeproj/project.pbxproj +0 -254
  30. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.c +0 -394
  31. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/TSICTString.h +0 -74
  32. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.c +0 -160
  33. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/cli.h +0 -45
  34. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/common.h +0 -34
  35. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.c +0 -20
  36. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/compat.h +0 -40
  37. data/lib/vendor/darwin/ext/fsevent_watch/fsevent_watch/main.c +0 -509
  38. data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Common.xcconfig +0 -82
  39. data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Debug.xcconfig +0 -19
  40. data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/Release.xcconfig +0 -23
  41. data/lib/vendor/darwin/ext/fsevent_watch/xcconfig/fsevent_watch.xcconfig +0 -17
  42. data/lib/vendor/darwin/ext/rakefile.rb +0 -47
  43. data/lib/vendor/darwin/ext/rb-fsevent.xcconfig +0 -33
  44. data/lib/vendor/darwin/lib/rb-fsevent.rb +0 -2
  45. data/lib/vendor/darwin/lib/rb-fsevent/fsevent.rb +0 -111
  46. data/lib/vendor/darwin/lib/rb-fsevent/version.rb +0 -3
  47. data/lib/vendor/darwin/rb-fsevent.gemspec +0 -25
  48. data/lib/vendor/darwin/spec/fixtures/folder1/file1.txt +0 -0
  49. data/lib/vendor/darwin/spec/fixtures/folder1/folder2/file2.txt +0 -0
  50. data/lib/vendor/darwin/spec/rb-fsevent/fsevent_spec.rb +0 -88
  51. data/lib/vendor/darwin/spec/spec_helper.rb +0 -23
  52. data/lib/vendor/linux/MIT-LICENSE +0 -20
  53. data/lib/vendor/linux/README.md +0 -66
  54. data/lib/vendor/linux/Rakefile +0 -54
  55. data/lib/vendor/linux/VERSION +0 -1
  56. data/lib/vendor/linux/lib/rb-inotify.rb +0 -17
  57. data/lib/vendor/linux/lib/rb-inotify/event.rb +0 -139
  58. data/lib/vendor/linux/lib/rb-inotify/native.rb +0 -31
  59. data/lib/vendor/linux/lib/rb-inotify/native/flags.rb +0 -89
  60. data/lib/vendor/linux/lib/rb-inotify/notifier.rb +0 -308
  61. data/lib/vendor/linux/lib/rb-inotify/watcher.rb +0 -83
  62. data/lib/vendor/linux/rb-inotify.gemspec +0 -53
  63. data/lib/vendor/windows/Gemfile +0 -4
  64. data/lib/vendor/windows/README.md +0 -34
  65. data/lib/vendor/windows/Rakefile +0 -18
  66. data/lib/vendor/windows/lib/rb-fchange.rb +0 -14
  67. data/lib/vendor/windows/lib/rb-fchange/event.rb +0 -29
  68. data/lib/vendor/windows/lib/rb-fchange/native.rb +0 -45
  69. data/lib/vendor/windows/lib/rb-fchange/native/flags.rb +0 -78
  70. data/lib/vendor/windows/lib/rb-fchange/notifier.rb +0 -149
  71. data/lib/vendor/windows/lib/rb-fchange/version.rb +0 -3
  72. data/lib/vendor/windows/lib/rb-fchange/watcher.rb +0 -99
  73. data/lib/vendor/windows/rb-fchange.gemspec +0 -34
  74. data/lib/vendor/windows/spec/fixtures/folder1/file1.txt +0 -0
  75. data/lib/vendor/windows/spec/fixtures/folder1/folder2/file2.txt +0 -0
  76. data/lib/vendor/windows/spec/rb-fchange/fchange_spec.rb +0 -119
  77. data/lib/vendor/windows/spec/spec_helper.rb +0 -21
@@ -1,21 +0,0 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
- require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new(:spec)
6
- task :default => :spec
7
-
8
- namespace(:spec) do
9
- desc "Run all specs on multiple ruby versions (requires rvm)"
10
- task(:portability) do
11
- %w[1.8.6 1.8.7 1.9.2 jruby-head].each do |version|
12
- system <<-BASH
13
- bash -c 'source ~/.rvm/scripts/rvm;
14
- rvm #{version};
15
- echo "--------- version #{version} ----------\n";
16
- bundle install;
17
- rake spec'
18
- BASH
19
- end
20
- end
21
- end
Binary file
@@ -1,38 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleIdentifier</key>
6
- <string>com.teaspoonofinsanity.fsevent_watch</string>
7
- <key>CFBundleExecutable</key>
8
- <string>fsevent_watch</string>
9
- <key>CFBundleName</key>
10
- <string>fsevent_watch</string>
11
- <key>LSMinimumSystemVersion</key>
12
- <string>MACOSX_DEPLOYMENT_TARGET</string>
13
- <key>CFBundleVersion</key>
14
- <string>CURRENT_PROJECT_VERSION</string>
15
- <key>FSEWOptimizationLevel</key>
16
- <string>OPTIMIZATION_LEVEL</string>
17
- <key>FSEWVersionInfoBuilder</key>
18
- <string>VERSION_INFO_BUILDER</string>
19
- <key>FSEWVersionInfoString</key>
20
- <string>VERSION_INFO_STRING</string>
21
- <key>BuildMachineOSBuild</key>
22
- <string>MAC_OS_X_PRODUCT_BUILD_VERSION</string>
23
- <key>BuildMachineOSVersion</key>
24
- <string>MAC_OS_X_VERSION_ACTUAL</string>
25
- <key>DTCompiler</key>
26
- <string>GCC_VERSION</string>
27
- <key>DTPlatformBuild</key>
28
- <string>PLATFORM_PRODUCT_BUILD_VERSION</string>
29
- <key>DTSDKBuild</key>
30
- <string>SDK_PRODUCT_BUILD_VERSION</string>
31
- <key>DTSDKName</key>
32
- <string>SDK_NAME</string>
33
- <key>DTXcode</key>
34
- <string>XCODE_VERSION_ACTUAL</string>
35
- <key>DTXcodeBuild</key>
36
- <string>XCODE_PRODUCT_BUILD_VERSION</string>
37
- </dict>
38
- </plist>
@@ -1,21 +0,0 @@
1
- Copyright (c) 2011 Travis Tilley
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-
@@ -1,254 +0,0 @@
1
- // !$*UTF8*$!
2
- {
3
- archiveVersion = 1;
4
- classes = {
5
- };
6
- objectVersion = 46;
7
- objects = {
8
-
9
- /* Begin PBXBuildFile section */
10
- 6A20BF7F13FC9BC000C6C442 /* cli.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A20BF7C13FC9BC000C6C442 /* cli.c */; };
11
- 6A57F70413F5E614000BE6A9 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A57F70313F5E614000BE6A9 /* CoreServices.framework */; };
12
- 6A57F70713F5E614000BE6A9 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A57F70613F5E614000BE6A9 /* main.c */; };
13
- 6A81FCE8143429DF00F83EDD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */; };
14
- 6A81FCEC14342A6300F83EDD /* TSICTString.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A81FCEA14342A6300F83EDD /* TSICTString.c */; };
15
- EDF2B90D143584E800C6EF62 /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = EDF2B90C143584E800C6EF62 /* compat.c */; };
16
- /* End PBXBuildFile section */
17
-
18
- /* Begin PBXBuildRule section */
19
- 6A0B980414AA652A00952375 /* PBXBuildRule */ = {
20
- isa = PBXBuildRule;
21
- compilerSpec = com.apple.compilers.proxy.script;
22
- filePatterns = "*.rl";
23
- fileType = pattern.proxy;
24
- isEditable = 1;
25
- name = "Ragel source to C source";
26
- outputFiles = (
27
- "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).c",
28
- );
29
- 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";
30
- };
31
- /* End PBXBuildRule section */
32
-
33
- /* Begin PBXFileReference section */
34
- 6A20BF7C13FC9BC000C6C442 /* cli.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cli.c; sourceTree = "<group>"; };
35
- 6A20BF7D13FC9BC000C6C442 /* cli.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cli.h; sourceTree = "<group>"; };
36
- 6A20BF7E13FC9BC000C6C442 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = "<group>"; };
37
- 6A57F6FF13F5E614000BE6A9 /* fsevent_watch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fsevent_watch; sourceTree = BUILT_PRODUCTS_DIR; };
38
- 6A57F70313F5E614000BE6A9 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
39
- 6A57F70613F5E614000BE6A9 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
40
- 6A68C5E31440CBDF0040623D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
41
- 6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
42
- 6A81FCEA14342A6300F83EDD /* TSICTString.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TSICTString.c; sourceTree = "<group>"; };
43
- 6A81FCEB14342A6300F83EDD /* TSICTString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSICTString.h; sourceTree = "<group>"; };
44
- 6A8F495414AC05470094EE00 /* Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
45
- 6A8F495514AC05470094EE00 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
46
- 6A8F495614AC05470094EE00 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
47
- 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = fsevent_watch.xcconfig; sourceTree = "<group>"; };
48
- 6AD3022F13F8D758007F24E8 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = "<group>"; };
49
- EDF2B90C143584E800C6EF62 /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = "<group>"; };
50
- /* End PBXFileReference section */
51
-
52
- /* Begin PBXFrameworksBuildPhase section */
53
- 6A57F6FC13F5E614000BE6A9 /* Frameworks */ = {
54
- isa = PBXFrameworksBuildPhase;
55
- buildActionMask = 2147483647;
56
- files = (
57
- 6A81FCE8143429DF00F83EDD /* CoreFoundation.framework in Frameworks */,
58
- 6A57F70413F5E614000BE6A9 /* CoreServices.framework in Frameworks */,
59
- );
60
- runOnlyForDeploymentPostprocessing = 0;
61
- };
62
- /* End PBXFrameworksBuildPhase section */
63
-
64
- /* Begin PBXGroup section */
65
- 6A57F6F413F5E614000BE6A9 = {
66
- isa = PBXGroup;
67
- children = (
68
- 6A8F495314AC05470094EE00 /* xcconfig */,
69
- 6A68C5E31440CBDF0040623D /* Info.plist */,
70
- 6A57F70513F5E614000BE6A9 /* fsevent_watch */,
71
- 6A57F70213F5E614000BE6A9 /* Frameworks */,
72
- 6A57F70013F5E614000BE6A9 /* Products */,
73
- );
74
- indentWidth = 2;
75
- sourceTree = "<group>";
76
- tabWidth = 2;
77
- };
78
- 6A57F70013F5E614000BE6A9 /* Products */ = {
79
- isa = PBXGroup;
80
- children = (
81
- 6A57F6FF13F5E614000BE6A9 /* fsevent_watch */,
82
- );
83
- name = Products;
84
- sourceTree = "<group>";
85
- };
86
- 6A57F70213F5E614000BE6A9 /* Frameworks */ = {
87
- isa = PBXGroup;
88
- children = (
89
- 6A81FCE7143429DE00F83EDD /* CoreFoundation.framework */,
90
- 6A57F70313F5E614000BE6A9 /* CoreServices.framework */,
91
- );
92
- name = Frameworks;
93
- sourceTree = "<group>";
94
- };
95
- 6A57F70513F5E614000BE6A9 /* fsevent_watch */ = {
96
- isa = PBXGroup;
97
- children = (
98
- 6A81FCEA14342A6300F83EDD /* TSICTString.c */,
99
- 6A81FCEB14342A6300F83EDD /* TSICTString.h */,
100
- 6A20BF7C13FC9BC000C6C442 /* cli.c */,
101
- 6A20BF7D13FC9BC000C6C442 /* cli.h */,
102
- 6A20BF7E13FC9BC000C6C442 /* common.h */,
103
- 6A57F70613F5E614000BE6A9 /* main.c */,
104
- 6AD3022F13F8D758007F24E8 /* compat.h */,
105
- EDF2B90C143584E800C6EF62 /* compat.c */,
106
- );
107
- path = fsevent_watch;
108
- sourceTree = "<group>";
109
- };
110
- 6A8F495314AC05470094EE00 /* xcconfig */ = {
111
- isa = PBXGroup;
112
- children = (
113
- 6A8F495414AC05470094EE00 /* Common.xcconfig */,
114
- 6A8F495514AC05470094EE00 /* Debug.xcconfig */,
115
- 6A8F495614AC05470094EE00 /* Release.xcconfig */,
116
- 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */,
117
- );
118
- path = xcconfig;
119
- sourceTree = "<group>";
120
- };
121
- /* End PBXGroup section */
122
-
123
- /* Begin PBXNativeTarget section */
124
- 6A57F6FE13F5E614000BE6A9 /* fsevent_watch */ = {
125
- isa = PBXNativeTarget;
126
- buildConfigurationList = 6A57F70C13F5E614000BE6A9 /* Build configuration list for PBXNativeTarget "fsevent_watch" */;
127
- buildPhases = (
128
- 6A8F497D14AC134E0094EE00 /* plist */,
129
- 6A57F6FB13F5E614000BE6A9 /* Sources */,
130
- 6A57F6FC13F5E614000BE6A9 /* Frameworks */,
131
- );
132
- buildRules = (
133
- 6A0B980414AA652A00952375 /* PBXBuildRule */,
134
- );
135
- dependencies = (
136
- );
137
- name = fsevent_watch;
138
- productName = fsevent_watch;
139
- productReference = 6A57F6FF13F5E614000BE6A9 /* fsevent_watch */;
140
- productType = "com.apple.product-type.tool";
141
- };
142
- /* End PBXNativeTarget section */
143
-
144
- /* Begin PBXProject section */
145
- 6A57F6F613F5E614000BE6A9 /* Project object */ = {
146
- isa = PBXProject;
147
- attributes = {
148
- LastUpgradeCheck = 0420;
149
- ORGANIZATIONNAME = TeaspoonOfInsanity;
150
- };
151
- buildConfigurationList = 6A57F6F913F5E614000BE6A9 /* Build configuration list for PBXProject "fsevent_watch" */;
152
- compatibilityVersion = "Xcode 3.2";
153
- developmentRegion = English;
154
- hasScannedForEncodings = 0;
155
- knownRegions = (
156
- en,
157
- );
158
- mainGroup = 6A57F6F413F5E614000BE6A9;
159
- productRefGroup = 6A57F70013F5E614000BE6A9 /* Products */;
160
- projectDirPath = "";
161
- projectRoot = "";
162
- targets = (
163
- 6A57F6FE13F5E614000BE6A9 /* fsevent_watch */,
164
- );
165
- };
166
- /* End PBXProject section */
167
-
168
- /* Begin PBXShellScriptBuildPhase section */
169
- 6A8F497D14AC134E0094EE00 /* plist */ = {
170
- isa = PBXShellScriptBuildPhase;
171
- buildActionMask = 2147483647;
172
- files = (
173
- );
174
- inputPaths = (
175
- "$(SRCROOT)/Info.plist",
176
- );
177
- name = plist;
178
- outputPaths = (
179
- "$(DERIVED_FILE_DIR)/Info.plist",
180
- );
181
- runOnlyForDeploymentPostprocessing = 0;
182
- shellPath = /bin/bash;
183
- 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";
184
- };
185
- /* End PBXShellScriptBuildPhase section */
186
-
187
- /* Begin PBXSourcesBuildPhase section */
188
- 6A57F6FB13F5E614000BE6A9 /* Sources */ = {
189
- isa = PBXSourcesBuildPhase;
190
- buildActionMask = 2147483647;
191
- files = (
192
- 6A57F70713F5E614000BE6A9 /* main.c in Sources */,
193
- 6A20BF7F13FC9BC000C6C442 /* cli.c in Sources */,
194
- 6A81FCEC14342A6300F83EDD /* TSICTString.c in Sources */,
195
- EDF2B90D143584E800C6EF62 /* compat.c in Sources */,
196
- );
197
- runOnlyForDeploymentPostprocessing = 0;
198
- };
199
- /* End PBXSourcesBuildPhase section */
200
-
201
- /* Begin XCBuildConfiguration section */
202
- 6A57F70A13F5E614000BE6A9 /* Debug */ = {
203
- isa = XCBuildConfiguration;
204
- baseConfigurationReference = 6A8F495514AC05470094EE00 /* Debug.xcconfig */;
205
- buildSettings = {
206
- };
207
- name = Debug;
208
- };
209
- 6A57F70B13F5E614000BE6A9 /* Release */ = {
210
- isa = XCBuildConfiguration;
211
- baseConfigurationReference = 6A8F495614AC05470094EE00 /* Release.xcconfig */;
212
- buildSettings = {
213
- };
214
- name = Release;
215
- };
216
- 6A57F70D13F5E614000BE6A9 /* Debug */ = {
217
- isa = XCBuildConfiguration;
218
- baseConfigurationReference = 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */;
219
- buildSettings = {
220
- };
221
- name = Debug;
222
- };
223
- 6A57F70E13F5E614000BE6A9 /* Release */ = {
224
- isa = XCBuildConfiguration;
225
- baseConfigurationReference = 6A8F495714AC05470094EE00 /* fsevent_watch.xcconfig */;
226
- buildSettings = {
227
- };
228
- name = Release;
229
- };
230
- /* End XCBuildConfiguration section */
231
-
232
- /* Begin XCConfigurationList section */
233
- 6A57F6F913F5E614000BE6A9 /* Build configuration list for PBXProject "fsevent_watch" */ = {
234
- isa = XCConfigurationList;
235
- buildConfigurations = (
236
- 6A57F70A13F5E614000BE6A9 /* Debug */,
237
- 6A57F70B13F5E614000BE6A9 /* Release */,
238
- );
239
- defaultConfigurationIsVisible = 0;
240
- defaultConfigurationName = Release;
241
- };
242
- 6A57F70C13F5E614000BE6A9 /* Build configuration list for PBXNativeTarget "fsevent_watch" */ = {
243
- isa = XCConfigurationList;
244
- buildConfigurations = (
245
- 6A57F70D13F5E614000BE6A9 /* Debug */,
246
- 6A57F70E13F5E614000BE6A9 /* Release */,
247
- );
248
- defaultConfigurationIsVisible = 0;
249
- defaultConfigurationName = Release;
250
- };
251
- /* End XCConfigurationList section */
252
- };
253
- rootObject = 6A57F6F613F5E614000BE6A9 /* Project object */;
254
- }
@@ -1,394 +0,0 @@
1
- //
2
- // TSICTString.c
3
- // TSITString
4
- //
5
- // Created by Travis Tilley on 9/27/11.
6
- //
7
-
8
- #include "TSICTString.h"
9
-
10
-
11
- const char* const TNetstringTypes = ",#^!~}]Z";
12
- const char* const OTNetstringTypes = ",#^!~{[Z";
13
- const UInt8 TNetstringSeparator = ':';
14
-
15
- TSITStringFormat TSITStringDefaultFormat = kTSITStringFormatTNetstring;
16
-
17
- static const CFRange BeginningRange = {0,0};
18
-
19
- static CFTypeID kCFDataTypeID = -1UL;
20
- static CFTypeID kCFStringTypeID = -1UL;
21
- static CFTypeID kCFNumberTypeID = -1UL;
22
- static CFTypeID kCFBooleanTypeID = -1UL;
23
- static CFTypeID kCFNullTypeID = -1UL;
24
- static CFTypeID kCFArrayTypeID = -1UL;
25
- static CFTypeID kCFDictionaryTypeID = -1UL;
26
-
27
-
28
- __attribute__((constructor)) void Init_TSICTString(void)
29
- {
30
- kCFDataTypeID = CFDataGetTypeID();
31
- kCFStringTypeID = CFStringGetTypeID();
32
- kCFNumberTypeID = CFNumberGetTypeID();
33
- kCFBooleanTypeID = CFBooleanGetTypeID();
34
- kCFNullTypeID = CFNullGetTypeID();
35
- kCFArrayTypeID = CFArrayGetTypeID();
36
- kCFDictionaryTypeID = CFDictionaryGetTypeID();
37
- }
38
-
39
-
40
- void TSICTStringSetDefaultFormat(TSITStringFormat format)
41
- {
42
- if (format == kTSITStringFormatDefault) {
43
- TSITStringDefaultFormat = kTSITStringFormatTNetstring;
44
- } else {
45
- TSITStringDefaultFormat = format;
46
- }
47
- }
48
-
49
- TSITStringFormat TSICTStringGetDefaultFormat(void)
50
- {
51
- return TSITStringDefaultFormat;
52
- }
53
-
54
-
55
- void TSICTStringDestroy(TStringIRep* rep)
56
- {
57
- CFRelease(rep->data);
58
- free(rep->length);
59
- free(rep);
60
- }
61
-
62
-
63
- static inline TStringIRep* TSICTStringCreateWithDataOfTypeAndFormat(CFDataRef data, TSITStringTag type, TSITStringFormat format)
64
- {
65
- if (format == kTSITStringFormatDefault) {
66
- format = TSICTStringGetDefaultFormat();
67
- }
68
-
69
- TStringIRep* rep = calloc(1, sizeof(TStringIRep));
70
- rep->data = CFDataCreateCopy(kCFAllocatorDefault, data);
71
- rep->type = type;
72
- rep->format = format;
73
- rep->length = calloc(10, sizeof(char));
74
-
75
- CFIndex len = CFDataGetLength(rep->data);
76
- if (snprintf(rep->length, 10, "%lu", len)) {
77
- return rep;
78
- } else {
79
- TSICTStringDestroy(rep);
80
- return NULL;
81
- }
82
- }
83
-
84
- static inline CFDataRef TSICTStringCreateDataFromIntermediateRepresentation(TStringIRep* rep)
85
- {
86
- CFIndex len = CFDataGetLength(rep->data);
87
- CFMutableDataRef buffer = CFDataCreateMutableCopy(kCFAllocatorDefault, (len + 12), rep->data);
88
- UInt8* bufferBytes = CFDataGetMutableBytePtr(buffer);
89
-
90
- size_t prefixLength = strlen(rep->length) + 1;
91
- CFDataReplaceBytes(buffer, BeginningRange, (const UInt8*)rep->length, (CFIndex)prefixLength);
92
-
93
- if (rep->format == kTSITStringFormatTNetstring) {
94
- const UInt8 ftag = (UInt8)TNetstringTypes[rep->type];
95
- CFDataAppendBytes(buffer, &ftag, 1);
96
- bufferBytes[(prefixLength - 1)] = TNetstringSeparator;
97
- } else if (rep->format == kTSITStringFormatOTNetstring) {
98
- const UInt8 ftag = (UInt8)OTNetstringTypes[rep->type];
99
- bufferBytes[(prefixLength - 1)] = ftag;
100
- }
101
-
102
- CFDataRef dataRep = CFDataCreateCopy(kCFAllocatorDefault, buffer);
103
- CFRelease(buffer);
104
-
105
- return dataRep;
106
- }
107
-
108
- static inline CFStringRef TSICTStringCreateStringFromIntermediateRepresentation(TStringIRep* rep)
109
- {
110
- CFDataRef data = TSICTStringCreateDataFromIntermediateRepresentation(rep);
111
- CFStringRef string = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, kCFStringEncodingUTF8);
112
- CFRelease(data);
113
- return string;
114
- }
115
-
116
- static inline CFDataRef TSICTStringCreateDataWithDataOfTypeAndFormat(CFDataRef data, TSITStringTag type, TSITStringFormat format)
117
- {
118
- CFRetain(data);
119
-
120
- if (format == kTSITStringFormatDefault) {
121
- format = TSICTStringGetDefaultFormat();
122
- }
123
-
124
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, type, format);
125
- if (rep == NULL) {
126
- return NULL;
127
- }
128
-
129
- CFDataRef result = TSICTStringCreateDataFromIntermediateRepresentation(rep);
130
-
131
- TSICTStringDestroy(rep);
132
- CFRelease(data);
133
-
134
- return result;
135
- }
136
-
137
- static inline void TSICTStringAppendObjectToMutableDataWithFormat(CFTypeRef object, CFMutableDataRef buffer, TSITStringFormat format)
138
- {
139
- if (object == NULL) {
140
- object = kCFNull;
141
- }
142
-
143
- CFRetain(object);
144
-
145
- TStringIRep* objRep = TSICTStringCreateWithObjectAndFormat(object, format);
146
- CFDataRef objData = TSICTStringCreateDataFromIntermediateRepresentation(objRep);
147
- CFDataAppendBytes(buffer, (CFDataGetBytePtr(objData)), CFDataGetLength(objData));
148
- CFRelease(objData);
149
- TSICTStringDestroy(objRep);
150
-
151
- CFRelease(object);
152
- }
153
-
154
- static void ArrayBufferAppendCallback(const void* item, void* context)
155
- {
156
- TStringCollectionCallbackContext* cx = (TStringCollectionCallbackContext*)context;
157
- CFMutableDataRef buffer = cx->buffer;
158
- TSITStringFormat format = cx->format;
159
-
160
- TSICTStringAppendObjectToMutableDataWithFormat(item, buffer, format);
161
- }
162
-
163
- static void DictionaryBufferAppendCallback(const void* key, const void* value, void* context)
164
- {
165
- TStringCollectionCallbackContext* cx = (TStringCollectionCallbackContext*)context;
166
- CFMutableDataRef buffer = cx->buffer;
167
- TSITStringFormat format = cx->format;
168
-
169
- TSICTStringAppendObjectToMutableDataWithFormat(key, buffer, format);
170
- TSICTStringAppendObjectToMutableDataWithFormat(value, buffer, format);
171
- }
172
-
173
-
174
- CFDataRef TSICTStringCreateRenderedData(TStringIRep* rep)
175
- {
176
- return TSICTStringCreateDataFromIntermediateRepresentation(rep);
177
- }
178
-
179
- CFDataRef TSICTStringCreateRenderedDataFromObjectWithFormat(CFTypeRef object, TSITStringFormat format)
180
- {
181
- if (object == NULL) {
182
- object = kCFNull;
183
- }
184
-
185
- CFRetain(object);
186
-
187
- TStringIRep* rep = TSICTStringCreateWithObjectAndFormat(object, format);
188
- CFDataRef data = TSICTStringCreateDataFromIntermediateRepresentation(rep);
189
-
190
- TSICTStringDestroy(rep);
191
- CFRelease(object);
192
-
193
- return data;
194
- }
195
-
196
- CFStringRef TSICTStringCreateRenderedString(TStringIRep* rep)
197
- {
198
- return TSICTStringCreateStringFromIntermediateRepresentation(rep);
199
- }
200
-
201
- CFStringRef TSICTStringCreateRenderedStringFromObjectWithFormat(CFTypeRef object, TSITStringFormat format)
202
- {
203
- if (object == NULL) {
204
- object = kCFNull;
205
- }
206
-
207
- CFRetain(object);
208
-
209
- TStringIRep* rep = TSICTStringCreateWithObjectAndFormat(object, format);
210
- CFStringRef string = TSICTStringCreateStringFromIntermediateRepresentation(rep);
211
-
212
- TSICTStringDestroy(rep);
213
- CFRelease(object);
214
-
215
- return string;
216
- }
217
-
218
-
219
- TStringIRep* TSICTStringCreateWithObjectAndFormat(CFTypeRef object, TSITStringFormat format)
220
- {
221
- if (object == NULL) {
222
- return TSICTStringCreateNullWithFormat(format);
223
- }
224
- CFRetain(object);
225
-
226
- CFTypeID cfType = CFGetTypeID(object);
227
- TStringIRep* rep = NULL;
228
-
229
- if (cfType == kCFDataTypeID) {
230
- rep = TSICTStringCreateWithDataOfTypeAndFormat(object, kTSITStringTagString, format);
231
- } else if (cfType == kCFStringTypeID) {
232
- rep = TSICTStringCreateWithStringAndFormat(object, format);
233
- } else if (cfType == kCFNumberTypeID) {
234
- rep = TSICTStringCreateWithNumberAndFormat(object, format);
235
- } else if (cfType == kCFBooleanTypeID) {
236
- if (CFBooleanGetValue(object)) {
237
- rep = TSICTStringCreateTrueWithFormat(format);
238
- } else {
239
- rep = TSICTStringCreateFalseWithFormat(format);
240
- }
241
- } else if (cfType == kCFNullTypeID) {
242
- rep = TSICTStringCreateNullWithFormat(format);
243
- } else if (cfType == kCFArrayTypeID) {
244
- rep = TSICTStringCreateWithArrayAndFormat(object, format);
245
- } else if (cfType == kCFDictionaryTypeID) {
246
- rep = TSICTStringCreateWithDictionaryAndFormat(object, format);
247
- } else {
248
- rep = TSICTStringCreateInvalidWithFormat(format);
249
- }
250
-
251
- CFRelease(object);
252
- return rep;
253
- }
254
-
255
- TStringIRep* TSICTStringCreateWithStringAndFormat(CFStringRef string, TSITStringFormat format)
256
- {
257
- CFRetain(string);
258
- CFDataRef data = CFStringCreateExternalRepresentation(kCFAllocatorDefault, string, kCFStringEncodingUTF8, '?');
259
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagString, format);
260
- CFRelease(data);
261
- CFRelease(string);
262
- return rep;
263
- }
264
-
265
- TStringIRep* TSICTStringCreateWithNumberAndFormat(CFNumberRef number, TSITStringFormat format)
266
- {
267
- CFRetain(number);
268
- TSITStringTag tag = kTSITStringTagNumber;
269
- CFDataRef data;
270
- CFNumberType numType = CFNumberGetType(number);
271
-
272
- switch(numType) {
273
- case kCFNumberCharType:
274
- {
275
- int value;
276
- if (CFNumberGetValue(number, kCFNumberIntType, &value)) {
277
- if (value == 0 || value == 1) {
278
- tag = kTSITStringTagBool;
279
- } else {
280
- tag = kTSITStringTagString;
281
- }
282
- }
283
- break;
284
- }
285
- case kCFNumberFloat32Type:
286
- case kCFNumberFloat64Type:
287
- case kCFNumberFloatType:
288
- case kCFNumberDoubleType:
289
- {
290
- tag = kTSITStringTagFloat;
291
- break;
292
- }
293
- }
294
-
295
- if (tag == kTSITStringTagBool) {
296
- bool value;
297
- CFNumberGetValue(number, kCFNumberIntType, &value);
298
- if (value) {
299
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"true", 4);
300
- } else {
301
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"false", 5);
302
- }
303
- } else if (tag == kTSITStringTagFloat) {
304
- char buf[32];
305
- char *p, *e;
306
- double value;
307
-
308
- CFNumberGetValue(number, numType, &value);
309
- sprintf(buf, "%#.15g", value);
310
-
311
- e = buf + strlen(buf);
312
- p = e;
313
- while (p[-1]=='0' && ('0' <= p[-2] && p[-2] <= '9')) {
314
- p--;
315
- }
316
- memmove(p, e, strlen(e)+1);
317
-
318
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
319
- } else {
320
- char buf[32];
321
- SInt64 value;
322
- CFNumberGetValue(number, numType, &value);
323
- sprintf(buf, "%lli", value);
324
- data = CFDataCreate(kCFAllocatorDefault, (UInt8*)buf, (CFIndex)strlen(buf));
325
- }
326
-
327
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, tag, format);
328
- CFRelease(data);
329
- CFRelease(number);
330
- return rep;
331
- }
332
-
333
- TStringIRep* TSICTStringCreateTrueWithFormat(TSITStringFormat format)
334
- {
335
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"true", 4);
336
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagBool, format);
337
- CFRelease(data);
338
- return rep;
339
- }
340
-
341
- TStringIRep* TSICTStringCreateFalseWithFormat(TSITStringFormat format)
342
- {
343
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, (UInt8*)"false", 5);
344
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagBool, format);
345
- CFRelease(data);
346
- return rep;
347
- }
348
-
349
- TStringIRep* TSICTStringCreateNullWithFormat(TSITStringFormat format)
350
- {
351
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, NULL, 0);
352
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagNull, format);
353
- CFRelease(data);
354
- return rep;
355
- }
356
-
357
- TStringIRep* TSICTStringCreateInvalidWithFormat(TSITStringFormat format)
358
- {
359
- CFDataRef data = CFDataCreate(kCFAllocatorDefault, NULL, 0);
360
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(data, kTSITStringTagInvalid, format);
361
- CFRelease(data);
362
- return rep;
363
- }
364
-
365
- TStringIRep* TSICTStringCreateWithArrayAndFormat(CFArrayRef array, TSITStringFormat format)
366
- {
367
- CFRetain(array);
368
-
369
- CFMutableDataRef buffer = CFDataCreateMutable(kCFAllocatorDefault, 0);
370
-
371
- CFRange all = CFRangeMake(0, CFArrayGetCount(array));
372
- TStringCollectionCallbackContext cx = {buffer, format};
373
- CFArrayApplyFunction(array, all, ArrayBufferAppendCallback, &cx);
374
-
375
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(buffer, kTSITStringTagList, format);
376
- CFRelease(buffer);
377
- CFRelease(array);
378
- return rep;
379
- }
380
-
381
- TStringIRep* TSICTStringCreateWithDictionaryAndFormat(CFDictionaryRef dictionary, TSITStringFormat format)
382
- {
383
- CFRetain(dictionary);
384
-
385
- CFMutableDataRef buffer = CFDataCreateMutable(kCFAllocatorDefault, 0);
386
-
387
- TStringCollectionCallbackContext cx = {buffer, format};
388
- CFDictionaryApplyFunction(dictionary, DictionaryBufferAppendCallback, &cx);
389
-
390
- TStringIRep* rep = TSICTStringCreateWithDataOfTypeAndFormat(buffer, kTSITStringTagDict, format);
391
- CFRelease(buffer);
392
- CFRelease(dictionary);
393
- return rep;
394
- }