require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper.rb'))
require 'maven/tools/gem_project'
describe Maven::Tools::GemProject do
before :each do
@project = Maven::Tools::GemProject.new("test")
end
it 'should setup an empty gem project' do
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
XML
end
describe "Jarfile" do
it 'should load Jarfile without lockfile' do
@project.load_jarfile(File.join(File.dirname(__FILE__), 'Jarfile.without'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
org.slf4j
slf4j-simple
[1.5.6,)
jar
org.slf4j
slf4j-default
pom
XML
end
it 'should load Jarfile with lockfile' do
@project.load_jarfile(File.join(File.dirname(__FILE__), 'Jarfile.with'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
org.slf4j
slf4j-simple
1.5.6
jar
XML
end
end
describe "Gemfile" do
it 'should load Gemfile with minimal gemspec' do
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.minimal'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
minimal
1.0.0
gem
de.saumya.mojo
gem-maven-plugin
rspec/maven/tools/minimal.gemspec
de.saumya.mojo
bundler-maven-plugin
XML
end
it 'should load Gemfile with gemspec but no Gemfile.lock' do
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.nolock'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
maven-tools
0.32.0
gem
http://github.com/torquebox/maven-tools
m_dot_kristian_at_web_dot_de
Christian Meier
m.kristian@web.de
rubygems
rake
[10.0.3,10.0.99999]
gem
test
rubygems
minitest
[4.4,4.99999]
gem
test
rubygems
rspec
[2.7,2.7.0.0.0.0.1)
gem
test
de.saumya.mojo
gem-maven-plugin
rspec/maven/tools/maven-tools.gemspec
de.saumya.mojo
bundler-maven-plugin
XML
end
it 'should load Gemfile with gemspec but with Gemfile.lock' do
pending "hash is differently orderd in ruby1.8" if RUBY_VERSION =~ /^1.8/ && !defined? JRUBY_VERSION
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.withlock'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
maven-tools
0.32.0
gem
http://github.com/torquebox/maven-tools
m_dot_kristian_at_web_dot_de
Christian Meier
m.kristian@web.de
rubygems
rake
gem
test
rubygems
minitest
gem
test
rubygems
rspec
gem
test
rubygems
rspec-core
gem
test
rubygems
rspec-expectations
gem
test
rubygems
diff-lcs
gem
test
rubygems
rspec-mocks
gem
test
rubygems
maven-tools
0.32.0
gem
rubygems
diff-lcs
1.1.3
gem
rubygems
minitest
4.4.0
gem
rubygems
rake
10.0.3
gem
rubygems
rspec
2.7.0
gem
rubygems
rspec-core
2.7.1
gem
rubygems
rspec-expectations
2.7.0
gem
rubygems
rspec-mocks
2.7.0
gem
de.saumya.mojo
gem-maven-plugin
rspec/maven/tools/maven-tools.gemspec
de.saumya.mojo
bundler-maven-plugin
XML
end
it 'should load Gemfile with "source", "path" and "platform"' do
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.ignored'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
rubygems
ixtlan-core
[0,)
gem
de.saumya.mojo
bundler-maven-plugin
XML
end
it 'should load Gemfile with simple gems"' do
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.gems'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
rubygems
ixtlan-core
[0,)
gem
de.saumya.mojo
bundler-maven-plugin
test
rubygems
dm-sqlite3-adapter
[0.10.0,0.10.99999]
gem
development
rubygems
dm-mysql-adapter
[0.10.0,0.10.3)
gem
rubygems
dm-hsqldb-adapter
[0.10.0,0.10.0.0.0.0.0.1)
gem
production
rubygems
dm-mysql-adapter
[0.10.0,0.10.3)
gem
XML
end
it 'should load Gemfile with grouped gems and added defaults"' do
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.groups'))
@project.name "test"
@project.add_defaults
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
rubygems-releases
http://rubygems-proxy.torquebox.org/releases
rubygems-releases
http://rubygems-proxy.torquebox.org/releases
rubygems
bundler
gem
test
rubygems
bundler
_bundler.version_
gem
UTF-8
${project.build.directory}/rubygems
${project.build.directory}/rubygems
_project.version_
de.saumya.mojo
bundler-maven-plugin
${jruby.plugins.version}
install
rubygems
ixtlan-core
[0,)
gem
rubygems
dm-sqlite-adapter
[1.0.0,1.0.99999]
gem
rubygems
dm-mysql-adapter
[1.0.0,1.0.3)
gem
rubygems
dm-postgres-adapter
[0,1.0.0]
gem
de.saumya.mojo
gem-maven-plugin
${jruby.plugins.version}
true
org.eclipse.m2e
lifecycle-mapping
1.0.0
de.saumya.mojo
bundler-maven-plugin
[0,)
install
de.saumya.mojo
gem-maven-plugin
[0,)
initialize
test
rubygems
ixtlan-core
[0,)
gem
production
rubygems
ixtlan-core
[0,)
gem
rubygems
dm-mysql-adapter
[1.0.0,1.0.3)
gem
rubygems
dm-postgres-adapter
[0,1.0.0]
gem
development
rubygems
dm-sqlite-adapter
[1.0.0,1.0.99999]
gem
executable
de.saumya.mojo
gem-assembly-descriptors
${jruby.plugins.version}
jar
runtime
maven-assembly-plugin
_assembly.version_
jar-with-dependencies-and-gems
de.saumya.mojo.assembly.Main
in_phase_package
package
assembly
de.saumya.mojo
gem-assembly-descriptors
${jruby.plugins.version}
jar
XML
end
it 'should load Gemfile with grouped gems and lock file"' do
pending "hash is differently orderd in ruby1.8" if RUBY_VERSION =~ /^1.8/ && !defined? JRUBY_VERSION
@project.load_gemfile(File.join(File.dirname(__FILE__), 'Gemfile.lockfile'))
@project.name "test"
@project.to_xml.should == <<-XML
4.0.0
rubygems
test
0.0.0
gem
rubygems
ixtlan-core
gem
rubygems
slf4r
gem
rubygems
dm-sqlite-adapter
gem
rubygems
dm-do-adapter
gem
rubygems
data_objects
gem
rubygems
addressable
gem
rubygems
dm-core
gem
rubygems
extlib
gem
rubygems
do_sqlite3
gem
rubygems
do_jdbc
gem
rubygems
jdbc-sqlite3
gem
rubygems
addressable
2.2.4
gem
rubygems
data_objects
0.10.3
gem
rubygems
dm-core
1.0.2
gem
rubygems
extlib
0.9.15
gem
rubygems
dm-do-adapter
1.0.2
gem
rubygems
dm-mysql-adapter
1.0.2
gem
rubygems
do_mysql
0.10.3
gem
rubygems
do_jdbc
0.10.3
gem
rubygems
jdbc-mysql
5.0.4
gem
rubygems
dm-postgres-adapter
1.0.0
gem
rubygems
do_postgres
0.10.3
gem
rubygems
jdbc-postgres
8.4.702
gem
rubygems
dm-sqlite-adapter
1.0.2
gem
rubygems
do_sqlite3
0.10.3
gem
rubygems
jdbc-sqlite3
3.6.14.2.056
gem
rubygems
ixtlan-core
0.1.1
gem
rubygems
slf4r
0.4.2
gem
de.saumya.mojo
bundler-maven-plugin
production
rubygems
dm-mysql-adapter
gem
rubygems
do_mysql
gem
rubygems
jdbc-mysql
gem
rubygems
dm-postgres-adapter
gem
rubygems
do_postgres
gem
rubygems
jdbc-postgres
gem
XML
end
end
describe "gemspec" do
it 'should load minimal gemspec' do
@project.load_gemspec(File.join(File.dirname(__FILE__), 'minimal.gemspec'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
minimal
1.0.0
gem
de.saumya.mojo
gem-maven-plugin
rspec/maven/tools/minimal.gemspec
XML
end
it 'should load gemspec without dependencies' do
@project.load_gemspec(File.join(File.dirname(__FILE__), 'no-deps.gemspec'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
no-deps
1.0.0
gem
http://example.com
k_at_example_dot_com
Krysh Sample
k@example.com
Me_And_The_Corner
Me And The Corner
AGPL
./AGPL.txt
repo
de.saumya.mojo
gem-maven-plugin
rspec/maven/tools/no-deps.gemspec
my
myexe
test/first_test.rb
README.txt
--main,README.txt
mylib
myproject
mybin
hello
myext
java
AGPL.txt,README.txt,test/first_test.rb,mybin/hello,myext,lib/first.rb,spec/first_spec.rb,features/first.feature
installed java
XML
end
it 'should load gemspec with dependencies' do
@project.load_gemspec(File.join(File.dirname(__FILE__), 'deps.gemspec'))
@project.to_xml.should == <<-XML
4.0.0
rubygems
deps
1.0.0
gem
rubygems
slf4r
(0.4.0,)
gem
compile
rubygems
rspec
[2.4.0,2.4.99999]
gem
test
rubygems
cucumber
[0.10.0,0.11.1)
gem
test
de.saumya.mojo
gem-maven-plugin
rspec/maven/tools/deps.gemspec
XML
end
it 'should load minimal gemspec with applied defaults' do
@project.load_gemspec(File.join(File.dirname(__FILE__), 'minimal.gemspec'))
@project.add_defaults
@project.to_xml.should == <<-XML
4.0.0
rubygems
minimal
1.0.0
gem
rubygems-releases
http://rubygems-proxy.torquebox.org/releases
rubygems-releases
http://rubygems-proxy.torquebox.org/releases
UTF-8
${project.build.directory}/rubygems
${project.build.directory}/rubygems
_project.version_
de.saumya.mojo
gem-maven-plugin
${jruby.plugins.version}
true
rspec/maven/tools/minimal.gemspec
rubygems
jruby-openssl
[0,)
gem
org.eclipse.m2e
lifecycle-mapping
1.0.0
de.saumya.mojo
gem-maven-plugin
[0,)
initialize
executable
de.saumya.mojo
gem-assembly-descriptors
${jruby.plugins.version}
jar
runtime
maven-assembly-plugin
_assembly.version_
jar-with-dependencies-and-gems
de.saumya.mojo.assembly.Main
in_phase_package
package
assembly
de.saumya.mojo
gem-assembly-descriptors
${jruby.plugins.version}
jar
XML
end
end
end