Sha256: eace1c09f03e030144e284dc56e7a0760a189b6fe2f9b48daed4d2815ccfea23

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'frozen'
require 'colorize'
require 'filewatcher'

puts "\nFrozen #{Frozen::VERSION}\n\n"

def show_help
  puts "frozen <command>"
  exit
end




show_help unless ARGV.count > 0

command = ARGV.shift

if command == "build"
  site = Frozen::Site::LocalSite.new(File.expand_path("."))
  puts "Building site".yellow
  puts "Building to #{site.site_build_path}\n\n"
  site.build
  exit
end

if command == "watch"
  site = Frozen::Site::LocalSite.new(File.expand_path("."))


  watch_folders = ["layouts/**/*.slim",
                   "views/**/*.slim",
                   "assets/stylesheets/**/*.scss",
                   "assets/javascripts/**/*.js",
                   "assets/javascripts/**/*.coffee"]

  puts "Building to #{site.site_build_path}\n\n"
  puts "Watching for changes....".yellow
  FileWatcher.new(watch_folders).watch do |filename|
    puts "-=[ #{filename} - #{Time.now.strftime('%l:%m')} ]=-"
    full_filename = File.join(site.site_root_path,filename)
    site.build_view(full_filename) if site.file_is_view?(filename)
    site.build_stylesheet(full_filename) if site.file_is_stylesheet?(filename)
    site.build_javascript(full_filename) if site.file_is_javascript?(filename)
    site.build_views if site.file_is_layout?(filename)
  end
end

if command == "server"
  require 'rack'
  site = Frozen::Site::LocalSite.new(File.expand_path("."))
  Rack::Handler::WEBrick.run(Frozen::Rack::RequestController.new(site), :Port => 9292)
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frozen-0.0.1 bin/frozen