Sha256: f2a27711a71b43a89410188d833abb5798803b2d1cc686b9810db1316bbbd47d
Contents?: true
Size: 961 Bytes
Versions: 1
Compression:
Stored size: 961 Bytes
Contents
require 'fileutils' require 'pyro/assets' module Pyro include Pyro::Assets def self.build(target = 'production', fast = false, working_dir = '.') @timestamp = Time.now.strftime("%Y%m%d%H%M%S") @working_dir = working_dir unless File.exists? "#{@working_dir}/lib/index.erb" raise 'Can\'t find an index.erb file to build.' end if target == 'development' @build_dir = "#{@working_dir}/builds/development" else @build_dir = "#{@working_dir}/builds/production/#{@timestamp}" end FileUtils.mkdir_p(@build_dir) unless fast FileUtils.cp_r("#{@working_dir}/assets/.", @build_dir) FileUtils.cp_r("#{@working_dir}/vendor", @build_dir) end File.open("#{@build_dir}/index.html", 'w+') do |index| index.write( ERB.new(File.read "#{@working_dir}/lib/index.erb").result(binding) ) end if target == 'production' compress(@build_dir) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pyro-0.8.2 | lib/pyro.rb |