Class: Moft::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/moft/command.rb

Class Method Summary collapse

Class Method Details

.globs(source, destination, static_includes) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/moft/command.rb', line 3

def self.globs(source, destination, static_includes)
  dirs = []
  Dir.chdir(source) do
    dirs = Dir['*'].select { |x| File.directory?(x) }
    dirs -= [destination, File.expand_path(destination), File.basename(destination)]
    dirs = dirs.map { |x| "#{x}/**/*" }
    dirs += ['*']
  end
  
  static_includes.each do |dir|
    if File.directory?(dir)
      dir.gsub("\\","/")
      dirs += ["%s/**/*" % [dir]]
    end
  end
  return dirs
  
end

.process_site(site) ⇒ Object

Static: Run Site#process and catch errors

site - the Moft::Site object

Returns nothing



27
28
29
30
31
32
33
34
35
# File 'lib/moft/command.rb', line 27

def self.process_site(site)
  site.process
rescue Moft::FatalException => e
  puts
  Moft::Logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
  Moft::Logger.error "", "------------------------------------"
  Moft::Logger.error "", e.message
  exit(1)
end