модуль Bundler::Thor::RakeCompat
Добавляет слой совместимости к вашим классам Bundler::Thor, который позволяет использовать задачи пакета rake. Например, чтобы использовать задачи rspec rake, можно сделать следующее:
require 'bundler/vendor/thor/lib/thor/rake_compat'
require 'rspec/core/rake_task'
class Default < Bundler::Thor
include Bundler::Thor::RakeCompat
RSpec::Core::RakeTask.new(:spec) do |t|
t.spec_opts = ['--options', './.rspec']
t.spec_files = FileList['spec/**/*_spec.rb']
end
end
Публичные методы класса
# File lib/bundler/vendor/thor/lib/thor/rake_compat.rb, line 27 def self.included(base) super(base) # Hack. Make rakefile point to invoker, so rdoc task is generated properly. rakefile = File.basename(caller[0].match(/(.*):\d+/)[1]) Rake.application.instance_variable_set(:@rakefile, rakefile) rake_classes << base end
Вызывает метод суперкласса
# File lib/bundler/vendor/thor/lib/thor/rake_compat.rb, line 23 def self.rake_classes @rake_classes ||= [] end
Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.