Sha256: 57577d9f75450c43653aab293cd3846c74b99470724ed243e379912f41d10403
Contents?: true
Size: 1019 Bytes
Versions: 1
Compression:
Stored size: 1019 Bytes
Contents
require 'tempfile' Dir["#{File.dirname(__FILE__)}/generators/*.rb"].each { |c| require c } module Stastic module Generator extend self GENERATOR_TYPES = %w(jekyll staticmatic default) EXCLUDE_LIST = [ ".stastic", ".git", ".svn", ".DS_Store", "*.php", "*.rb", "*.haml", "*.sass", "*.pl", "*.py", "*.asp"] def detect GENERATOR_TYPES.each do |type| generator = eval("Stastic::Generator::#{type.capitalize}") return generator if(generator.send(:detect)) end end def package(dir) tmpfile = Tempfile.new('st-archive') system "cd \"#{dir}\" && tar -cjf \"#{tmpfile.path}\" -X #{exclude_file(dir)} . " tmpfile.path end private def exclude_file(dir) tmpfile = Tempfile.new('st-exclude') EXCLUDE_LIST.each do |pattern| tmpfile << "#{pattern}\n" end tmpfile.flush tmpfile.close tmpfile.path end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stastic-0.2.7 | lib/stastic/generator.rb |