Sha256: 84e9fc654a28aa365305c209cceedde022757d6723a2f2bc53f63d3ebd11d1e4
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require "capistrano/configuration/resources/file_resources/version" require "capistrano/configuration" require "erb" module Capistrano class Configuration module Resources module FileResources def file(name, options={}) path = options.fetch(:path, ".") begin File.read(File.join(path, name)) rescue SystemCallError => error abort("Could not render file resource - #{error}") end end def template(name, options={}) path = options.fetch(:path, ".") name = "#{name}.erb" if File.exist?(File.join(path, "#{name}.erb")) data = file(name, options) begin ERB.new(data).result(binding) rescue StandardError => error abort("Could not render template resource - #{error}") end end end end end end if Capistrano::Configuration.instance Capistrano::Configuration.instance.extend(Capistrano::Configuration::Resources::FileResources) end # vim:set ft=ruby sw=2 ts=2 :
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capistrano-file-resources-0.1.0 | lib/capistrano/configuration/resources/file_resources.rb |
capistrano-file-resources-0.0.1 | lib/capistrano/configuration/resources/file_resources.rb |