Sha256: b974203bbdc3f2b71b09efc7c75e320e2eea6432ff247e259e9c9ea277955734

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

#!/usr/bin/env jruby
begin
  require 'java'
rescue LoadError => e
  raise "this executable need jruby. quit."
end

bin = File.dirname(__FILE__)
boot = File.join(bin, "..", "boot")
ext = File.join(bin, "..", "ext")

classpath = (Dir.glob(boot + "/*jar") + Dir.glob(ext + "/ruby-tools*jar")).join(":")

java.lang.System.setProperty("classworlds.conf", File.join(bin, "m2.conf"))

java.lang.System.setProperty("maven.home", File.join(bin, ".."))

classpath.split(":").each do |path|
  require path
end

# make the command line for the goals of the jruby-maven-plugins nicer
plugins = {:rake => [:rake], :ruby => [:jruby, :compile], :gem => [:package, :install, :exec, :pom, :initialize], :gemify => [:gemify, :versions], :rails2 => [:new, :generate, :rake, :server, :console], :rails3 => [:new, :generate, :rake, :server, :console, :dbconsole, :pom], :cucumber => [:test], :rspec => [:test]}
aliases = {:jruby => :ruby, :spec => :rspec, :rails => :rails3}

if ARGV.size > 0 
  name = ARGV[0].to_sym
  name = aliases[name] || name
  if plugins.member?(name)
    start = 1
    if ARGV.size > 1
      if plugins[name].member? ARGV[1].to_sym
        goal = ARGV[1].to_sym
        start = 2
      else
        goal = plugins[name][0]
      end
    else
      goal = plugins[name][0]
    end
    line = (ARGV[start, 1000] || []).join(' ')
    args = ["de.saumya.mojo:#{ARGV[0]}-maven-plugin:#{goal}"]
    args << "-Dargs=\"#{line}\"" if line.size > 0
    ARGV.replace(args)
  elsif name == :"--help"
    ARGV.replace([name.to_s])
    plugins.each do |name, goals|
      print "plugin #{name}"
      print " - alias: #{aliases[name]}" if aliases[name]
      puts
      if goals.size > 1
        print "\tgoals       : #{goals.join(',')}"
        puts
      end
      print "\tdefault goal: #{goals[0]}"
      puts
      puts
    end
  end
end

print "maven commandline: "
puts ARGV.join ' '

org.codehaus.plexus.classworlds.launcher.Launcher.main(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-maven-0.8.pre-java bin/rmvn