Class: Maven::Tools::DSL::DependencyDSL
Constant Summary
Constants inherited from Artifact
Class Method Summary collapse
Instance Method Summary collapse
- #exclusion(*args, &block) ⇒ Object
- #exclusions(*args, &block) ⇒ Object
- #help ⇒ Object
-
#initialize(*args) ⇒ DependencyDSL
constructor
A new instance of DependencyDSL.
Methods included from Options
args_and_options, fill_options, help_block
Methods included from Models
#method_missing, #model, #respond_to?
Methods inherited from Artifact
from, from_coordinate, #gav, #key, #method_missing, new_local, #respond_to?, #to_coordinate, #to_s
Constructor Details
#initialize(*args) ⇒ DependencyDSL
Returns a new instance of DependencyDSL.
59 60 61 62 |
# File 'lib/maven/tools/dsl/dependency_dsl.rb', line 59 def initialize( *args ) super @model = Dependency.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Maven::Tools::DSL::Models
Class Method Details
.create(parent, type, scope, *args, &block) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/maven/tools/dsl/dependency_dsl.rb', line 31 def create( parent, type, scope, *args, &block ) if type a = DependencyDSL.from( type, *args, &block ) a.scope = scope if scope else scope = args.shift args += [nil, nil, { :scope => scope } ][ (args.size - 4 )..2 ] a = DependencyDSL.new( *args ) end = process_exclusions( a.model, a.dup ) a.instance_eval &block if block ( a.model, , :type ) parent.dependencies << a.model a end |
Instance Method Details
#exclusion(*args, &block) ⇒ Object
85 86 87 88 89 90 |
# File 'lib/maven/tools/dsl/dependency_dsl.rb', line 85 def exclusion( *args, &block ) e = ExclusionDSL.create( @model, *args, &block ) # TODO remove this part self[ :exclusions ] ||= [] self[ :exclusions ] << e.to_coordinate end |
#exclusions(*args, &block) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/maven/tools/dsl/dependency_dsl.rb', line 76 def exclusions( *args, &block ) # TODO remove this part if args.empty? super else self[ :exclusions ] = ExclusionsDSL.create( @model, *args, &block ).to_coordinate_array end end |
#help ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/maven/tools/dsl/dependency_dsl.rb', line 64 def help type = self[:type] warn self.class.help( type, :group_id, :artifact_id, :version, :classifier, :exclusions, :scope => '{:compile|:test|:provided|:runtime}', :exclusions => nil, :exclusion => nil) + <<EOS argument: #{type} 'group_id:artifact_id:version' argument: #{type} 'group_id:artifact_id:classifier:version' arguments: #{type} 'group_id:artifact_id','version' arguments: #{type} 'group_id:artifact_id','classifier,'version' arguments: #{type} 'group_id','artifact_id','version' arguments: #{type} 'group_id','artifact_id','classifier,'version' EOS end |