2012-08-29 22 views

回答

9

如果我們假定目標的寶石在你的Gemfile,你想在你的Rails Rake文件中的Rake任務,那麼你可以嘗試這樣的:

namespace :config do 
    # desc "Copy the config" 
    task :copy do 
    source = File.join(Gem.loaded_specs["myGem"].full_gem_path, "config", "config.yml") 
    target = File.join(Rails.root, "config", "myGemConfig.yml") 
    FileUtils.cp_r source, target 
    end 
end 
相關問題