module RubyLeiningen::Commands
Public Class Methods
define_custom_command(name, options = {}, &config_block)
click to toggle source
Calls superclass method
# File lib/ruby_leiningen/commands.rb, line 15 def define_custom_command(name, options = {}, &config_block) klass_name = name.classify klass = Class.new(Base) do unless options[:include_profile_support] == false include Mixins::Profile end unless options[:include_environment_support] == false include Mixins::Environment end define_method "configure_command" do |builder, opts| config = (config_block || lambda { |conf, _| conf }) .call(Config.new, opts) builder = super(builder, opts) builder = builder.with_subcommand(name) do |sub| config.subcommand_block.call(sub) end config.command_block.call(builder) end end const_set(klass_name, klass) unless options[:skip_singleton_method] RubyLeiningen.define_singleton_method name do |opts = {}| klass.new.execute(opts) end end end