Sha256: 12439994ed296491db3f37c831172835d381cbd2a0c4eece5ddfef7e1749d620

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.dirname(__FILE__) + "/../lib"

require 'rubygems'
require 'commandline'
require 'watchful'

begin
	require 'growl' # OS X notifications
rescue LoadError
 	HAVE_GROWL = false
else
	if (Growl.installed? rescue false)		
		HAVE_GROWL = true
	else
		HAVE_GROWL = false
	end
end

class App < CommandLine::Application
	def initialize
		version Watchful::version
		author 'KEM'
		copyright '2010, Kyle Mitchell'
		short_description 'runs tools on updated files'
		long_description <<-eos
			A configurable deamon for running source code translation and minification tools–
			such as CSS and Javascript minification tools and generators—on updated files.
		eos
		synopsis "[-dhv] path"
		option :help
		option :debug
		option :version
		option :names => %w{--use-default-configuration --default},
			:opt_found => get_args,
			:opt_description => 'Use the default configuration even if a local or user-level configuration is found.'
		expected_args :path
	end
	def main
		Watchful::Configuration.active_configuration = Watchful::DefaultConfiguration
		# todo: check dependencies of actions of active configuration
		
		path = File.expand_path(args[0])
		fail "No such directory: #{path} " unless File.directory? path
		
		Watchful::load_configuration(path, opt['--use-default-configuration'])
		
		# show the active config
		debug "Config: " + Watchful::Configuration.active_configuration._description
		
		# list active actions
		Watchful::Configuration.active_configuration.actions.each do |a|
			debug "Action: \t#{a.name} (#{a.in} -> #{a.out})"
		end
		
		puts "Watching #{Dir.pwd}..."
		Watchful::watch_files(path)
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watchful-0.0.0.pre1 bin/watchful