Sha256: e533d5660db2ebcd90c7950acfab19e244d47ff17b20a49b4dd5d33d7a03ce61

Contents?: true

Size: 667 Bytes

Versions: 70

Compression:

Stored size: 667 Bytes

Contents

module Rails
  class TemplateRunner

    def project_name
      @root.split("/").last
    end

    def file_append(file, data)
      log 'file_append', file
      append_file(file, "\n#{data}")
    end

    def file_inject(file_name, sentinel, string, before_after=:after)
      log 'file_inject', file_name
      gsub_file file_name, /(#{Regexp.escape(sentinel)})/mi do |match|
        if :after == before_after
          "#{match}\n#{string}"
        else
          "#{string}\n#{match}"
        end
      end
    end

    def bard_load_template(template_file)
      load_template Gem.required_location "bard", "bard/template/#{template_file}.rb"
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bard-0.11.1 lib/bard/template/helper.rb
bard-0.11.0 lib/bard/template/helper.rb
bard-0.10.0 lib/bard/template/helper.rb
bard-0.9.14 lib/bard/template/helper.rb
bard-0.9.13 lib/bard/template/helper.rb
bard-0.9.12 lib/bard/template/helper.rb
bard-0.9.11 lib/bard/template/helper.rb
bard-0.9.10 lib/bard/template/helper.rb
bard-0.9.9 lib/bard/template/helper.rb
bard-0.9.8 lib/bard/template/helper.rb
bard-0.9.7 lib/bard/template/helper.rb
bard-0.9.6 lib/bard/template/helper.rb
bard-0.9.5 lib/bard/template/helper.rb
bard-0.9.4 lib/bard/template/helper.rb
bard-0.9.3 lib/bard/template/helper.rb
bard-0.9.2 lib/bard/template/helper.rb
bard-0.9.1 lib/bard/template/helper.rb
bard-0.9.0 lib/bard/template/helper.rb
bard-0.8.31 lib/bard/template/helper.rb
bard-0.8.30 lib/bard/template/helper.rb