Permalink
Browse files

prepare release

  • Loading branch information...
1 parent 98919a0 commit 72386bc74816e09563b88b7cae5f08526f9effbb @mkristian committed Jan 21, 2013
Showing with 404 additions and 124 deletions.
  1. +1 −0 .gitignore
  2. +73 −0 Mavenfile
  3. +7 −5 README.md
  4. +2 −2 Rakefile
  5. +2 −1 lib/ruby/maven/ruby/pom_magic.rb
  6. +304 −102 pom.xml
  7. +2 −2 ruby-maven.gemspec
  8. +2 −1 spec/cli_spec.rb
  9. +11 −11 spec/pom_magic_spec.rb
View
1 .gitignore
@@ -8,5 +8,6 @@ lib/*jar
lib/ext
bin/m2*
.pom.xml
+_pom.xml
*.lock
*.gem
View
73 Mavenfile
@@ -0,0 +1,73 @@
+# -*- mode:ruby -*-
+
+plugin :dependency do |d|
+ d.in_phase('process-sources').execute_goal(:unpack).with :outputAbsoluteArtifactFilename => false, :artifactItems => <<-XML
+
+ <artifactItem>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>apache-maven</artifactId>
+ <version>${maven.version}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </artifactItem>
+XML
+end # maven-dependency-plugin
+
+plugin :gem do |g|
+ g.extensions true
+ g.in_phase('prepare-package').execute_goal(:initialize)
+ g.with :gemspec => 'ruby-maven.gemspec', :includeOpenSSL => true
+ g.gem 'thor'#, '0.14.6'
+ g.gem 'maven-tools'#, '0.31.0'
+end
+
+plugin(:clean, '2.5' ).with :filesets => <<-XML
+
+ <fileset>
+ <directory>lib</directory>
+ <includes>
+ <include>*jar</include>
+ <include>ext/**</include>
+ </includes>
+ </fileset>
+ <fileset>
+ <directory>bin</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <excludes>
+ <exclude>rmvn</exclude>
+ </excludes>
+ </fileset>
+ <fileset>
+ <directory>./</directory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileset>
+XML
+# end maven-clean-plugin
+build.resources.add do |r|
+ r.target_path "${project.basedir}"
+ r.directory "${project.build.directory}/apache-maven-${maven.version}"
+end
+
+execute_in_phase( :initialize ) do
+ pom = File.read( 'pom.xml' )
+ dot_pom = File.read( '.pom.xml' )
+ if pom != dot_pom
+ File.open( 'pom.xml', 'w' ) { |f| f.puts dot_pom }
+ end
+end
+
+# just lock the versions
+properties['jruby.plugins.version'] = '0.29.2-SNAPSHOT'
+properties['jruby'] = '1.7.2'
+
+# overwrite via cli -Djruby.versions=1.6.7
+properties['jruby.versions'] = ['1.5.6','1.6.8','1.7.2'].join(',')
+# overwrite via cli -Djruby.use18and19=false
+properties['jruby.18and19'] = true
+
+
View
12 README.md
@@ -1,6 +1,8 @@
-# ruby maven [![Build Status](https://secure.travis-ci.org/mkristian/ruby-maven.png)](http://travis-ci.org/mkristian/ruby-maven) #
+# ruby maven #
-once installed it is a fully functional maven installaton with *rmvn* as command.
+* [![Build Status](https://secure.travis-ci.org/mkristian/ruby-maven.png)](http://travis-ci.org/mkristian/ruby-maven) #
+
+ruby maven is a fully functional maven installation with a ruby command *rmvn* as launcher.
it also provides an easy way to embed maven with your ruby scripts
@@ -40,7 +42,7 @@ or with jruby
jgem install ruby-maven
-MRI performs much better due to the fast startup of the interpreter.
+when using ruby-maven then MRI performs much better due to the fast startup of the interpreter.
## build the gem and run specs
@@ -50,11 +52,11 @@ to build the gem you need [http://maven.apache.org](maven)
will create the gem in _target_ directory.
-to run the specs it is sufficient to run
+to run the specs first you need to get all the files for the gem in place (download them via maven) by executing
mvn process-resources
-to get all the files for the gem in place (downloaded via maven). now
+now
rake
View
4 Rakefile
@@ -3,8 +3,8 @@
task :default => [ :spec ]
task :spec do
- require 'rubygems'
- require 'bundler/setup'
+# require 'rubygems'
+# require 'bundler/setup'
require 'minitest/autorun'
$LOAD_PATH << "spec"
View
3 lib/ruby/maven/ruby/pom_magic.rb
@@ -19,6 +19,7 @@ def pom_xml(dir = '.')
def generate_pom(dir = '.', *args)
pom = nil
+ dir = File.expand_path( dir )
Dir.chdir(dir) do
if index = (args.index("-f") || args.index("--file"))
filename = args[index + 1]
@@ -55,7 +56,7 @@ def generate_pom(dir = '.', *args)
proj.load_jarfile(File.join(File.dirname(filename), 'Jarfile'))
proj.load_gemfile(File.join(File.dirname(filename), 'Mavenfile'))
proj.add_defaults
- pom = pom_xml(dir)
+ pom = pom_xml(dir)
File.open(pom, 'w') do |f|
f.puts proj.to_xml
end
View
406 pom.xml
@@ -1,121 +1,135 @@
-<?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>
-
<groupId>rubygems</groupId>
<artifactId>ruby-maven</artifactId>
<version>3.0.4.1.2</version>
+ <name><![CDATA[maven support for ruby projects with gemspec, Gemfile]]></name>
<packaging>gem</packaging>
- <name>ruby wrapper around maven and more</name>
-
- <pluginRepositories>
- <pluginRepository>
- <id>rubygems-releases</id>
- <url>http://rubygems-proxy.torquebox.org/releases</url>
- </pluginRepository>
- </pluginRepositories>
-
+ <description><![CDATA[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 need java installed or jruby but it will run with MRI (without installed jruby) since the maven will take care of the jruby to use.]]></description>
+ <url>http://github.com/mkristian/ruby-maven</url>
+ <developers>
+ <developer>
+ <id>m_dot_kristian_at_web_dot_de</id>
+ <name>mkristian</name>
+ <email>m.kristian@web.de</email>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>LICENSE</name>
+ <url>./LICENSE.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
<repositories>
<repository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</repository>
</repositories>
-
+ <pluginRepositories>
+ <pluginRepository>
+ <id>rubygems-releases</id>
+ <url>http://rubygems-proxy.torquebox.org/releases</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>sonatype-snapshots</id>
+ <url>http://oss.sonatype.org/content/repositories/snapshots</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>thor</artifactId>
+ <type>gem</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>maven-tools</artifactId>
+ <type>gem</type>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>minitest</artifactId>
+ <type>gem</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>rake</artifactId>
+ <type>gem</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>bundler</artifactId>
+ <type>gem</type>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>ruby-maven</artifactId>
+ <version>3.0.4.1.2</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>maven-tools</artifactId>
+ <version>0.32.0</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>thor</artifactId>
+ <version>0.16.0</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>minitest</artifactId>
+ <version>4.4.0</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>rake</artifactId>
+ <version>10.0.3</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>bundler</artifactId>
+ <version>1.1.4</version>
+ <type>gem</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<properties>
+ <gem.home>${project.build.directory}/rubygems</gem.home>
+ <gem.path>${project.build.directory}/rubygems</gem.path>
+ <jruby>1.7.2</jruby>
+ <jruby.18and19>true</jruby.18and19>
+ <jruby.plugins.version>0.29.2-SNAPSHOT</jruby.plugins.version>
+ <jruby.versions>1.5.6,1.6.8,1.7.2</jruby.versions>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.version>3.0.4</maven.version>
</properties>
<build>
- <resources>
- <resource>
- <targetPath>${project.basedir}</targetPath>
- <directory>${project.build.directory}/apache-maven-${maven.version}</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.apache.maven</groupId>
- <artifactId>apache-maven</artifactId>
- <version>${maven.version}</version>
- <classifier>bin</classifier>
- <type>zip</type>
- <outputDirectory>${project.build.directory}</outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>de.saumya.mojo</groupId>
- <artifactId>gem-maven-plugin</artifactId>
- <version>0.29.0</version>
- <extensions>true</extensions>
- <executions>
- <execution>
- <id>default-initialize</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>initialize</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <gemspec>${project.basedir}/ruby-maven.gemspec</gemspec>
- <includeOpenSSL>true</includeOpenSSL>
- </configuration>
- <dependencies>
- <!-- get the gems so `gem build` works -->
- <dependency>
- <groupId>rubygems</groupId>
- <artifactId>thor</artifactId>
- <version>0.14.6</version>
- <type>gem</type>
- </dependency>
- <dependency>
- <groupId>rubygems</groupId>
- <artifactId>maven-tools</artifactId>
- <version>0.29.3</version>
- <type>gem</type>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <filesets>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <filesets>
<fileset>
<directory>lib</directory>
<includes>
@@ -138,9 +152,197 @@
<include>*.txt</include>
</includes>
</fileset>
- </filesets>
- </configuration>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>in_phase_process_sources</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>apache-maven</artifactId>
+ <version>${maven.version}</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ <outputAbsoluteArtifactFilename>false</outputAbsoluteArtifactFilename>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>bundler-maven-plugin</artifactId>
+ <version>${jruby.plugins.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>gem-maven-plugin</artifactId>
+ <version>${jruby.plugins.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <gemspec>ruby-maven.gemspec</gemspec>
+ <includeOpenSSL>true</includeOpenSSL>
+ </configuration>
+ <executions>
+ <execution>
+ <id>in_phase_initialize</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>execute_in_phase</goal>
+ </goals>
+ <configuration>
+ <file>Mavenfile</file>
+ <phase>initialize</phase>
+ </configuration>
+ </execution>
+ <execution>
+ <id>in_phase_prepare_package</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>initialize</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>thor</artifactId>
+ <version>[0,)</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>maven-tools</artifactId>
+ <version>[0,)</version>
+ <type>gem</type>
+ </dependency>
+ <dependency>
+ <groupId>rubygems</groupId>
+ <artifactId>jruby-openssl-maven</artifactId>
+ <version>[0,)</version>
+ <type>gem</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>minitest-maven-plugin</artifactId>
+ <version>${jruby.plugins.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>spec</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <action>
+ <ignore></ignore>
+ </action>
+ <pluginExecutionFilter>
+ <artifactId>bundler-maven-plugin</artifactId>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ <groupId>de.saumya.mojo</groupId>
+ <versionRange>[0,)</versionRange>
+ </pluginExecutionFilter>
+ </pluginExecution>
+ <pluginExecution>
+ <action>
+ <ignore></ignore>
+ </action>
+ <pluginExecutionFilter>
+ <artifactId>gem-maven-plugin</artifactId>
+ <goals>
+ <goal>initialize</goal>
+ </goals>
+ <groupId>de.saumya.mojo</groupId>
+ <versionRange>[0,)</versionRange>
+ </pluginExecutionFilter>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <resources>
+ <resource>
+ <targetPath>${project.basedir}</targetPath>
+ <directory>${project.build.directory}/apache-maven-${maven.version}</directory>
+ </resource>
+ </resources>
</build>
+ <profiles>
+ <profile>
+ <id>executable</id>
+ <dependencies>
+ <dependency>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>gem-assembly-descriptors</artifactId>
+ <version>${jruby.plugins.version}</version>
+ <type>jar</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>de.saumya.mojo.assembly.Main</mainClass>
+ </manifest>
+ </archive>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies-and-gems</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>in_phase_package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>de.saumya.mojo</groupId>
+ <artifactId>gem-assembly-descriptors</artifactId>
+ <version>${jruby.plugins.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
View
4 ruby-maven.gemspec
@@ -28,9 +28,9 @@ Gem::Specification.new do |s|
s.rubygems_version = %q{1.3.5}
s.summary = %q{maven support for ruby projects with gemspec, Gemfile}
s.add_dependency 'thor', '>= 0.14.6', '< 2.0' # mimic rails
- s.add_dependency 'maven-tools', "~> 0.31"
+ s.add_dependency 'maven-tools', "~> 0.32"
s.add_development_dependency 'minitest', '~> 4.3'
- s.add_development_dependency 'rake', '~> 10.0.0.2'
+ s.add_development_dependency 'rake', '~> 10.0.3'
File.chmod(0755, File.join("bin", "mvn"))
end
View
3 spec/cli_spec.rb
@@ -1,3 +1,4 @@
+$LOAD_PATH << 'lib/ruby'
require 'maven/ruby/cli'
require 'stringio'
@@ -10,7 +11,7 @@
it 'should launch maven with pom.xml' do
subject.exec('-l', log, 'validate')
File.read(log).must_match /BUILD SUCCESS/
- File.read(log).must_match /Building ruby wrapper/
+ File.read(log).must_match /Building maven support for ruby projects/
end
it 'should launch maven without pom.xml' do
View
22 spec/pom_magic_spec.rb
@@ -8,9 +8,9 @@
subject { Maven::Ruby::PomMagic.new('_pom.xml') }
it 'should generate project specific pom.xml with given name' do
- pom = 'it/project/_pom.xml'
+ pom = File.expand_path( 'it/project/_pom.xml' )
subject.generate_pom(File.join('it', 'project')).must_equal pom
- File.read(pom).must_match /<name><..CDATA.ruby-maven - gem..><.name>/
+ File.read(pom).must_match /<name><..CDATA.project - gem..><.name>/
end
end
@@ -27,35 +27,35 @@
end
it 'should generate rails specific pom.xml' do
- pom = 'it/rails/.pom.xml'
+ pom = File.expand_path( 'it/rails/.pom.xml' )
subject.generate_pom(File.join('it', 'rails')).must_equal pom
- File.read(pom).must_match /<name><..CDATA.ruby-maven - rails application..><.name>/
+ File.read(pom).must_match /<name><..CDATA.rails - rails application..><.name>/
end
it 'should generate project specific pom.xml' do
- pom = 'it/project/.pom.xml'
+ pom = File.expand_path( 'it/project/.pom.xml' )
subject.generate_pom(File.join('it', 'project')).must_equal pom
- File.read(pom).must_match /<name><..CDATA.ruby-maven - gem..><.name>/
+ File.read(pom).must_match /<name><..CDATA.project - gem..><.name>/
end
it 'should generate project specific pom.xml using gemspec' do
- pom = 'it/project/.pom.xml'
+ pom = File.expand_path( 'it/project/.pom.xml' )
subject.generate_pom(File.join('it', 'project'),
'-f',
- 'it/project/minimal.gemspec').must_equal pom
+ 'minimal.gemspec').must_equal pom
File.read(pom).must_match /<name><..CDATA.minimal - gem..><.name>/
end
it 'should generate project specific pom.xml using Gemfile with gemspec' do
- pom = 'it/project/.pom.xml'
+ pom = File.expand_path( 'it/project/.pom.xml' )
subject.generate_pom(File.join('it', 'project'),
'-f',
- 'it/project/Gemfile2').must_equal pom
+ 'Gemfile2').must_equal pom
File.read(pom).must_match /<name><..CDATA.minimal - gem..><.name>/
end
it 'should generate project specific pom.xml without Gemfile' do
- subject.generate_pom(File.join('it', 'project_no_gemfile')).must_equal 'it/project_no_gemfile/.pom.xml'
+ subject.generate_pom(File.join('it', 'project_no_gemfile')).must_equal File.expand_path( 'it/project_no_gemfile/.pom.xml' )
end
end

0 comments on commit 72386bc

Please sign in to comment.