Sha256: 91ae14e974e60fc7d8d4793a532a9f6c251e77c9dbbffac886b1d74ca9ae364b
Contents?: true
Size: 929 Bytes
Versions: 11
Compression:
Stored size: 929 Bytes
Contents
require 'pathname' module SchemaDev module Gemfiles extend self TEMPLATES_ROOT = Pathname.new(__FILE__).dirname.parent.parent + "templates" def build(config) @src_root = TEMPLATES_ROOT @dst_root = Pathname.new('.') path = Pathname.new("gemfiles") _blow_away(path) _copy(path, 'Gemfile.base') config.rails.each do |rails| rails_path = path + "rails-#{rails}" _copy(rails_path, 'Gemfile.base') config.db.each do |db| _copy(rails_path, "Gemfile.#{db}") end end return true end def _copy(path, filename) srcfile = @src_root + path + filename dstfile = @dst_root + path + filename return unless srcfile.exist? dstfile.dirname.mkpath FileUtils.copy_file(srcfile, dstfile) end def _blow_away(path) (@dst_root + path).rmtree rescue Errno::ENOENT end end end
Version data entries
11 entries across 11 versions & 1 rubygems