Sha256: acc0b525686d6a19422f220f2a3cdd83c20723ddcf1f9cfa56838ea983dc045e

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

module Stevenson
  module Template
    autoload :Git, 'stevenson/templates/git'
    autoload :Local, 'stevenson/templates/local'

    autoload :Loader, 'stevenson/template/loader'

    def self.load(template, options)
      Loader.new(template, options).template
    end

    class Base
      attr_reader :name, :options

      def initialize(name, options = {})
        @name, @options = name, options
      end

      def place_config(config_file)
        place_files(config_file, '_config.yml')
      end

      def place_files(files, directory)
        action = File.directory?(files) ? :cp_r : :cp
        FileUtils.send(action, files, File.join(local_directory, directory))
      end

      def close
        FileUtils.rm_rf local_directory if local_directory
      end
    end

    class InvalidTemplateException < StandardError; end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stevenson-2.2.0 lib/stevenson/template.rb
stevenson-2.1.0 lib/stevenson/template.rb