10
我一直在尝试在我的当前应用中包含位于github上的宝石。该宝石有一个耙文件,我想能够从我的应用程序访问。但我不断收到加载错误。Ruby Rake从宝石中加载任务
load 'tasks/deploy.rake'
宝石文件看起来像
# -*- encoding: utf-8 -*-
require 'rake'
Gem::Specification.new do |gem|
gem.authors = %w(Hello World)
gem.email = %w([email protected])
gem.description = 'test'
gem.summary = 'test'
gem.homepage = 'https://github.com/..'
gem.files = FileList[ 'lib/**/*.rb', 'tasks/deploy.rake', 'README.md' ].to_a
gem.name = 'test'
gem.require_paths = %w(lib)
gem.version = '0.0.1'
end
我希望能够加载./tasks/deploy.rake到我的应用程序,其中包括这颗宝石,我怎么去上吧?
感谢
对我来说,还要在应用程序的rakefile(不是宝石)中放入'require'/rake_tasks'' –
msa7
2013-09-24 08:06:27
@SergXIIIth它取决于gem的结构。例如,对于'sitemap_generator',它是'require'sitemap_generator/tasks'',对于'padrino'则'require'padrino-core/cli/rake''等。 – jibiel 2013-12-15 14:16:24