Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first import

  • Loading branch information...
commit 0f282c26b557eea53b71e910964bc6b2e4bc8b32 0 parents
@mkristian authored
2  .gitignore
@@ -0,0 +1,2 @@
+target
+*~
91 pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright (C) 2009 the original author or authors.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.sonatype.pmaven</groupId>
+ <artifactId>pmaven</artifactId>
+ <version>0.8-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>rubygems</artifactId>
+ <packaging>gem</packaging>
+ <name>ruby wrapper around maven and more</name>
+
+ <dependencies>
+ </dependencies>
+
+ <properties>
+ <!-- if some more gem releases are needed you can append some number
+ here with the gem.version -->
+ <jruby.plugins.version>0.28.3</jruby.plugins.version>
+ <gem.version>${project.parent.version}.${mavenVersion}.${jruby.plugins.version}</gem.version>
+ <gem.basedir>${project.build.directory}/ruby-maven-${gem.version}</gem.basedir>
+ </properties>
+ <build>
+ <finalName>ruby-maven-${gem.version}-java.gem</finalName>
+ <resources>
+ <resource>
+ <targetPath>${gem.basedir}/pmaven-${project.parent.version}</targetPath>
+ <directory>${project.basedir}/src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <outputAbsoluteArtifactFilename>false</outputAbsoluteArtifactFilename>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.sonatype.pmaven</groupId>
+ <artifactId>pmaven-cli</artifactId>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ <outputDirectory>${gem.basedir}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>gem-maven-plugin</artifactId>
+ <version>${jruby.plugins.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <gemspec>${project.basedir}/src/main/gemspec/maven.gemspec</gemspec>
+ <launchDirectory>${gem.basedir}/pmaven-${project.parent.version}</launchDirectory>
+ <includeOpenSSL>false</includeOpenSSL>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
34 src/main/gemspec/maven.gemspec
@@ -0,0 +1,34 @@
+require 'fileutils'
+
+Gem::Specification.new do |s|
+ s.platform = 'java'
+ s.name = %q{ruby-maven}
+ s.version = "#{File.basename(File.expand_path('..')).sub(/-SNAPSHOT/, '').sub(/[a-zA-Z-]+-/, '').gsub(/-/, '.')}"
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
+ s.authors = ["mkristian"]
+ s.description = %q{maven support for rubygems based on maven 3.0. it allows to use xyz.gemspec file as pom file or the usual pom.xml files. with a rails3 application with a Gemfile (suitable for jruby) you can run jetty as development server. this gem is a stripped polyglot-maven which includes only the jruby part. the executable runs only with jruby.}
+ s.email = ["m.kristian@web.de"]
+ s.extra_rdoc_files = ["NOTICE.txt", "LICENSE.txt", "README.txt"]
+
+ FileUtils.cp("bin/jetty-run", "bin/tomcat-run")
+
+ s.files = Dir.glob("*.txt") +
+ Dir.glob("bin/*-run") +
+ Dir.glob("bin/rmvn") +
+ Dir.glob("bin/m2.conf") +
+ Dir.glob("boot/*") +
+ Dir.glob("conf/*") +
+ Dir.glob("lib/*")
+ ext = Dir.glob("ext/*ruby*")
+ ext.delete(ext.detect{ |f| f =~ /jruby-complete/ })
+ s.files += ext
+ s.bindir = "bin"
+ s.executables = ['rmvn', 'jetty-run', 'tomcat-run']
+ s.homepage = %q{http://github.com/mkristian/ruby-maven}
+ s.rdoc_options = ["--main", "README.txt"]
+ s.require_paths = ['none']
+ s.rubygems_version = %q{1.3.5}
+ s.summary = %q{maven support for rubygems}
+
+end
+
25 src/main/resources/bin/jetty-run
@@ -0,0 +1,25 @@
+if ARGV.size > 4 || ARGV[0] == "--help" || ARGV[0] == "-h" || ARGV[0] == "-?"
+ puts "usage: #{File.basename($0)} [-e <environment>] [--war [<path/to/warfile>]]"
+ puts "\tdefault environment: development"
+ exit 1
+end
+
+args = [__FILE__.gsub(/-/, ':').gsub(/.*[\/\\]/, '')]
+if ARGV.size == 2 && ARGV[0] == "-e"
+ args << "-Drails.env=#{ARGV[1]}"
+ args << "-Prun"
+elsif ARGV.size == 1 && ARGV[0] == "--war"
+ args = ["jetty:run-war", "-Pwar"]
+elsif ARGV.size == 2 && ARGV[0] == "--war"
+ args = ["jetty:deploy-war", "-DwebApp=#{ARGV[1]}", "-Pwar"]
+elsif ARGV.size == 3 && ARGV[0] == "-e" && ARGV[2] == "--war"
+ args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[1]}"]
+elsif ARGV.size == 3 && ARGV[1] == "-e" && ARGV[0] == "--war"
+ args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[2]}"]
+elsif ARGV.size == 4 && ARGV[0] == "-e" && ARGV[2] == "--war"
+ args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[3]}", "-Drails.env=#{ARGV[1]}"]
+elsif ARGV.size == 4 && ARGV[2] == "-e" && ARGV[0] == "--war"
+ args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[1]}", "-Drails.env=#{ARGV[3]}"]
+end
+ARGV.replace(args)
+load File.join(File.dirname(__FILE__), "rmvn")
104 src/main/resources/bin/rmvn
@@ -0,0 +1,104 @@
+#!/usr/bin/env jruby
+begin
+ require 'java'
+rescue LoadError => e
+ raise "this executable needs jruby. quit."
+end
+
+# make the command line for the goals of the jruby-maven-plugins nicer
+plugins = {
+ :rake => [:rake],
+ :ruby => [:jruby, :compile],
+ :gem => [:package, :install, :push, :exec, :pom, :initialize, :irb],
+ :gemify => [:gemify, :versions],
+ :rails2 => [:new, :generate, :rake, :server, :console],
+ :rails3 => [:new, :generate, :rake, :server, :console, :dbconsole, :pom, :initialize],
+ :cucumber => [:test],
+ :rspec => [:test],
+ :runit => [:test],
+ :bundler => [:install]
+}
+aliases = {:jruby => :ruby, :spec => :rspec, :rails => :rails3, :bundle => :bundler}
+
+log = File.join('log', 'rmvn.log')
+if File.exists? File.dirname(log)
+ File.open(log, 'a') do |f|
+ f.puts ARGV.join ' '
+ end
+end
+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
+ args = if index = ARGV.index("--")
+ ARGV[index + 1, 1000]
+ else
+ []
+ end
+ ruby_args = (ARGV[start, (index || 1000) - start] || []).join(' ')
+
+ # determine the version and delete from ARGV if given
+ version = ARGV.detect do |a|
+ a =~ /^-Dplugin.version=/
+ end
+ if version
+ args.delete(version)
+ version.sub!(/^-Dplugin.version=/, ':')
+ end
+ args << "de.saumya.mojo:#{name}-maven-plugin#{version}:#{goal}"
+ args << "-Dargs=#{ruby_args}" if ruby_args.size > 0
+ ARGV.replace(args)
+ else
+ ARGV.delete("--")
+ end
+end
+if ARGV.size == 0 || ARGV[0] == "--help"
+ puts "usage: rmvn [<plugin name>|<plugin alias> [<args>] [-- <maven options>] | [<maven goal>|<maven phase> <maven options>] | --help"
+ ARGV.replace(["--help"])
+ plugins.each do |name, goals|
+ puts
+ 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
+ end
+ puts
+end
+
+print "maven commandline: "
+args = ARGV.dup
+ARGV.clear # clean up in case another script gets executed it gets clear ARGV
+puts args.join ' '
+
+
+bin = File.dirname(__FILE__)
+
+boot = File.join(bin, "..", "boot")
+ext = File.join(bin, "..", "ext")
+
+(Dir.glob(boot + "/*jar") + Dir.glob(ext + "/ruby-tools*jar")).each do |path|
+ require path
+end
+
+java.lang.System.setProperty("classworlds.conf", File.join(bin, "m2.conf"))
+
+java.lang.System.setProperty("maven.home", File.join(bin, ".."))
+
+
+org.codehaus.plexus.classworlds.launcher.Launcher.main(args)
Please sign in to comment.
Something went wrong with that request. Please try again.