Class: Maven::Tools::DSL::JRubyDSL

Inherits:
Object
  • Object
show all
Extended by:
Options
Defined in:
lib/maven/tools/dsl/jruby_dsl.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Options

args_and_options, fill_options, help_block

Constructor Details

#initialize(parent, scope, &block) ⇒ JRubyDSL

Returns a new instance of JRubyDSL.



47
48
49
50
51
52
# File 'lib/maven/tools/dsl/jruby_dsl.rb', line 47

def initialize( parent, scope, &block )
  @parent = parent 
  @data = {}
  self.scope scope
  self.instance_eval( &block ) if block
end

Class Method Details

.create(parent, scope, *args, &block) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/maven/tools/dsl/jruby_dsl.rb', line 37

def self.create( parent, scope, *args, &block )
  args, options = args_and_options( *args )
  j = JRubyDSL.new( parent, scope, &block )
  j.version args[0]
  j.no_asm args[1]
  fill_options( j, options || {} )
  j.apply
  j
end

Instance Method Details

#applyObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/maven/tools/dsl/jruby_dsl.rb', line 65

def apply
  if version.nil?
    # nothing to do
  elsif( version < '1.6' )
    raise 'jruby before 1.6 are not supported'
  elsif ( version < '1.7' )
    warn 'jruby version below 1.7 uses jruby-complete'
    dependency :jar, 'jruby-complete'
  elsif ( version.sub( /1\.7\./, '').to_i < 5 )
    dependency :jar, 'jruby-core'
  elsif no_asm
    dependency :pom, 'jruby-noasm'
  else
    dependency :pom, 'jruby-noasm'
  end
end

#helpObject



88
89
90
91
92
93
# File 'lib/maven/tools/dsl/jruby_dsl.rb', line 88

def help
  warn self.class.help( 'jruby', :scope, :version, :no_asm => true, :jar => nil ) + <<EOS
argument: jruby 'version'
arguments: jruby 'version', true
EOS
end

#jar(*args, &block) ⇒ Object



95
96
97
# File 'lib/maven/tools/dsl/jruby_dsl.rb', line 95

def jar( *args, &block )
  DependencyDSL.create( @parent, :jar, scope, *args, &block )
end

#legacy_versionObject



82
83
84
85
86
# File 'lib/maven/tools/dsl/jruby_dsl.rb', line 82

def legacy_version
  v = version
  v+= '-no_asm' if no_asm
  v
end