Class: Object

Inherits:
BasicObject
Defined in:
lib/bundler/vendor/thor/rake_compat.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#namespace(name, &block) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/bundler/vendor/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/bundler/vendor/thor/rake_compat.rb', line 34

alias :rake_namespace :namespace

#rake_taskObject



33
# File 'lib/bundler/vendor/thor/rake_compat.rb', line 33

alias :rake_task :task

#task(*args, &block) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bundler/vendor/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