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.19.0 lib/bard/template/helper.rb
bard-0.18.0 lib/bard/template/helper.rb
bard-0.17.1 lib/bard/template/helper.rb
bard-0.17.0 lib/bard/template/helper.rb
bard-0.16.1 lib/bard/template/helper.rb
bard-0.16.0 lib/bard/template/helper.rb
bard-0.15.5 lib/bard/template/helper.rb
bard-0.15.4 lib/bard/template/helper.rb
bard-0.15.3 lib/bard/template/helper.rb
bard-0.15.2 lib/bard/template/helper.rb
bard-0.15.0 lib/bard/template/helper.rb
bard-0.14.2 lib/bard/template/helper.rb
bard-0.14.1 lib/bard/template/helper.rb
bard-0.14.0 lib/bard/template/helper.rb
bard-0.13.2 lib/bard/template/helper.rb
bard-0.13.1 lib/bard/template/helper.rb
bard-0.13.0 lib/bard/template/helper.rb
bard-0.12.0 lib/bard/template/helper.rb
bard-0.11.3 lib/bard/template/helper.rb
bard-0.11.2 lib/bard/template/helper.rb