lock_jar 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +16 -0
- data/.rubocop.yml +28 -0
- data/.travis.yml +12 -1
- data/Gemfile +6 -3
- data/Guardfile +2 -3
- data/README.md +17 -16
- data/Rakefile +11 -7
- data/lib/lock_jar/buildr.rb +95 -89
- data/lib/lock_jar/bundler.rb +85 -84
- data/lib/lock_jar/class_loader.rb +19 -21
- data/lib/lock_jar/cli.rb +32 -25
- data/lib/lock_jar/domain/artifact.rb +39 -45
- data/lib/lock_jar/domain/dsl.rb +50 -79
- data/lib/lock_jar/domain/dsl_merger.rb +76 -0
- data/lib/lock_jar/domain/gem_dsl.rb +10 -12
- data/lib/lock_jar/domain/jarfile_dsl.rb +6 -18
- data/lib/lock_jar/domain/lockfile.rb +17 -24
- data/lib/lock_jar/logging.rb +4 -3
- data/lib/lock_jar/maven.rb +29 -29
- data/lib/lock_jar/registry.rb +52 -60
- data/lib/lock_jar/resolver.rb +17 -20
- data/lib/lock_jar/runtime/install.rb +28 -0
- data/lib/lock_jar/runtime/list.rb +55 -0
- data/lib/lock_jar/runtime/load.rb +54 -0
- data/lib/lock_jar/runtime/lock.rb +152 -0
- data/lib/lock_jar/runtime.rb +30 -302
- data/lib/lock_jar/version.rb +2 -1
- data/lib/lock_jar.rb +137 -105
- data/lock_jar.gemspec +7 -4
- data/spec/fixtures/jarfile_gem/Gemfile +4 -0
- data/spec/fixtures/jarfile_gem/Jarfile +1 -0
- data/spec/fixtures/jarfile_gem/jarfile_gem.gemspec +23 -0
- data/spec/fixtures/jarfile_gem/lib/jarfile_gem/version.rb +3 -0
- data/spec/fixtures/jarfile_gem/lib/jarfile_gem.rb +5 -0
- data/spec/lock_jar/bundler_spec.rb +27 -0
- data/spec/lock_jar/class_loader_spec.rb +34 -36
- data/spec/lock_jar/cli_spec.rb +39 -46
- data/spec/lock_jar/domain/dsl_merger_spec.rb +49 -0
- data/spec/lock_jar/domain/dsl_spec.rb +35 -37
- data/spec/lock_jar/domain/gem_dsl_spec.rb +18 -0
- data/spec/lock_jar/maven_spec.rb +9 -11
- data/spec/lock_jar/resolver_spec.rb +16 -17
- data/spec/lock_jar/runtime_spec.rb +17 -13
- data/spec/lock_jar_spec.rb +255 -195
- data/spec/spec_helper.rb +13 -8
- data/spec/support/helper.rb +13 -5
- data/spec/support/shared_examples/lockfile.rb +4 -6
- metadata +43 -19
- data/bundler/Gemfile +0 -21
- data/bundler/LICENSE.txt +0 -22
- data/bundler/README.md +0 -29
- data/bundler/Rakefile +0 -2
- data/bundler/lib/lock_jar_bundler/bundler.rb +0 -35
- data/bundler/lib/lock_jar_bundler/piggy_back.rb +0 -98
- data/bundler/lib/lock_jar_bundler/version.rb +0 -5
- data/bundler/lib/lock_jar_bundler.rb +0 -5
- data/bundler/lock_jar_bundler.gemspec +0 -24
- data/bundler/spec/Jarfile +0 -3
- data/bundler/spec/dummy_gem/Jarfile +0 -1
- data/bundler/spec/dummy_gem/dummy_gem.gemspec +0 -19
- data/bundler/spec/lock_jar_bundler_spec.rb +0 -49
- data/bundler/spec/spec_helper.rb +0 -88
- data/lib/lock_jar/domain/dsl_helper.rb +0 -84
- data/spec/lock_jar/domain/dsl_helper_spec.rb +0 -52
    
        data/lock_jar.gemspec
    CHANGED
    
    | @@ -9,7 +9,10 @@ Gem::Specification.new do |s| | |
| 9 9 | 
             
              s.version = LockJar::VERSION
         | 
| 10 10 | 
             
              s.authors = ['Michael Guymon']
         | 
| 11 11 | 
             
              s.date = '2014-03-06'
         | 
| 12 | 
            -
              s.description = 'Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile | 
| 12 | 
            +
              s.description = 'Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile
         | 
| 13 | 
            +
            is used to generate a Jarfile.lock that contains all the resolved jar dependencies
         | 
| 14 | 
            +
            for scopes runtime, compile, and test. The Jarfile.lock can be used to populate the
         | 
| 15 | 
            +
            classpath'
         | 
| 13 16 | 
             
              s.email = 'michael@tobedevoured.com'
         | 
| 14 17 | 
             
              s.files         = `git ls-files -z`.split("\x0")
         | 
| 15 18 | 
             
              s.executables   = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| @@ -20,8 +23,8 @@ Gem::Specification.new do |s| | |
| 20 23 | 
             
              s.require_paths = %w(lib)
         | 
| 21 24 | 
             
              s.summary = 'Manage Jar files for Ruby'
         | 
| 22 25 |  | 
| 23 | 
            -
              s.add_dependency( | 
| 24 | 
            -
              s.add_dependency( | 
| 25 | 
            -
             | 
| 26 | 
            +
              s.add_dependency('naether', ['~> 0.15.0'])
         | 
| 27 | 
            +
              s.add_dependency('thor', ['>= 0.18.1'])
         | 
| 28 | 
            +
              s.add_development_dependency('rspec', '~> 2.14.1')
         | 
| 26 29 | 
             
              s.add_development_dependency('rake')
         | 
| 27 30 | 
             
            end
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            jar 'commons-lang:commons-lang:jar:2.4'
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require 'jarfile_gem/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "jarfile_gem"
         | 
| 8 | 
            +
              spec.version       = JarfileGem::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["Michael Guymon"]
         | 
| 10 | 
            +
              spec.email         = ["michael@tobedevoured.com"]
         | 
| 11 | 
            +
              spec.summary       = %q{a short summary.}
         | 
| 12 | 
            +
              spec.description   = %q{a longer description.}
         | 
| 13 | 
            +
              spec.homepage      = ""
         | 
| 14 | 
            +
              spec.license       = "MIT"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.files         = `git ls-files -z`.split("\x0")
         | 
| 17 | 
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 | 
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            +
              spec.require_paths = ["lib"]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              spec.add_development_dependency "bundler", "~> 1.7"
         | 
| 22 | 
            +
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 23 | 
            +
            end
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'lock_jar/bundler'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe LockJar::Bundler do
         | 
| 5 | 
            +
              include Spec::Helpers
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              before do
         | 
| 8 | 
            +
                remove_file('Jarfile.lock')
         | 
| 9 | 
            +
                LockJar::Bundler.lock!('spec/fixtures/Jarfile')
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              describe '.lock!' do
         | 
| 13 | 
            +
                it 'should create Jarfile.lock' do
         | 
| 14 | 
            +
                  expect(File).to exist('Jarfile.lock')
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              describe '.load' do
         | 
| 19 | 
            +
                it 'should load jars' do
         | 
| 20 | 
            +
                  LockJar::Bundler.load('test')
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  expected_jars = %w(junit:junit:jar:4.10 org.hamcrest:hamcrest-core:jar:1.1)
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  expect(LockJar::Registry.instance.loaded_jars).to eql(expected_jars)
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
| @@ -1,56 +1,54 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 | 
             
            require 'lock_jar/class_loader'
         | 
| 3 3 |  | 
| 4 | 
            -
             | 
| 5 | 
            -
            describe LockJar::ClassLoader, "#isolate" do
         | 
| 6 | 
            -
             
         | 
| 4 | 
            +
            describe LockJar::ClassLoader, '#isolate' do
         | 
| 7 5 | 
             
              if Naether.platform != 'java'
         | 
| 8 | 
            -
                pending  | 
| 6 | 
            +
                pending 'need tests for RJB backed classloader'
         | 
| 9 7 | 
             
              else
         | 
| 10 | 
            -
                it  | 
| 11 | 
            -
                  # Generate the IsolateJarfile.lock | 
| 12 | 
            -
                  LockJar.lock( | 
| 13 | 
            -
             | 
| 8 | 
            +
                it 'should create a SimpleEmail' do
         | 
| 9 | 
            +
                  # Generate the IsolateJarfile.lock
         | 
| 10 | 
            +
                  LockJar.lock(lockfile: "#{TEMP_DIR}/IsolateJarfile.lock") do
         | 
| 11 | 
            +
                    jar 'org.apache.commons:commons-email:1.2'
         | 
| 14 12 | 
             
                  end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  email = LockJar::ClassLoader.new( | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 13 | 
            +
             | 
| 14 | 
            +
                  email = LockJar::ClassLoader.new("#{TEMP_DIR}/IsolateJarfile.lock").isolate do
         | 
| 15 | 
            +
                    email = new_instance('org.apache.commons.mail.SimpleEmail')
         | 
| 16 | 
            +
                    email.setSubject('test subject')
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                    email
         | 
| 21 19 | 
             
                  end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                  email.getSubject | 
| 24 | 
            -
             | 
| 20 | 
            +
             | 
| 21 | 
            +
                  email.getSubject.should eql 'test subject'
         | 
| 22 | 
            +
             | 
| 25 23 | 
             
                  unless $CLASSPATH.nil?
         | 
| 26 24 | 
             
                    $CLASSPATH.to_a.join(' ').should_not =~ /commons-email-1\.2\.jar/
         | 
| 27 25 | 
             
                  end
         | 
| 28 | 
            -
             | 
| 26 | 
            +
             | 
| 29 27 | 
             
                  expect { org.apache.commons.mail.SimpleEmail.new }.to raise_error
         | 
| 30 28 | 
             
                end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                it  | 
| 33 | 
            -
                  # Generate the IsolateJarfile.lock | 
| 34 | 
            -
                  LockJar.lock( | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 29 | 
            +
             | 
| 30 | 
            +
                it 'should create a JsonFactory and ObjectMapper' do
         | 
| 31 | 
            +
                  # Generate the IsolateJarfile.lock
         | 
| 32 | 
            +
                  LockJar.lock(lockfile: "#{TEMP_DIR}/IsolateJarfile.lock") do
         | 
| 33 | 
            +
                    jar 'com.fasterxml.jackson.core:jackson-core:2.0.6'
         | 
| 34 | 
            +
                    jar 'com.fasterxml.jackson.core:jackson-databind:2.0.6'
         | 
| 37 35 | 
             
                  end
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                  json = '{ "test1": "1test1", "test2": "2test2"}'
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                  map = LockJar::ClassLoader.new( | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 36 | 
            +
             | 
| 37 | 
            +
                  json = '{ "test1": "1test1", "test2": "2test2" }'
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  map = LockJar::ClassLoader.new("#{TEMP_DIR}/IsolateJarfile.lock").isolate do
         | 
| 40 | 
            +
                    factory = new_instance('com.fasterxml.jackson.core.JsonFactory')
         | 
| 41 | 
            +
                    mapper = new_instance('com.fasterxml.jackson.databind.ObjectMapper', factory)
         | 
| 42 | 
            +
                    mapper.readValue(json, java.util.Map.java_class)
         | 
| 45 43 | 
             
                  end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                  map.get('test1').should eql  | 
| 48 | 
            -
                  map.get('test2').should eql  | 
| 49 | 
            -
             | 
| 44 | 
            +
             | 
| 45 | 
            +
                  map.get('test1').should eql '1test1'
         | 
| 46 | 
            +
                  map.get('test2').should eql '2test2'
         | 
| 47 | 
            +
             | 
| 50 48 | 
             
                  unless $CLASSPATH.nil?
         | 
| 51 49 | 
             
                    $CLASSPATH.to_a.join(' ').should_not =~ /jackson-databind-2\.0\.6\.jar/
         | 
| 52 50 | 
             
                  end
         | 
| 53 | 
            -
             | 
| 51 | 
            +
             | 
| 54 52 | 
             
                  expect { com.fasterxml.jackson.core.JsonFactory.new }.to raise_error
         | 
| 55 53 | 
             
                end
         | 
| 56 54 | 
             
              end
         | 
    
        data/spec/lock_jar/cli_spec.rb
    CHANGED
    
    | @@ -1,69 +1,64 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            describe  | 
| 4 | 
            -
             | 
| 3 | 
            +
            describe 'lockjar' do
         | 
| 5 4 | 
             
              include Spec::Helpers
         | 
| 6 5 |  | 
| 7 | 
            -
              before | 
| 6 | 
            +
              before do
         | 
| 8 7 | 
             
                install_jarfile <<-J
         | 
| 9 | 
            -
            jar  | 
| 8 | 
            +
            jar 'com.google.guava:guava:14.0.1'
         | 
| 10 9 | 
             
            J
         | 
| 11 10 | 
             
              end
         | 
| 12 11 |  | 
| 13 | 
            -
              after | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 12 | 
            +
              after do
         | 
| 13 | 
            +
                remove_file('Jarfile')
         | 
| 14 | 
            +
                remove_file('Jarfile.lock')
         | 
| 16 15 | 
             
              end
         | 
| 17 16 |  | 
| 18 | 
            -
              context  | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                  lockjar "version"
         | 
| 17 | 
            +
              context 'version' do
         | 
| 18 | 
            +
                it 'should return correct version' do
         | 
| 19 | 
            +
                  lockjar 'version'
         | 
| 22 20 | 
             
                  expect(@out).to eq(LockJar::VERSION)
         | 
| 23 21 | 
             
                end
         | 
| 24 22 | 
             
              end
         | 
| 25 23 |  | 
| 26 | 
            -
              context  | 
| 27 | 
            -
                it  | 
| 28 | 
            -
                   | 
| 29 | 
            -
                  lockjar "lock"
         | 
| 24 | 
            +
              context 'lock' do
         | 
| 25 | 
            +
                it 'should create lock file with default path' do
         | 
| 26 | 
            +
                  lockjar 'lock'
         | 
| 30 27 | 
             
                  expect(@out).to match(/^Locking Jarfile to Jarfile.lock.*/)
         | 
| 31 | 
            -
                  expect(File. | 
| 28 | 
            +
                  expect(File).to exist('Jarfile.lock')
         | 
| 32 29 | 
             
                end
         | 
| 33 30 |  | 
| 34 | 
            -
                it  | 
| 35 | 
            -
                  jarfile_path = File.join( | 
| 36 | 
            -
                  jarfile_lock_path = File.join( | 
| 37 | 
            -
                   | 
| 31 | 
            +
                it 'should create lock file with specific path' do
         | 
| 32 | 
            +
                  jarfile_path = File.join('spec', 'support', 'Jarfile')
         | 
| 33 | 
            +
                  jarfile_lock_path = File.join('spec', 'support', 'Jarfile.lock')
         | 
| 34 | 
            +
                  remove_file(jarfile_lock_path)
         | 
| 38 35 |  | 
| 39 36 | 
             
                  lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
         | 
| 40 37 | 
             
                  expect(@out).to eq("Locking #{jarfile_path} to #{jarfile_lock_path}")
         | 
| 41 | 
            -
                  expect(File. | 
| 38 | 
            +
                  expect(File).to exist(jarfile_lock_path)
         | 
| 42 39 | 
             
                end
         | 
| 43 40 | 
             
              end
         | 
| 44 41 |  | 
| 45 | 
            -
              context  | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
                  FileUtils.rm("Jarfile.lock") rescue nil
         | 
| 49 | 
            -
                  lockjar "lock"
         | 
| 42 | 
            +
              context 'list' do
         | 
| 43 | 
            +
                it 'should list with default path' do
         | 
| 44 | 
            +
                  lockjar 'lock'
         | 
| 50 45 |  | 
| 51 | 
            -
            expect_output  | 
| 46 | 
            +
                  expect_output = %(
         | 
| 52 47 | 
             
            Listing Jars from Jarfile.lock for ["default"]
         | 
| 53 48 | 
             
            ["com.google.guava:guava:jar:14.0.1"]
         | 
| 54 | 
            -
             | 
| 49 | 
            +
                  ).strip
         | 
| 55 50 |  | 
| 56 | 
            -
                  lockjar  | 
| 51 | 
            +
                  lockjar 'list'
         | 
| 57 52 | 
             
                  expect(@out).to eq(expect_output)
         | 
| 58 53 | 
             
                end
         | 
| 59 54 |  | 
| 60 | 
            -
                it  | 
| 61 | 
            -
                  jarfile_path = File.join( | 
| 62 | 
            -
                  jarfile_lock_path = File.join( | 
| 63 | 
            -
                   | 
| 55 | 
            +
                it 'should list with specific path' do
         | 
| 56 | 
            +
                  jarfile_path = File.join('spec', 'support', 'Jarfile')
         | 
| 57 | 
            +
                  jarfile_lock_path = File.join('spec', 'support', 'Jarfile.lock')
         | 
| 58 | 
            +
                  remove_file(jarfile_lock_path)
         | 
| 64 59 | 
             
                  lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
         | 
| 65 60 |  | 
| 66 | 
            -
            expect_expr = Regexp.new(<<-'EOM'.strip)
         | 
| 61 | 
            +
                  expect_expr = Regexp.new(<<-'EOM'.strip)
         | 
| 67 62 | 
             
            Listing Jars from .*Jarfile.lock for \["default"\]
         | 
| 68 63 | 
             
            \["com.google.guava:guava:jar:14.0.1"\]
         | 
| 69 64 | 
             
            EOM
         | 
| @@ -73,28 +68,26 @@ EOM | |
| 73 68 | 
             
                end
         | 
| 74 69 | 
             
              end
         | 
| 75 70 |  | 
| 76 | 
            -
              context  | 
| 77 | 
            -
                it  | 
| 78 | 
            -
                   | 
| 79 | 
            -
                  lockjar "lock"
         | 
| 71 | 
            +
              context 'install' do
         | 
| 72 | 
            +
                it 'should install jar archives with default path' do
         | 
| 73 | 
            +
                  lockjar 'lock'
         | 
| 80 74 |  | 
| 81 | 
            -
                  lockjar  | 
| 82 | 
            -
                  expect(@out).to eq( | 
| 75 | 
            +
                  lockjar 'install'
         | 
| 76 | 
            +
                  expect(@out).to eq(%(Installing Jars from Jarfile.lock for ["default"]))
         | 
| 83 77 | 
             
                  LockJar.load
         | 
| 84 78 | 
             
                  expect(Java::ComGoogleCommonCollect::Multimap).to be_kind_of(Module) if is_jruby?
         | 
| 85 79 | 
             
                end
         | 
| 86 80 |  | 
| 87 | 
            -
                it  | 
| 88 | 
            -
                  jarfile_path = File.join( | 
| 89 | 
            -
                  jarfile_lock_path = File.join( | 
| 90 | 
            -
                   | 
| 81 | 
            +
                it 'should install jar archives with specific path' do
         | 
| 82 | 
            +
                  jarfile_path = File.join('spec', 'support', 'Jarfile')
         | 
| 83 | 
            +
                  jarfile_lock_path = File.join('spec', 'support', 'Jarfile.lock')
         | 
| 84 | 
            +
                  remove_file(jarfile_lock_path)
         | 
| 91 85 | 
             
                  lockjar "lock -j #{jarfile_path} -l #{jarfile_lock_path}"
         | 
| 92 86 |  | 
| 93 87 | 
             
                  lockjar "install -l #{jarfile_lock_path}"
         | 
| 94 | 
            -
                  expect(@out).to eq( | 
| 88 | 
            +
                  expect(@out).to eq(%(Installing Jars from #{jarfile_lock_path} for ["default"]))
         | 
| 95 89 | 
             
                  LockJar.load(jarfile_lock_path)
         | 
| 96 90 | 
             
                  expect(Java::ComGoogleCommonCollect::Multimap).to be_kind_of(Module) if is_jruby?
         | 
| 97 91 | 
             
                end
         | 
| 98 92 | 
             
              end
         | 
| 99 | 
            -
             | 
| 100 93 | 
             
            end
         | 
| @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'lock_jar/domain/dsl_merger'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe LockJar::Domain::DslMerger do
         | 
| 6 | 
            +
              it 'should merge dsl' do
         | 
| 7 | 
            +
                block1 = LockJar::Domain::Dsl.create do
         | 
| 8 | 
            +
                  repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  jar 'org.apache.mina:mina-core:2.0.4'
         | 
| 11 | 
            +
                  pom 'spec/pom.xml'
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  group 'runtime' do
         | 
| 14 | 
            +
                    jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  group 'test' do
         | 
| 18 | 
            +
                    jar 'junit:junit:jar:4.10'
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                block2 = LockJar::Domain::Dsl.create do
         | 
| 23 | 
            +
                  repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
         | 
| 24 | 
            +
                  repository 'http://new-repo'
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  jar 'org.apache.mina:mina-core:2.0.4'
         | 
| 27 | 
            +
                  jar 'compile-jar'
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  group 'runtime' do
         | 
| 30 | 
            +
                    jar 'runtime-jar'
         | 
| 31 | 
            +
                    pom 'runtime-pom.xml'
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  group 'test' do
         | 
| 35 | 
            +
                    jar 'test-jar'
         | 
| 36 | 
            +
                    pom 'test-pom.xml'
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                dsl = LockJar::Domain::DslMerger.new(block1, block2).merge
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                expect(dsl.artifacts['default']).to eq([
         | 
| 43 | 
            +
                  LockJar::Domain::Jar.new('org.apache.mina:mina-core:2.0.4'),
         | 
| 44 | 
            +
                  LockJar::Domain::Pom.new('spec/pom.xml', %w(runtime compile)),
         | 
| 45 | 
            +
                  LockJar::Domain::Jar.new('compile-jar')
         | 
| 46 | 
            +
                ])
         | 
| 47 | 
            +
                dsl.remote_repositories.should eql(['http://repository.jboss.org/nexus/content/groups/public-jboss', 'http://new-repo'])
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
            end
         | 
| @@ -2,56 +2,54 @@ require 'spec_helper' | |
| 2 2 | 
             
            require 'lock_jar/domain/artifact'
         | 
| 3 3 |  | 
| 4 4 | 
             
            describe LockJar::Domain::Dsl do
         | 
| 5 | 
            -
               | 
| 6 | 
            -
                it  | 
| 7 | 
            -
                  jarfile = LockJar::Domain::Dsl.create( | 
| 8 | 
            -
             | 
| 5 | 
            +
              describe '.create' do
         | 
| 6 | 
            +
                it 'should load a Jarfile' do
         | 
| 7 | 
            +
                  jarfile = LockJar::Domain::Dsl.create('spec/fixtures/Jarfile')
         | 
| 8 | 
            +
             | 
| 9 9 | 
             
                  jarfile.local_repository.should eql '~/.m2/repository'
         | 
| 10 | 
            -
                  jarfile.artifacts[ | 
| 11 | 
            -
                  jarfile.artifacts[ | 
| 12 | 
            -
                  jarfile.artifacts[ | 
| 13 | 
            -
                  jarfile.artifacts[ | 
| 14 | 
            -
             | 
| 15 | 
            -
                  jarfile.artifacts[ | 
| 16 | 
            -
                  jarfile.artifacts[ | 
| 17 | 
            -
             | 
| 18 | 
            -
                  jarfile.artifacts[ | 
| 19 | 
            -
                  jarfile.artifacts[ | 
| 20 | 
            -
             | 
| 21 | 
            -
                  jarfile.remote_repositories.should eql( | 
| 10 | 
            +
                  expect(jarfile.artifacts['default'][0]).to eq LockJar::Domain::Jar.new('org.apache.mina:mina-core:2.0.4')
         | 
| 11 | 
            +
                  expect(jarfile.artifacts['default'][1]).to eq LockJar::Domain::Local.new('spec/fixtures/naether-0.13.0.jar')
         | 
| 12 | 
            +
                  jarfile.artifacts['default'][2].path.should eql 'spec/pom.xml'
         | 
| 13 | 
            +
                  jarfile.artifacts['default'][3].should be_nil
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  expect(jarfile.artifacts['development'][0]).to eq LockJar::Domain::Jar.new('com.typesafe:config:jar:0.5.0')
         | 
| 16 | 
            +
                  jarfile.artifacts['development'][1].should be_nil
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  expect(jarfile.artifacts['test'][0]).to eq LockJar::Domain::Jar.new('junit:junit:jar:4.10')
         | 
| 19 | 
            +
                  jarfile.artifacts['test'][1].should be_nil
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  jarfile.remote_repositories.should eql(['http://mirrors.ibiblio.org/pub/mirrors/maven2'])
         | 
| 22 22 | 
             
                end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                it  | 
| 25 | 
            -
                  block = LockJar::Domain::Dsl.create | 
| 23 | 
            +
             | 
| 24 | 
            +
                it 'should load a block' do
         | 
| 25 | 
            +
                  block = LockJar::Domain::Dsl.create do
         | 
| 26 26 | 
             
                    local_repo '~/.m2'
         | 
| 27 27 | 
             
                    repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                    jar  | 
| 30 | 
            -
                    local  | 
| 28 | 
            +
             | 
| 29 | 
            +
                    jar 'org.apache.mina:mina-core:2.0.4'
         | 
| 30 | 
            +
                    local 'spec/fixtures/naether-0.13.0.jar'
         | 
| 31 31 | 
             
                    pom 'spec/pom.xml'
         | 
| 32 | 
            -
             | 
| 32 | 
            +
             | 
| 33 33 | 
             
                    group 'pirate' do
         | 
| 34 | 
            -
             | 
| 34 | 
            +
                      jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
         | 
| 35 35 | 
             
                    end
         | 
| 36 | 
            -
             | 
| 36 | 
            +
             | 
| 37 37 | 
             
                    group 'test' do
         | 
| 38 | 
            -
             | 
| 38 | 
            +
                      jar 'junit:junit:jar:4.10'
         | 
| 39 39 | 
             
                    end
         | 
| 40 40 | 
             
                  end
         | 
| 41 | 
            -
             | 
| 41 | 
            +
             | 
| 42 42 | 
             
                  block.local_repository.should eql '~/.m2'
         | 
| 43 | 
            -
                  block.artifacts. | 
| 44 | 
            -
                     | 
| 45 | 
            -
                     | 
| 46 | 
            -
                     | 
| 47 | 
            -
                   | 
| 48 | 
            -
                  block.remote_repositories.should eql( | 
| 49 | 
            -
                      
         | 
| 43 | 
            +
                  expect(block.artifacts).to eq(
         | 
| 44 | 
            +
                    'default' => [LockJar::Domain::Jar.new('org.apache.mina:mina-core:2.0.4'), LockJar::Domain::Local.new('spec/fixtures/naether-0.13.0.jar'), LockJar::Domain::Pom.new('spec/pom.xml')],
         | 
| 45 | 
            +
                    'pirate' => [LockJar::Domain::Jar.new('org.apache.tomcat:servlet-api:jar:6.0.35')],
         | 
| 46 | 
            +
                    'test' => [LockJar::Domain::Jar.new('junit:junit:jar:4.10')]
         | 
| 47 | 
            +
                  )
         | 
| 48 | 
            +
                  block.remote_repositories.should eql(['http://repository.jboss.org/nexus/content/groups/public-jboss'])
         | 
| 50 49 | 
             
                end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                it  | 
| 50 | 
            +
             | 
| 51 | 
            +
                it 'should raise an error without arguments' do
         | 
| 53 52 | 
             
                  lambda { LockJar::Domain::Dsl.create }.should raise_error
         | 
| 54 53 | 
             
                end
         | 
| 55 | 
            -
                
         | 
| 56 54 | 
             
              end
         | 
| 57 55 | 
             
            end
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'lock_jar/domain/gem_dsl'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe LockJar::Domain::GemDsl do
         | 
| 5 | 
            +
              describe '.create' do
         | 
| 6 | 
            +
                let(:spec) do
         | 
| 7 | 
            +
                  double(:spec, gem_dir: 'spec/fixtures', name: 'test')
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                it 'should create from a block' do
         | 
| 11 | 
            +
                  jarfile = LockJar::Domain::GemDsl.create(spec, File.join(spec.gem_dir, 'Jarfile')) do
         | 
| 12 | 
            +
                    pom 'pom.xml'
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  expect(jarfile.gem_dir).to eql 'spec/fixtures'
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
    
        data/spec/lock_jar/maven_spec.rb
    CHANGED
    
    | @@ -8,16 +8,14 @@ describe LockJar::Maven do | |
| 8 8 | 
             
                # Bootstrap Naether
         | 
| 9 9 | 
             
                Naether::Bootstrap.bootstrap_local_repo
         | 
| 10 10 | 
             
              end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
               | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                 | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
                  File.exists?( "#{TEMP_DIR}/test-repo/maven_spec/install/7/install-7.pom" ).should be_true
         | 
| 21 | 
            -
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              it 'should get pom version' do
         | 
| 13 | 
            +
                LockJar::Maven.pom_version('spec/pom.xml').should eql('3')
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              it 'should install artifact' do
         | 
| 17 | 
            +
                LockJar::Maven.install('maven_spec:install:7', 'spec/pom.xml', nil, local_repo: "#{TEMP_DIR}/test-repo")
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                File.exist?("#{TEMP_DIR}/test-repo/maven_spec/install/7/install-7.pom").should be_true
         | 
| 22 20 | 
             
              end
         | 
| 23 21 | 
             
            end
         | 
| @@ -4,23 +4,22 @@ require 'fileutils' | |
| 4 4 | 
             
            require 'naether'
         | 
| 5 5 |  | 
| 6 6 | 
             
            describe LockJar::Resolver do
         | 
| 7 | 
            -
               | 
| 8 | 
            -
                 | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
                   | 
| 17 | 
            -
                    dep.values[0].should match /#{TEMP_DIR}#{File::SEPARATOR}test-repo#{File::SEPARATOR}.+/
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
                end
         | 
| 20 | 
            -
                
         | 
| 21 | 
            -
                it "should return local paths for notations" do
         | 
| 22 | 
            -
                  @resolver.to_local_paths( ["junit:junit:jar:4.10"] ).should 
         | 
| 23 | 
            -
                  eql( [File.expand_path("#{TEMP_DIR}/test-repo/junit/junit/4.10/junit-4.10.jar")] )
         | 
| 7 | 
            +
              before(:each) do
         | 
| 8 | 
            +
                FileUtils.mkdir_p("#{TEMP_DIR}/test-repo")
         | 
| 9 | 
            +
                @resolver = LockJar::Resolver.new(local_repo: "#{TEMP_DIR}/test-repo")
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              it 'should bootstrap naether' do
         | 
| 13 | 
            +
                deps = Naether::Bootstrap.check_local_repo_for_deps("#{TEMP_DIR}/test-repo")
         | 
| 14 | 
            +
                deps[:missing].should eql([])
         | 
| 15 | 
            +
                deps[:exists].each do |dep|
         | 
| 16 | 
            +
                  expect(dep.values[0]).to match(/#{TEMP_DIR}#{File::SEPARATOR}test-repo#{File::SEPARATOR}.+/)
         | 
| 24 17 | 
             
                end
         | 
| 25 18 | 
             
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              it 'should return local paths for notations' do
         | 
| 21 | 
            +
                expect(@resolver.to_local_paths(['junit:junit:jar:4.10'])).to(
         | 
| 22 | 
            +
                  eql([File.expand_path("#{TEMP_DIR}/test-repo/junit/junit/4.10/junit-4.10.jar")])
         | 
| 23 | 
            +
                )
         | 
| 24 | 
            +
              end
         | 
| 26 25 | 
             
            end
         | 
| @@ -2,25 +2,29 @@ require 'spec_helper' | |
| 2 2 | 
             
            require 'lock_jar/runtime'
         | 
| 3 3 |  | 
| 4 4 | 
             
            describe LockJar::Runtime do
         | 
| 5 | 
            -
               | 
| 6 | 
            -
                it  | 
| 7 | 
            -
                  LockJar::Runtime.instance.load( | 
| 5 | 
            +
              describe '#load' do
         | 
| 6 | 
            +
                it 'should set local repo' do
         | 
| 7 | 
            +
                  LockJar::Runtime.instance.load(nil, [], resolve: true, local_repo: TEST_REPO) do
         | 
| 8 8 | 
             
                    jar 'junit:junit:4.10'
         | 
| 9 9 | 
             
                  end
         | 
| 10 | 
            -
             | 
| 10 | 
            +
             | 
| 11 11 | 
             
                  LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql TEST_REPO
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                   | 
| 16 | 
            -
                  
         | 
| 17 | 
            -
                  LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql PARAM_CONFIG
         | 
| 18 | 
            -
                
         | 
| 19 | 
            -
                  LockJar::Runtime.instance.load( nil ) do
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                it 'should use the local repo from the dsl' do
         | 
| 15 | 
            +
                  LockJar::Runtime.instance.load(nil) do
         | 
| 20 16 | 
             
                    local_repo DSL_CONFIG
         | 
| 21 17 | 
             
                  end
         | 
| 22 | 
            -
             | 
| 18 | 
            +
             | 
| 23 19 | 
             
                  LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql DSL_CONFIG
         | 
| 24 20 | 
             
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                it 'should use the local repo from param' do
         | 
| 23 | 
            +
                  LockJar::Runtime.instance.load(nil, [], local_repo: PARAM_CONFIG) do
         | 
| 24 | 
            +
                    local_repo 'dsl_config'
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  LockJar::Runtime.instance.current_resolver.naether.local_repo_path.should eql PARAM_CONFIG
         | 
| 28 | 
            +
                end
         | 
| 25 29 | 
             
              end
         | 
| 26 30 | 
             
            end
         |