Sha256: 9005ee09992b0557fb5223a1f38d549d362e99b7ac5c7c9f63cc3e2261afbb97
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module Challah::Rolls module Task require 'fileutils' def self.unpack_file(source, destination = nil) destination = source if destination.nil? unless defined?(Rails) raise "Rails could not be found. Are you sure you are in a Rails project?" end from = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', source)) to = File.expand_path(File.join(Rails.root, destination)) if File.exists?(from) if File.exists?(to) puts "exists #{destination}" else FileUtils.mkdir_p(File.dirname(to)) FileUtils.cp(from, to) puts "created #{destination}" end end end end end namespace :challah do namespace :unpack do desc "Copy the default Permission model into the app" task :permission do Challah::Rolls::Task.unpack_file('app/models/permission.rb') end desc "Copy the default Role model into the app" task :role do Challah::Rolls::Task.unpack_file('app/models/role.rb') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
challah-rolls-0.2.0 | lib/tasks/unpack.rake |
challah-rolls-0.1.1 | lib/tasks/unpack.rake |
challah-rolls-0.1.0 | lib/tasks/unpack.rake |