Sha256: d8186e2098a726f6f30f6e40533e6b001c6a06dee6e26370bc9932036acb2224
Contents?: true
Size: 1.37 KB
Versions: 4
Compression:
Stored size: 1.37 KB
Contents
#!/usr/bin/ruby require "pathname" require "rubygems" require "thor" require "fssm" require 'chance' class ChanceRunner < Thor #tasks namespace :chance desc "watch [folder]", "Watches the folder for changes." method_option :verbose, :type => :boolean, :default => false def watch(folder) Chance::CONFIG[:verbose] = options["verbose"] folder = Pathname.new(folder).expand_path chance = Chance::Instance.new Dir.glob(File.expand_path(File.join(folder, "**/*"))) do |f| if not File.directory?(f) Chance.add_file f chance.map_file(Pathname.new(f).relative_path_from(folder), f) chance.update puts chance.css end end FSSM.monitor(folder, "**/*") do update {|base, relative| path = File.join(base, relative) Chance.update_file path chance.update puts chance.css } delete {|base, relative| path = File.join(base, relative) chance.unmap_file Pathname.new(path).relative_path_from(folder) Chance.remove_file path chance.update puts chance.css } create {|base, relative| path = File.join(base, relative) Chance.add_file path chance.map_file Pathname.new(path).relative_path_from(folder), path chance.update puts chance.css } end end end ChanceRunner.start
Version data entries
4 entries across 4 versions & 1 rubygems