moft 1.0.2.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/moft/command.rb +12 -1
- data/lib/moft/commands/build.rb +8 -2
- data/lib/moft/convertible.rb +1 -1
- data/moft.gemspec +1 -1
- metadata +1 -1
data/lib/moft/command.rb
CHANGED
@@ -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
|
data/lib/moft/commands/build.rb
CHANGED
@@ -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
|
-
|
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|
|
data/lib/moft/convertible.rb
CHANGED
@@ -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
|
|
data/moft.gemspec
CHANGED