Module: RakeTasks::Dependency
Instance Method Summary collapse
Instance Method Details
#loaded?(constant, requirement) ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rake_tasks/dependency.rb', line 16 def loaded?(constant, requirement) if ::Kernel::const_defined?(constant.match(/\w+/).to_s) return true else puts "<#{constant}> is not defined.\n" puts "Please `require '#{requirement}'` in your application " + "before loading the corresponding task." return false end end |
#require_politely(lib, title, stream = STDOUT) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/rake_tasks/dependency.rb', line 6 def require_politely(lib, title, stream = STDOUT) begin Kernel.require lib rescue LoadError => e stream.puts e. stream.puts "#{lib} could not be required." stream.puts "Please ensure that #{title} is included in the Gemfile." end end |