<commit_before>require 'guard'
require 'guard/guard'

module Forge
  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

      guardfile_contents = %Q{
        guard 'forgeconfig'#{options_hash} do
          watch("#{@project.config_file}")
        end
        guard 'forgeassets' do
          watch(%r{#{@project.source_dir}/assets/javascripts/*})
          watch(%r{#{@project.source_dir}/assets/stylesheets/*})
        end
        guard 'forgetemplates' do
          watch(%r{#{@project.source_dir}/templates/*})
          watch(%r{#{@project.source_dir}/partials/*})
        end
        guard 'forgefunctions' do
          watch(%r{#{@project.source_dir}/functions/*})
        end
      }

      (@additional_guards || []).each do |block|
        result = block.call(options, livereload)
        guardfile_contents << result unless result.nil?
      end

      ::Guard.start({ :guardfile_contents => guardfile_contents })
    end
  end
end<commit_msg>Fixing guardfile paths to be relative<commit_after>require 'guard'
require 'guard/guard'

module Forge
  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_dir = @project.assets_path.gsub(/#{@project.root}\//, '')
      source_dir = @project.source_dir.gsub(/#{@project.root}\//, '')
      config_file = @project.config_file.gsub(/#{@project.root}\//, '')

      guardfile_contents = %Q{
        guard 'forgeconfig'#{options_hash} do
          watch("#{config_file}")
        end
        guard 'forgeassets' do
          watch(%r{#{assets_dir}/javascripts/*})
          watch(%r{#{assets_dir}/stylesheets/*})
        end
        guard 'forgetemplates' do
          watch(%r{#{source_dir}/templates/*})
          watch(%r{#{source_dir}/partials/*})
        end
        guard 'forgefunctions' do
          watch(%r{#{source_dir}/functions/*})
        end
      }

      (@additional_guards || []).each do |block|
        result = block.call(options, livereload)
        guardfile_contents << result unless result.nil?
      end

      ::Guard.start({ :guardfile_contents => guardfile_contents })
    end
  end
end
{'fraction_non_alphanumeric': 0.14804469273743018, 'fraction_numerical': 0.0, 'mean_word_length': 2.4107142857142856, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6466978', 'n_tokens_mistral': 892, 'n_tokens_neox': 873, 'n_words': 174}