class Mvn2::CommandTypes

Public Class Methods

def_command() click to toggle source
# File lib/mvn2/plugin.rb, line 112
def self.def_command
  def_command_flag
  def_command_goal
  register_type(:operation_name) { |list| get_name(list) || 'Operation' }
  register_type(:clean_block) { |list| basic_type(list) }
end
def_command_flag() click to toggle source
# File lib/mvn2/plugin.rb, line 119
def self.def_command_flag
  register_type(:command_flag) { |list|
    options = Plugins.get_var :options
    flags   = []
    list.each { |flag|
      if flag[:block].nil?
        flags << " #{flag[:options][:flag]}" if flag_boolean(flag, options)
      else
        flag[:block].call(options, flags)
      end
    }
    flags.join
  }
end
def_command_goal() click to toggle source
# File lib/mvn2/plugin.rb, line 134
def self.def_command_goal
  register_type(:goal_override) { |list|
    options        = Plugins.get_var :options
    full_overrides = complex_filter(list.select { |v| v[:options][:override_all] }.sort_by { |v| -v[:options][:priority] }, options, :goal)
    if full_overrides.nil? || full_overrides.empty?
      goals = complex_filter(list.select { |v| !v[:options][:override_all] }.sort_by { |v| v[:options][:order] }, options, :goal)
      goals = ['install'] if (goals - ['clean']).empty?
      goals = ['clean'] + goals unless goals.include?('clean')
      goals = goals - ['clean'] if Plugins.get(:clean_block)
      goals.join(' ')
    else
      full_overrides.first
    end
  }
end