module Rake::Guardian

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/rake/guardian/config.rb, line 19
def self.config
  @_config ||= Rake::Guardian::Configuration.new
end
configure() { |config| ... } click to toggle source
# File lib/rake/guardian/config.rb, line 15
def self.configure(&block)
  yield config
end

Public Instance Methods

invoke_task(task_string) click to toggle source
Calls superclass method
# File lib/rake/guardian.rb, line 7
def invoke_task(task_string)
  name, args = parse_task_string(task_string)
  if need_guard?(name)
    $stderr.puts "[rake-guardian] #{name} can not invoke."
    return 0
  end
  super
end
need_guard?(task_name) click to toggle source
# File lib/rake/guardian.rb, line 16
def need_guard?(task_name)
  env = ENV['RAILS_ENV']
  config = Rake::Guardian.config

  if config.env.include?(env) && config.tasks.include?(task_name)
    true
  else
    false
  end
end