lock_jar 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/lib/lock_jar/dsl.rb CHANGED
@@ -21,6 +21,7 @@ module LockJar
21
21
  attr_reader :local_repository
22
22
  attr_reader :scopes
23
23
  attr_reader :maps
24
+ attr_reader :excludes
24
25
 
25
26
  class << self
26
27
 
@@ -63,6 +64,11 @@ module LockJar
63
64
 
64
65
  @local_repository = nil
65
66
  @maps = {}
67
+ @excludes = []
68
+ end
69
+
70
+ def exclude(*notations)
71
+ @excludes += notations
66
72
  end
67
73
 
68
74
  def jar(notation, *args)
@@ -94,6 +100,10 @@ module LockJar
94
100
  end
95
101
  end
96
102
 
103
+ dsl.excludes.each do |exclude|
104
+ @excludes << exclude
105
+ end
106
+
97
107
  self
98
108
  end
99
109
 
@@ -58,20 +58,44 @@ module LockJar
58
58
 
59
59
  unless lock_jar_file.local_repository.nil?
60
60
  lock_data['local_repository'] = lock_jar_file.local_repository
61
+
62
+ if needs_force_encoding
63
+ lock_data['local_repository'] = lock_data['local_repository'].force_encoding("UTF-8")
64
+ end
61
65
  end
62
66
 
63
67
  if lock_jar_file.repositories.size > 0
64
68
  lock_data['repositories'] = lock_jar_file.repositories
69
+
70
+ if needs_force_encoding
71
+ lock_data['repositories'].map { |repo| repo.force_encoding("UTF-8") }
72
+ end
65
73
  end
66
74
 
67
75
  if lock_jar_file.maps.size > 0
68
76
  lock_data['maps'] = lock_jar_file.maps
77
+
78
+ #if needs_force_encoding
79
+ # lock_data['maps'].map { |maps| maps.map { |map| map.force_encoding("UTF-8") } }
80
+ #end
81
+ end
82
+
83
+ if lock_jar_file.excludes.size > 0
84
+ lock_data['excludes'] = lock_jar_file.excludes
85
+
86
+ if needs_force_encoding
87
+ lock_data['excludes'].map { |exclude| exclude.force_encoding("UTF-8") }
88
+ end
69
89
  end
70
90
 
71
91
  lock_data['scopes'] = {}
72
92
 
73
93
  lock_jar_file.notations.each do |scope, notations|
74
94
 
95
+ if needs_force_encoding
96
+ notations.map { |notation| notation.force_encoding("UTF-8") }
97
+ end
98
+
75
99
  dependencies = []
76
100
  notations.each do |notation|
77
101
  dependencies << {notation => scope}
@@ -80,6 +104,12 @@ module LockJar
80
104
  if dependencies.size > 0
81
105
  resolved_notations = resolver(opts).resolve( dependencies )
82
106
 
107
+ if lock_data['excludes']
108
+ lock_data['excludes'].each do |exclude|
109
+ resolved_notations.delete_if { |dep| dep =~ /#{exclude}/ }
110
+ end
111
+ end
112
+
83
113
  lock_data['scopes'][scope] = {
84
114
  'dependencies' => notations,
85
115
  'resolved_dependencies' => resolved_notations }
@@ -190,5 +220,11 @@ module LockJar
190
220
 
191
221
  dependencies
192
222
  end
223
+
224
+ private
225
+ def needs_force_encoding
226
+ @needs_force_encoding || @needs_force_encoding = RUBY_VERSION =~ /^1.9/
227
+ end
193
228
  end
229
+
194
230
  end
data/lock_jar.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lock_jar"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Guymon"]
12
- s.date = "2012-05-09"
12
+ s.date = "2012-05-10"
13
13
  s.description = "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile\n is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test.\n The Jarfile.lock can be used to populate the classpath"
14
14
  s.email = "michael.guymon@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -28,6 +28,23 @@ describe LockJar do
28
28
  "compile"=>{
29
29
  "dependencies"=>["junit:junit:4.10"], "resolved_dependencies"=>["junit:junit:jar:4.10", "org.hamcrest:hamcrest-core:jar:1.1"]}}} )
30
30
  end
31
+
32
+ it "should exclude excludes from dependencies" do
33
+ dsl = LockJar::Dsl.evaluate do
34
+ exclude 'commons-logging', 'logkit'
35
+ jar 'opensymphony:oscache:jar:2.4.1'
36
+ end
37
+
38
+ LockJar.lock( dsl, :local_repo => 'tmp/test-repo', :lockfile => 'tmp/Jarfile.lock' )
39
+ lockfile = LockJar.read('tmp/Jarfile.lock')
40
+ lockfile.should eql( {
41
+ "excludes"=>["commons-logging", "logkit"],
42
+ "scopes"=>{
43
+ "compile"=>{
44
+ "dependencies"=>["opensymphony:oscache:jar:2.4.1"],
45
+ "resolved_dependencies"=>["opensymphony:oscache:jar:2.4.1", "log4j:log4j:jar:1.2.12", "avalon-framework:avalon-framework:jar:4.1.3", "javax.jms:jms:jar:1.1", "javax.servlet:servlet-api:jar:2.3"]}}} )
46
+
47
+ end
31
48
  end
32
49
 
33
50
  context "list" do
metadata CHANGED
@@ -1,99 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lock_jar
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Guymon
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-05-09 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-05-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: naether
16
+ requirement: !ruby/object:Gem::Requirement
22
17
  none: false
23
- requirements:
18
+ requirements:
24
19
  - - ~>
25
- - !ruby/object:Gem::Version
26
- hash: 3
27
- segments:
28
- - 0
29
- - 7
30
- - 0
20
+ - !ruby/object:Gem::Version
31
21
  version: 0.7.0
32
- version_requirements: *id001
33
- name: naether
34
- prerelease: false
35
22
  type: :runtime
36
- - !ruby/object:Gem::Dependency
37
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
38
25
  none: false
39
- requirements:
26
+ requirements:
40
27
  - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 43
43
- segments:
44
- - 2
45
- - 9
46
- - 0
47
- version: 2.9.0
48
- version_requirements: *id002
28
+ - !ruby/object:Gem::Version
29
+ version: 0.7.0
30
+ - !ruby/object:Gem::Dependency
49
31
  name: rspec
50
- prerelease: false
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.9.0
51
38
  type: :development
52
- - !ruby/object:Gem::Dependency
53
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
54
41
  none: false
55
- requirements:
56
- - - ">"
57
- - !ruby/object:Gem::Version
58
- hash: 23
59
- segments:
60
- - 1
61
- - 0
62
- - 0
63
- version: 1.0.0
64
- version_requirements: *id003
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.9.0
46
+ - !ruby/object:Gem::Dependency
65
47
  name: bundler
66
- prerelease: false
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>'
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.0
67
54
  type: :development
68
- - !ruby/object:Gem::Dependency
69
- requirement: &id004 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>'
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
70
65
  none: false
71
- requirements:
66
+ requirements:
72
67
  - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 7
75
- segments:
76
- - 1
77
- - 6
78
- - 4
68
+ - !ruby/object:Gem::Version
79
69
  version: 1.6.4
80
- version_requirements: *id004
81
- name: jeweler
82
- prerelease: false
83
70
  type: :development
84
- description: |-
85
- Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile
86
- is used to generate a Jarfile.lock that contains all the resolved jar dependencies for scopes runtime, compile, and test.
87
- The Jarfile.lock can be used to populate the classpath
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.6.4
78
+ description: ! "Manage Jar files for Ruby. In the spirit of Bundler, a Jarfile\n is
79
+ used to generate a Jarfile.lock that contains all the resolved jar dependencies
80
+ for scopes runtime, compile, and test.\n The Jarfile.lock can be used to populate
81
+ the classpath"
88
82
  email: michael.guymon@gmail.com
89
83
  executables: []
90
-
91
84
  extensions: []
92
-
93
- extra_rdoc_files:
85
+ extra_rdoc_files:
94
86
  - LICENSE
95
87
  - README.rdoc
96
- files:
88
+ files:
97
89
  - Gemfile
98
90
  - LICENSE
99
91
  - README.rdoc
@@ -119,37 +111,31 @@ files:
119
111
  - spec/pom.xml
120
112
  - spec/spec_helper.rb
121
113
  homepage: http://github.com/mguymon/lock_jar
122
- licenses:
114
+ licenses:
123
115
  - Apache
124
116
  post_install_message:
125
117
  rdoc_options: []
126
-
127
- require_paths:
118
+ require_paths:
128
119
  - lib
129
- required_ruby_version: !ruby/object:Gem::Requirement
120
+ required_ruby_version: !ruby/object:Gem::Requirement
130
121
  none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
136
127
  - 0
137
- version: "0"
138
- required_rubygems_version: !ruby/object:Gem::Requirement
128
+ hash: 1069555085123622793
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
130
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- hash: 3
144
- segments:
145
- - 0
146
- version: "0"
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
147
135
  requirements: []
148
-
149
136
  rubyforge_project:
150
137
  rubygems_version: 1.8.24
151
138
  signing_key:
152
139
  specification_version: 3
153
140
  summary: Manage Jar files for Ruby
154
141
  test_files: []
155
-