Sha256: 26c0f35c560aa6bb3808d111ba8d154d56d03c376d37c3509feebbf90d93cacf
Contents?: true
Size: 1011 Bytes
Versions: 6
Compression:
Stored size: 1011 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
6 entries across 6 versions & 1 rubygems