moft 1.0.2.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,23 @@
1
1
  module Moft
2
2
  class Command
3
- def self.globs(source, destination)
3
+ def self.globs(source, destination, static_includes)
4
+ dirs = []
4
5
  Dir.chdir(source) do
5
6
  dirs = Dir['*'].select { |x| File.directory?(x) }
6
7
  dirs -= [destination, File.expand_path(destination), File.basename(destination)]
7
8
  dirs = dirs.map { |x| "#{x}/**/*" }
8
9
  dirs += ['*']
9
10
  end
11
+
12
+ static_includes.each do |dir|
13
+ if File.directory?(dir)
14
+ dir.gsub("\\","/")
15
+ dirs += ["%s/**/*" % [dir]]
16
+ end
17
+
18
+ return dirs
19
+ end
20
+
10
21
  end
11
22
 
12
23
  # Static: Run Site#process and catch errors
@@ -32,13 +32,19 @@ module Moft
32
32
  # Returns nothing.
33
33
  def self.watch(site, options)
34
34
  require 'directory_watcher'
35
-
35
+
36
36
  source = options['source']
37
37
  destination = options['destination']
38
38
 
39
39
  Moft::Logger.info "Auto-regeneration:", "enabled"
40
40
 
41
- dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true)
41
+ watchdirs = self.globs(source, destination, options['static_includes'])
42
+
43
+ watchdirs.each do |dir|
44
+ Moft::Logger.info "Watching:", "%s" % dir
45
+ end
46
+
47
+ dw = DirectoryWatcher.new(source, :glob => watchdirs, :pre_load => true)
42
48
  dw.interval = 1
43
49
 
44
50
  dw.add_observer do |*args|
@@ -27,6 +27,7 @@ module Moft
27
27
  #
28
28
  # Returns nothing.
29
29
  def read_yaml(base, name)
30
+
30
31
  begin
31
32
  self.content = File.read(File.join(base, name))
32
33
 
@@ -39,7 +40,6 @@ module Moft
39
40
  rescue Exception => e
40
41
  puts "Error reading file #{File.join(base, name)}: #{e.message}"
41
42
  end
42
-
43
43
  self.data ||= {}
44
44
  end
45
45
 
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'moft'
7
- s.version = '1.0.2.1'
7
+ s.version = '1.0.3'
8
8
  s.license = 'MIT'
9
9
  s.date = '2013-05-08'
10
10
  s.rubyforge_project = 'moft'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2.1
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: