Module: Stastic::Generator

Extended by:
Generator
Included in:
Generator
Defined in:
lib/stastic/generator.rb,
lib/stastic/generators/jekyll.rb,
lib/stastic/generators/default.rb,
lib/stastic/generators/staticmatic.rb

Defined Under Namespace

Modules: Default, Jekyll, Staticmatic

Constant Summary collapse

GENERATOR_TYPES =
%w(jekyll staticmatic default)
EXCLUDE_LIST =
[
".stastic",
".git",
".svn",
".DS_Store",
"*.php",
"*.rb",
"*.haml",
"*.sass",
"*.pl",
"*.py",
"*.asp"]

Instance Method Summary collapse

Instance Method Details

#detectObject



24
25
26
27
28
29
# File 'lib/stastic/generator.rb', line 24

def detect
  GENERATOR_TYPES.each do |type|
    generator = eval("Stastic::Generator::#{type.capitalize}")
    return generator if(generator.send(:detect))
  end
end

#package(dir) ⇒ Object



31
32
33
34
35
# File 'lib/stastic/generator.rb', line 31

def package(dir)
  tmpfile = Tempfile.new('st-archive')
  system "cd \"#{dir}\" && tar -cjf \"#{tmpfile.path}\" -X #{exclude_file(dir)} . "
  tmpfile.path
end