Module: RubyLeiningen::Commands
- Defined in:
- lib/ruby_leiningen/commands.rb,
lib/ruby_leiningen/commands/run.rb,
lib/ruby_leiningen/commands/base.rb,
lib/ruby_leiningen/commands/deps.rb,
lib/ruby_leiningen/commands/check.rb,
lib/ruby_leiningen/commands/clean.rb,
lib/ruby_leiningen/commands/release.rb,
lib/ruby_leiningen/commands/uberjar.rb,
lib/ruby_leiningen/commands/version.rb,
lib/ruby_leiningen/commands/mixins/profile.rb,
lib/ruby_leiningen/commands/mixins/environment.rb
Defined Under Namespace
Modules: Mixins Classes: Base, Check, Clean, Config, Deps, Release, Run, Uberjar, Version
Class Method Summary collapse
Class Method Details
.define_custom_command(name, options = {}, &config_block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ruby_leiningen/commands.rb', line 15 def define_custom_command(name, = {}, &config_block) klass_name = name.classify klass = Class.new(Base) do unless [:include_profile_support] == false include Mixins::Profile end unless [: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 [:skip_singleton_method] RubyLeiningen.define_singleton_method name do |opts = {}| klass.new.execute(opts) end end end |