middleman-core 3.0.0.alpha.9 → 3.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gemtest +0 -0
  2. data/Rakefile +45 -1
  3. data/bin/fsevent_watch_guard +0 -0
  4. data/bin/middleman +1 -1
  5. data/ext/extconf.rb +61 -0
  6. data/{lib/middleman-core/vendor/rb-fsevent-0.4.3.1/ext → ext}/fsevent/fsevent_watch.c +0 -0
  7. data/features/cli.feature +2 -3
  8. data/lib/middleman-core/base.rb +2 -2
  9. data/lib/middleman-core/cli/build.rb +1 -1
  10. data/lib/middleman-core/cli/server.rb +15 -10
  11. data/lib/middleman-core/core_extensions/data.rb +32 -50
  12. data/lib/middleman-core/core_extensions/file_watcher.rb +81 -34
  13. data/lib/middleman-core/core_extensions/front_matter.rb +4 -4
  14. data/lib/middleman-core/core_extensions/rendering.rb +3 -3
  15. data/lib/middleman-core/core_extensions/sitemap.rb +4 -4
  16. data/lib/middleman-core/sitemap/template.rb +1 -1
  17. data/lib/middleman-core/step_definitions/middleman_steps.rb +2 -2
  18. data/lib/middleman-core/templates/default/source/layouts/layout.erb +1 -1
  19. data/lib/middleman-core/templates/default/source/stylesheets/all.css +55 -0
  20. data/lib/middleman-core/templates/default/source/stylesheets/{_normalize.scss → normalize.css} +0 -0
  21. data/lib/middleman-core/templates/default.rb +2 -3
  22. data/lib/middleman-core/vendor/darwin/.gitignore +18 -0
  23. data/lib/middleman-core/vendor/darwin/Gemfile +6 -0
  24. data/lib/middleman-core/vendor/darwin/Guardfile +8 -0
  25. data/lib/middleman-core/vendor/{rb-fsevent-0.4.3.1 → darwin}/LICENSE +0 -0
  26. data/lib/middleman-core/vendor/{rb-fsevent-0.4.3.1 → darwin}/README.rdoc +0 -0
  27. data/lib/middleman-core/vendor/darwin/Rakefile +21 -0
  28. data/lib/middleman-core/vendor/{rb-fsevent-0.4.3.1 → darwin}/ext/extconf.rb +0 -0
  29. data/lib/middleman-core/vendor/darwin/ext/fsevent/fsevent_watch.c +226 -0
  30. data/lib/middleman-core/vendor/{rb-fsevent-0.4.3.1 → darwin}/lib/rb-fsevent/fsevent.rb +2 -2
  31. data/lib/middleman-core/vendor/{rb-fsevent-0.4.3.1 → darwin}/lib/rb-fsevent/version.rb +0 -0
  32. data/lib/middleman-core/vendor/{rb-fsevent-0.4.3.1 → darwin}/lib/rb-fsevent.rb +0 -0
  33. data/lib/middleman-core/vendor/darwin/rb-fsevent.gemspec +24 -0
  34. data/lib/middleman-core/vendor/darwin/spec/fixtures/custom 'path/.gitignore +0 -0
  35. data/lib/middleman-core/vendor/darwin/spec/fixtures/folder1/file1.txt +0 -0
  36. data/lib/middleman-core/vendor/darwin/spec/fixtures/folder1/folder2/file2.txt +0 -0
  37. data/lib/middleman-core/vendor/darwin/spec/rb-fsevent/fsevent_spec.rb +75 -0
  38. data/lib/middleman-core/vendor/darwin/spec/spec_helper.rb +24 -0
  39. data/lib/middleman-core/vendor/linux/.gitignore +3 -0
  40. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/.yardopts +0 -0
  41. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/MIT-LICENSE +0 -0
  42. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/README.md +0 -0
  43. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/Rakefile +0 -0
  44. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/VERSION +0 -0
  45. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/lib/rb-inotify/event.rb +0 -0
  46. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/lib/rb-inotify/native/flags.rb +0 -0
  47. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/lib/rb-inotify/native.rb +0 -0
  48. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/lib/rb-inotify/notifier.rb +0 -0
  49. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/lib/rb-inotify/watcher.rb +0 -0
  50. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/lib/rb-inotify.rb +0 -0
  51. data/lib/middleman-core/vendor/{rb-inotify-0.8.8 → linux}/rb-inotify.gemspec +0 -0
  52. data/lib/middleman-core/version.rb +1 -1
  53. data/lib/middleman-core/watcher.rb +19 -14
  54. data/middleman-core.gemspec +4 -4
  55. metadata +40 -26
  56. data/lib/middleman-core/templates/default/source/stylesheets/_animate.scss +0 -23
  57. data/lib/middleman-core/templates/default/source/stylesheets/all.css.scss +0 -40
@@ -0,0 +1,18 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ Gemfile.lock
5
+
6
+ ## MAC OS
7
+ .DS_Store
8
+ .Trashes
9
+ .com.apple.timemachine.supported
10
+ .fseventsd
11
+ Desktop DB
12
+ Desktop DF
13
+ /bin/fsevent_watch
14
+ /ext/Makefile
15
+
16
+ ## editor/IDE
17
+ .idea
18
+
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake"
6
+
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at http://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r(^spec/(.*)_spec.rb))
6
+ watch(%r(^lib/(.*)\.rb)) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,226 @@
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+ #include <unistd.h>
4
+
5
+ #include <CoreServices/CoreServices.h>
6
+
7
+
8
+ // Structure for storing metadata parsed from the commandline
9
+ static struct {
10
+ FSEventStreamEventId sinceWhen;
11
+ CFTimeInterval latency;
12
+ FSEventStreamCreateFlags flags;
13
+ CFMutableArrayRef paths;
14
+ } config = {
15
+ (UInt64) kFSEventStreamEventIdSinceNow,
16
+ (double) 0.3,
17
+ (UInt32) kFSEventStreamCreateFlagNone,
18
+ NULL
19
+ };
20
+
21
+ // Prototypes
22
+ static void append_path(const char *path);
23
+ static inline void parse_cli_settings(int argc, const char *argv[]);
24
+ static void callback(FSEventStreamRef streamRef,
25
+ void *clientCallBackInfo,
26
+ size_t numEvents,
27
+ void *eventPaths,
28
+ const FSEventStreamEventFlags eventFlags[],
29
+ const FSEventStreamEventId eventIds[]);
30
+
31
+
32
+ // Resolve a path and append it to the CLI settings structure
33
+ // The FSEvents API will, internally, resolve paths using a similar scheme.
34
+ // Performing this ahead of time makes things less confusing, IMHO.
35
+ static void append_path(const char *path)
36
+ {
37
+ #ifdef DEBUG
38
+ fprintf(stderr, "\n");
39
+ fprintf(stderr, "append_path called for: %s\n", path);
40
+ #endif
41
+
42
+ char fullPath[PATH_MAX];
43
+
44
+ if (realpath(path, fullPath) == NULL) {
45
+ #ifdef DEBUG
46
+ fprintf(stderr, " realpath not directly resolvable from path\n");
47
+ #endif
48
+
49
+ if (path[0] != '/') {
50
+ #ifdef DEBUG
51
+ fprintf(stderr, " passed path is not absolute\n");
52
+ #endif
53
+ size_t len;
54
+ getcwd(fullPath, sizeof(fullPath));
55
+ #ifdef DEBUG
56
+ fprintf(stderr, " result of getcwd: %s\n", fullPath);
57
+ #endif
58
+ len = strlen(fullPath);
59
+ fullPath[len] = '/';
60
+ strlcpy(&fullPath[len + 1], path, sizeof(fullPath) - (len + 1));
61
+ } else {
62
+ #ifdef DEBUG
63
+ fprintf(stderr, " assuming path does not YET exist\n");
64
+ #endif
65
+ strlcpy(fullPath, path, sizeof(fullPath));
66
+ }
67
+ }
68
+
69
+ #ifdef DEBUG
70
+ fprintf(stderr, " resolved path to: %s\n", fullPath);
71
+ fprintf(stderr, "\n");
72
+ fflush(stderr);
73
+ #endif
74
+
75
+ CFStringRef pathRef = CFStringCreateWithCString(kCFAllocatorDefault,
76
+ fullPath,
77
+ kCFStringEncodingUTF8);
78
+ CFArrayAppendValue(config.paths, pathRef);
79
+ CFRelease(pathRef);
80
+ }
81
+
82
+ // Parse commandline settings
83
+ static inline void parse_cli_settings(int argc, const char *argv[])
84
+ {
85
+ config.paths = CFArrayCreateMutable(NULL,
86
+ (CFIndex)0,
87
+ &kCFTypeArrayCallBacks);
88
+
89
+ for (int i = 1; i < argc; i++) {
90
+ if (strcmp(argv[i], "--since-when") == 0) {
91
+ config.sinceWhen = strtoull(argv[++i], NULL, 0);
92
+ } else if (strcmp(argv[i], "--latency") == 0) {
93
+ config.latency = strtod(argv[++i], NULL);
94
+ } else if (strcmp(argv[i], "--no-defer") == 0) {
95
+ config.flags |= kFSEventStreamCreateFlagNoDefer;
96
+ } else if (strcmp(argv[i], "--watch-root") == 0) {
97
+ config.flags |= kFSEventStreamCreateFlagWatchRoot;
98
+ } else if (strcmp(argv[i], "--ignore-self") == 0) {
99
+ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
100
+ config.flags |= kFSEventStreamCreateFlagIgnoreSelf;
101
+ #else
102
+ fprintf(stderr, "MacOSX10.6.sdk is required for --ignore-self\n");
103
+ #endif
104
+ } else {
105
+ append_path(argv[i]);
106
+ }
107
+ }
108
+
109
+ if (CFArrayGetCount(config.paths) == 0) {
110
+ append_path(".");
111
+ }
112
+
113
+ #ifdef DEBUG
114
+ fprintf(stderr, "config.sinceWhen %llu\n", config.sinceWhen);
115
+ fprintf(stderr, "config.latency %f\n", config.latency);
116
+ fprintf(stderr, "config.flags %#.8x\n", config.flags);
117
+ fprintf(stderr, "config.paths\n");
118
+
119
+ long numpaths = CFArrayGetCount(config.paths);
120
+
121
+ for (long i = 0; i < numpaths; i++) {
122
+ char path[PATH_MAX];
123
+ CFStringGetCString(CFArrayGetValueAtIndex(config.paths, i),
124
+ path,
125
+ PATH_MAX,
126
+ kCFStringEncodingUTF8);
127
+ fprintf(stderr, " %s\n", path);
128
+ }
129
+
130
+ fprintf(stderr, "\n");
131
+ fflush(stderr);
132
+ #endif
133
+ }
134
+
135
+ static void callback(FSEventStreamRef streamRef,
136
+ void *clientCallBackInfo,
137
+ size_t numEvents,
138
+ void *eventPaths,
139
+ const FSEventStreamEventFlags eventFlags[],
140
+ const FSEventStreamEventId eventIds[])
141
+ {
142
+ char **paths = eventPaths;
143
+
144
+ #ifdef DEBUG
145
+ fprintf(stderr, "\n");
146
+ fprintf(stderr, "FSEventStreamCallback fired!\n");
147
+ fprintf(stderr, " numEvents: %lu\n", numEvents);
148
+
149
+ for (size_t i = 0; i < numEvents; i++) {
150
+ fprintf(stderr, " event path: %s\n", paths[i]);
151
+ fprintf(stderr, " event flags: %#.8x\n", eventFlags[i]);
152
+ fprintf(stderr, " event ID: %llu\n", eventIds[i]);
153
+ }
154
+
155
+ fprintf(stderr, "\n");
156
+ fflush(stderr);
157
+ #endif
158
+
159
+ for (size_t i = 0; i < numEvents; i++) {
160
+ fprintf(stdout, "%s", paths[i]);
161
+ fprintf(stdout, ":");
162
+ }
163
+
164
+ fprintf(stdout, "\n");
165
+ fflush(stdout);
166
+ }
167
+
168
+ int main(int argc, const char *argv[])
169
+ {
170
+ /*
171
+ * a subprocess will initially inherit the process group of its parent. the
172
+ * process group may have a control terminal associated with it, which would
173
+ * be the first tty device opened by the group leader. typically the group
174
+ * leader is your shell and the control terminal is your login device. a
175
+ * subset of signals triggered on the control terminal are sent to all members
176
+ * of the process group, in large part to facilitate sane and consistent
177
+ * cleanup (ex: control terminal was closed).
178
+ *
179
+ * so why the overly descriptive lecture style comment?
180
+ * 1. SIGINT and SIGQUIT are among the signals with this behavior
181
+ * 2. a number of applications gank the above for their own use
182
+ * 3. ruby's insanely useful "guard" is one of these applications
183
+ * 4. despite having some level of understanding of POSIX signals and a few
184
+ * of the scenarios that might cause problems, i learned this one only
185
+ * after reading ruby 1.9's process.c
186
+ * 5. if left completely undocumented, even slightly obscure bugfixes
187
+ * may be removed as cruft by a future maintainer
188
+ *
189
+ * hindsight is 20/20 addition: if you're single-threaded and blocking on IO
190
+ * with a subprocess, then handlers for deferrable signals might not get run
191
+ * when you expect them to. In the case of Ruby 1.8, that means making use of
192
+ * IO::select, which will preserve correct signal handling behavior.
193
+ */
194
+ if (setpgid(0,0) < 0) {
195
+ fprintf(stderr, "Unable to set new process group.\n");
196
+ return 1;
197
+ }
198
+
199
+ parse_cli_settings(argc, argv);
200
+
201
+ FSEventStreamContext context = {0, NULL, NULL, NULL, NULL};
202
+ FSEventStreamRef stream;
203
+ stream = FSEventStreamCreate(kCFAllocatorDefault,
204
+ (FSEventStreamCallback)&callback,
205
+ &context,
206
+ config.paths,
207
+ config.sinceWhen,
208
+ config.latency,
209
+ config.flags);
210
+
211
+ #ifdef DEBUG
212
+ FSEventStreamShow(stream);
213
+ fprintf(stderr, "\n");
214
+ fflush(stderr);
215
+ #endif
216
+
217
+ FSEventStreamScheduleWithRunLoop(stream,
218
+ CFRunLoopGetCurrent(),
219
+ kCFRunLoopDefaultMode);
220
+ FSEventStreamStart(stream);
221
+ CFRunLoopRun();
222
+ FSEventStreamFlushSync(stream);
223
+ FSEventStreamStop(stream);
224
+
225
+ return 0;
226
+ }
@@ -2,12 +2,12 @@ class FSEvent
2
2
  class << self
3
3
  class_eval <<-END
4
4
  def root_path
5
- "#{File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))}"
5
+ "#{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', '..'))}"
6
6
  end
7
7
  END
8
8
  class_eval <<-END
9
9
  def watcher_path
10
- "#{File.join(FSEvent.root_path, 'bin', 'fsevent_watch')}"
10
+ "#{File.join(FSEvent.root_path, 'bin', 'fsevent_watch_guard')}"
11
11
  end
12
12
  END
13
13
  end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rb-fsevent/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rb-fsevent"
7
+ s.version = FSEvent::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Thibaud Guillaume-Gentil', 'Travis Tilley']
10
+ s.email = ['thibaud@thibaud.me', 'ttilley@gmail.com']
11
+ s.homepage = "http://rubygems.org/gems/rb-fsevent"
12
+ s.summary = "Very simple & usable FSEvents API"
13
+ s.description = "FSEvents API with Signals catching (without RubyCocoa)"
14
+
15
+ s.rubyforge_project = "rb-fsevent"
16
+
17
+ s.add_development_dependency 'bundler', '~> 1.0.10'
18
+ s.add_development_dependency 'rspec', '~> 2.5.0'
19
+ s.add_development_dependency 'guard-rspec', '~> 0.1.9'
20
+
21
+ s.files = Dir.glob('{lib,ext}/**/*') + %w[LICENSE README.rdoc]
22
+ s.extensions = ['ext/extconf.rb']
23
+ s.require_path = 'lib'
24
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ describe FSEvent do
4
+
5
+ before(:each) do
6
+ @results = []
7
+ @fsevent = FSEvent.new
8
+ @fsevent.watch @fixture_path.to_s, {:latency => 0.5} do |paths|
9
+ @results += paths
10
+ end
11
+ end
12
+
13
+ it "should have a watcher_path that resolves to an executable file" do
14
+ File.exists?(FSEvent.watcher_path).should be_true
15
+ File.executable?(FSEvent.watcher_path).should be_true
16
+ end
17
+
18
+ it "should work with path with an apostrophe" do
19
+ custom_path = @fixture_path.join("custom 'path")
20
+ file = custom_path.join("newfile.rb").to_s
21
+ File.delete file if File.exists? file
22
+ @fsevent.watch custom_path.to_s do |paths|
23
+ @results += paths
24
+ end
25
+ @fsevent.paths.should == ["#{custom_path}"]
26
+ run
27
+ FileUtils.touch file
28
+ stop
29
+ File.delete file
30
+ @results.should == [custom_path.to_s + '/']
31
+ end
32
+
33
+ it "should catch new file" do
34
+ file = @fixture_path.join("newfile.rb")
35
+ File.delete file if File.exists? file
36
+ run
37
+ FileUtils.touch file
38
+ stop
39
+ File.delete file
40
+ @results.should == [@fixture_path.to_s + '/']
41
+ end
42
+
43
+ it "should catch file update" do
44
+ file = @fixture_path.join("folder1/file1.txt")
45
+ File.exists?(file).should be_true
46
+ run
47
+ FileUtils.touch file
48
+ stop
49
+ @results.should == [@fixture_path.join("folder1/").to_s]
50
+ end
51
+
52
+ it "should catch files update" do
53
+ file1 = @fixture_path.join("folder1/file1.txt")
54
+ file2 = @fixture_path.join("folder1/folder2/file2.txt")
55
+ File.exists?(file1).should be_true
56
+ File.exists?(file2).should be_true
57
+ run
58
+ FileUtils.touch file1
59
+ FileUtils.touch file2
60
+ stop
61
+ @results.should == [@fixture_path.join("folder1/").to_s, @fixture_path.join("folder1/folder2/").to_s]
62
+ end
63
+
64
+ def run
65
+ sleep 1
66
+ Thread.new { @fsevent.run }
67
+ sleep 1
68
+ end
69
+
70
+ def stop
71
+ sleep 1
72
+ @fsevent.stop
73
+ end
74
+
75
+ end
@@ -0,0 +1,24 @@
1
+ require 'rspec'
2
+ require 'rb-fsevent'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.filter_run :focus => true
7
+ config.run_all_when_everything_filtered = true
8
+
9
+ config.before(:each) do
10
+ @fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
11
+ end
12
+
13
+ config.before(:all) do
14
+ system "cd ext; ruby extconf.rb"
15
+ puts "fsevent_watch compiled"
16
+ end
17
+
18
+ config.after(:all) do
19
+ gem_root = Pathname.new(File.expand_path('../../', __FILE__))
20
+ system "rm -rf #{gem_root.join('bin')}"
21
+ system "rm #{gem_root.join('ext/Makefile')}"
22
+ end
23
+
24
+ end
@@ -0,0 +1,3 @@
1
+ /.yardoc
2
+ /doc
3
+ /pkg
@@ -4,7 +4,7 @@ require "rubygems"
4
4
  module Middleman
5
5
  # Current Version
6
6
  # @return [String]
7
- VERSION = '3.0.0.alpha.9' unless const_defined?(:VERSION)
7
+ VERSION = '3.0.0.beta.1' unless const_defined?(:VERSION)
8
8
 
9
9
  # Parsed version for RubyGems
10
10
  # @private
@@ -1,9 +1,6 @@
1
1
  # Inspect Ruby env
2
2
  require "rbconfig"
3
3
 
4
- # Watcher Library
5
- require "fssm"
6
-
7
4
  # File changes are forwarded to the currently running app via HTTP
8
5
  require "net/http"
9
6
 
@@ -14,7 +11,7 @@ module Middleman
14
11
 
15
12
  def start(options)
16
13
  self.singleton = new(options)
17
- self.singleton.watch!
14
+ self.singleton.watch! unless options[:"disable-watcher"]
18
15
  end
19
16
 
20
17
  # What command is sent to kill instances
@@ -36,11 +33,9 @@ module Middleman
36
33
  @options = options
37
34
 
38
35
  if RbConfig::CONFIG['target_os'] =~ /darwin/i
39
- $LOAD_PATH << File.expand_path('../../middleman-core/vendor/rb-fsevent-0.4.3.1/lib', __FILE__)
40
- require 'rb-fsevent'
36
+ $LOAD_PATH << File.expand_path('../../middleman-core/vendor/darwin/lib', __FILE__)
41
37
  elsif RbConfig::CONFIG['target_os'] =~ /linux/i
42
- $LOAD_PATH << File.expand_path('../../middleman-core/vendor/rb-inotify-0.8.8/lib', __FILE__)
43
- require 'rb-inotify'
38
+ $LOAD_PATH << File.expand_path('../../middleman-core/vendor/linux/lib', __FILE__)
44
39
  end
45
40
 
46
41
  start
@@ -48,6 +43,10 @@ module Middleman
48
43
 
49
44
  def watch!
50
45
  local = self
46
+
47
+ # Watcher Library
48
+ require "fssm"
49
+
51
50
  FSSM.monitor(Dir.pwd) do
52
51
  create { |base, relative| local.run_on_change([relative]) }
53
52
  update { |base, relative| local.run_on_change([relative]) }
@@ -58,10 +57,14 @@ module Middleman
58
57
  # Start Middleman in a fork
59
58
  # @return [void]
60
59
  def start
61
- @server_job = fork {
62
- Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }
60
+ if @options[:"disable-watcher"]
63
61
  bootup
64
- }
62
+ else
63
+ @server_job = fork {
64
+ Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }
65
+ bootup
66
+ }
67
+ end
65
68
  end
66
69
 
67
70
  # Start an instance of Middleman::Base
@@ -87,9 +90,11 @@ module Middleman
87
90
  # @return [void]
88
91
  def stop
89
92
  puts "== The Middleman is shutting down"
90
- Process.kill(::Middleman::WINDOWS ? :KILL : :TERM, @server_job)
91
- Process.wait @server_job
92
- @server_job = nil
93
+ if !@options[:"disable-watcher"]
94
+ Process.kill(::Middleman::WINDOWS ? :KILL : :TERM, @server_job)
95
+ Process.wait @server_job
96
+ @server_job = nil
97
+ end
93
98
  end
94
99
 
95
100
  # Simply stop, then start
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
13
13
  s.summary = "Hand-crafted frontend development"
14
14
  s.description = "A static site generator based on Sinatra. Providing dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle."
15
15
 
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
16
+ s.files = `git ls-files`.split("\n") + %w(bin/fsevent_watch_guard)
17
+ s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n")
18
+ s.executable = "middleman"
19
+ s.require_path = "lib"
20
20
 
21
21
  # Thin
22
22
  # s.add_dependency("thin", ["~> 1.3.1"])