lock_jar 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +16 -0
  3. data/.rubocop.yml +28 -0
  4. data/.travis.yml +12 -1
  5. data/Gemfile +6 -3
  6. data/Guardfile +2 -3
  7. data/README.md +17 -16
  8. data/Rakefile +11 -7
  9. data/lib/lock_jar/buildr.rb +95 -89
  10. data/lib/lock_jar/bundler.rb +85 -84
  11. data/lib/lock_jar/class_loader.rb +19 -21
  12. data/lib/lock_jar/cli.rb +32 -25
  13. data/lib/lock_jar/domain/artifact.rb +39 -45
  14. data/lib/lock_jar/domain/dsl.rb +50 -79
  15. data/lib/lock_jar/domain/dsl_merger.rb +76 -0
  16. data/lib/lock_jar/domain/gem_dsl.rb +10 -12
  17. data/lib/lock_jar/domain/jarfile_dsl.rb +6 -18
  18. data/lib/lock_jar/domain/lockfile.rb +17 -24
  19. data/lib/lock_jar/logging.rb +4 -3
  20. data/lib/lock_jar/maven.rb +29 -29
  21. data/lib/lock_jar/registry.rb +52 -60
  22. data/lib/lock_jar/resolver.rb +17 -20
  23. data/lib/lock_jar/runtime/install.rb +28 -0
  24. data/lib/lock_jar/runtime/list.rb +55 -0
  25. data/lib/lock_jar/runtime/load.rb +54 -0
  26. data/lib/lock_jar/runtime/lock.rb +152 -0
  27. data/lib/lock_jar/runtime.rb +30 -302
  28. data/lib/lock_jar/version.rb +2 -1
  29. data/lib/lock_jar.rb +137 -105
  30. data/lock_jar.gemspec +7 -4
  31. data/spec/fixtures/jarfile_gem/Gemfile +4 -0
  32. data/spec/fixtures/jarfile_gem/Jarfile +1 -0
  33. data/spec/fixtures/jarfile_gem/jarfile_gem.gemspec +23 -0
  34. data/spec/fixtures/jarfile_gem/lib/jarfile_gem/version.rb +3 -0
  35. data/spec/fixtures/jarfile_gem/lib/jarfile_gem.rb +5 -0
  36. data/spec/lock_jar/bundler_spec.rb +27 -0
  37. data/spec/lock_jar/class_loader_spec.rb +34 -36
  38. data/spec/lock_jar/cli_spec.rb +39 -46
  39. data/spec/lock_jar/domain/dsl_merger_spec.rb +49 -0
  40. data/spec/lock_jar/domain/dsl_spec.rb +35 -37
  41. data/spec/lock_jar/domain/gem_dsl_spec.rb +18 -0
  42. data/spec/lock_jar/maven_spec.rb +9 -11
  43. data/spec/lock_jar/resolver_spec.rb +16 -17
  44. data/spec/lock_jar/runtime_spec.rb +17 -13
  45. data/spec/lock_jar_spec.rb +255 -195
  46. data/spec/spec_helper.rb +13 -8
  47. data/spec/support/helper.rb +13 -5
  48. data/spec/support/shared_examples/lockfile.rb +4 -6
  49. metadata +43 -19
  50. data/bundler/Gemfile +0 -21
  51. data/bundler/LICENSE.txt +0 -22
  52. data/bundler/README.md +0 -29
  53. data/bundler/Rakefile +0 -2
  54. data/bundler/lib/lock_jar_bundler/bundler.rb +0 -35
  55. data/bundler/lib/lock_jar_bundler/piggy_back.rb +0 -98
  56. data/bundler/lib/lock_jar_bundler/version.rb +0 -5
  57. data/bundler/lib/lock_jar_bundler.rb +0 -5
  58. data/bundler/lock_jar_bundler.gemspec +0 -24
  59. data/bundler/spec/Jarfile +0 -3
  60. data/bundler/spec/dummy_gem/Jarfile +0 -1
  61. data/bundler/spec/dummy_gem/dummy_gem.gemspec +0 -19
  62. data/bundler/spec/lock_jar_bundler_spec.rb +0 -49
  63. data/bundler/spec/spec_helper.rb +0 -88
  64. data/lib/lock_jar/domain/dsl_helper.rb +0 -84
  65. data/spec/lock_jar/domain/dsl_helper_spec.rb +0 -52
@@ -1,84 +0,0 @@
1
- # Licensed to the Apache Software Foundation (ASF) under one or more
2
- # contributor license agreements. See the NOTICE file distributed with this
3
- # work for additional information regarding copyright ownership. The ASF
4
- # licenses this file to you under the Apache License, Version 2.0 (the
5
- # "License"); you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- # License for the specific language governing permissions and limitations under
14
- # the License.
15
-
16
- module LockJar
17
- module Domain
18
- class DslHelper
19
-
20
- class << self
21
-
22
- #
23
- # Merge LockJar::Domain::Dsl
24
- # @param [LockJar::Domain::Dsl] into_dsl dsl that is merged into
25
- # @param [LockJar::Domain::Dsl] from_dsl dsl that is merged from
26
- # @param [String] into_group force only runtime and default groups to be loaded into this group
27
- # @return [LockJar::Domain::Dsl]
28
- def merge( into_dsl, from_dsl, into_group = nil )
29
- into_dsl.remote_repositories = (into_dsl.remote_repositories + from_dsl.remote_repositories).uniq
30
-
31
- # merge default and runtime group into specific group
32
- if into_group
33
- group_artifacts = into_dsl.artifacts[into_group] || []
34
- defaults = from_dsl.artifacts['default'] || []
35
- runtime = from_dsl.artifacts['runtime'] || []
36
- ( defaults + runtime ).each do |art|
37
- unless group_artifacts.include? art
38
- group_artifacts << art
39
- end
40
- end
41
- into_dsl.artifacts[into_group] = group_artifacts
42
-
43
- # one to one merging of groups
44
- else
45
- from_dsl.artifacts.each do |group, artifacts|
46
- group_artifacts = into_dsl.artifacts[group] || []
47
- artifacts.each do |art|
48
- unless group_artifacts.include? art
49
- group_artifacts << art
50
- end
51
- end
52
- into_dsl.artifacts[group] = group_artifacts
53
- end
54
- end
55
-
56
- from_dsl.maps.each do |artifact,paths|
57
- existing_map = into_dsl.maps[artifact]
58
- if existing_map
59
- into_dsl.maps[artifact] = (existing_map + paths).uniq
60
- else
61
- into_dsl.maps[artifact] = paths
62
- end
63
- end
64
-
65
- from_dsl.excludes.each do |exclude|
66
- unless into_dsl.excludes.include? exclude
67
- into_dsl.excludes << exclude
68
- end
69
- end
70
-
71
- if from_dsl.file_path
72
- into_dsl.merged << from_dsl.file_path
73
- end
74
-
75
- into_dsl
76
- end
77
-
78
- def read_file(file)
79
- File.open(file, "rb") { |f| f.read }
80
- end
81
- end
82
- end
83
- end
84
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'lock_jar/domain/dsl_helper'
4
-
5
- describe LockJar::Domain::DslHelper do
6
-
7
- it "should merge dsl" do
8
- block1 = LockJar::Domain::Dsl.create do
9
- repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
10
-
11
- jar "org.apache.mina:mina-core:2.0.4"
12
- pom 'spec/pom.xml'
13
-
14
- group 'runtime' do
15
- jar 'org.apache.tomcat:servlet-api:jar:6.0.35'
16
- end
17
-
18
- group 'test' do
19
- jar 'junit:junit:jar:4.10'
20
- end
21
- end
22
-
23
- block2 = LockJar::Domain::Dsl.create do
24
- repository 'http://repository.jboss.org/nexus/content/groups/public-jboss'
25
- repository 'http://new-repo'
26
-
27
- jar "org.apache.mina:mina-core:2.0.4"
28
- jar "compile-jar"
29
-
30
- group 'runtime' do
31
- jar 'runtime-jar'
32
- pom 'runtime-pom.xml'
33
- end
34
-
35
- group 'test' do
36
- jar 'test-jar'
37
- pom 'test-pom.xml'
38
- end
39
- end
40
-
41
- dsl = LockJar::Domain::DslHelper.merge( block1, block2 )
42
-
43
- dsl.artifacts['default'].should =~ [LockJar::Domain::Jar.new("org.apache.mina:mina-core:2.0.4"), LockJar::Domain::Pom.new("spec/pom.xml",["runtime", "compile"]), LockJar::Domain::Jar.new("compile-jar")]
44
-
45
- # "runtime" => [LockJar::Domain::Jar.new("org.apache.tomcat:servlet-api:jar:6.0.35"), LockJar::Domain::Jar.new("runtime-jar"), LockJar::Domain::Pom.new("runtime-pom.xml")],
46
- # "test" => [LockJar::Domain::Jar.new("junit:junit:jar:4.10"), LockJar::Domain::Jar.new("test-jar"), LockJar::Domain::Pom.new("test-pom.xml")]
47
-
48
-
49
- dsl.remote_repositories.should eql( ["http://repository.jboss.org/nexus/content/groups/public-jboss", 'http://new-repo'] )
50
-
51
- end
52
- end