Class: Object

Inherits:
BasicObject
Defined in:
lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb,
lib/daemon_kit/safety.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.safely(&block) ⇒ Object



72
73
74
# File 'lib/daemon_kit/safety.rb', line 72

def safely(&block)
  DaemonKit::Safety.run(&block)
end

Instance Method Details

#namespace(name, &block) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb', line 55

def namespace(name, &block)
  if klass = Thor::RakeCompat.rake_classes.last
    const_name = Thor::Util.camel_case(name.to_s).to_sym
    klass.const_set(const_name, Class.new(Thor))
    new_klass = klass.const_get(const_name)
    Thor::RakeCompat.rake_classes << new_klass
  end

  rake_namespace(name, &block)
  Thor::RakeCompat.rake_classes.pop
end

#rake_namespaceObject



34
# File 'lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb', line 34

alias :rake_namespace :namespace

#rake_taskObject



33
# File 'lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb', line 33

alias :rake_task :task

#safely(&block) ⇒ Object



77
78
79
# File 'lib/daemon_kit/safety.rb', line 77

def safely(&block)
  DaemonKit::Safety.run(&block)
end

#task(*args, &block) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb', line 36

def task(*args, &block)
  task = rake_task(*args, &block)

  if klass = Thor::RakeCompat.rake_classes.last
    non_namespaced_name = task.name.split(':').last

    description = non_namespaced_name
    description << task.arg_names.map{ |n| n.to_s.upcase }.join(' ')
    description.strip!

    klass.desc description, task.comment || non_namespaced_name
    klass.send :define_method, non_namespaced_name do |*args|
      Rake::Task[task.name.to_sym].invoke(*args)
    end
  end

  task
end