Sha256: ff0105513b912a5b34bc255b8dee6b0be3633579efbfa5aa6a52b94bb3184e42
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
require 'guard' require 'guard/guard' module Marv module Guard class << self attr_accessor :project, :task, :builder end def self.add_guard(&block) @additional_guards ||= [] @additional_guards << block end def self.start(project, task, options={}, livereload={}) @project = project @task = task @builder = Builder.new(project) options_hash = "" options.each do |k,v| options_hash << ", :#{k} => '#{v}'" end assets_path = @project.assets_path.gsub(/#{@project.root}\//, '') source_path = @project.source_path.gsub(/#{@project.root}\//, '') config_file = @project.config_file.gsub(/#{@project.root}\//, '') guardfile_contents = %Q{ guard 'marvconfig'#{options_hash} do watch("#{config_file}") end guard 'marvassets' do watch(%r{#{assets_path}/javascripts/*}) watch(%r{#{assets_path}/stylesheets/*}) watch(%r{#{assets_path}/images/*}) end guard 'marvtemplates' do watch(%r{#{source_path}/templates/*}) watch(%r{#{source_path}/partials/*}) end guard 'marvfunctions' do watch(%r{#{source_path}/functions/*}) watch(%r{#{source_path}/includes/*}) end guard 'marvfolders' do watch(%r{#{source_path}/*}) end } if @project.config[:livereload] guardfile_contents << %Q{ guard 'livereload' do watch(%r{#{source_path}/*}) end } end (@additional_guards || []).each do |block| result = block.call(options, livereload) guardfile_contents << result unless result.nil? end ::Guard.start({ :guardfile_contents => guardfile_contents }).join end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
marv-0.3.2 | lib/marv/guard.rb |
marv-0.3.1 | lib/marv/guard.rb |
marv-0.3.0 | lib/marv/guard.rb |