pangolin 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.4.3
@@ -24,7 +24,7 @@ module Pangolin
24
24
  def initialize( output, files = nil, base_dir = nil )
25
25
  @output = output
26
26
  @base_dir = base_dir
27
- @entries = { } # archive_path => IO
27
+ @entries = { } # archive_path => {String,File}Entry
28
28
  @verbose = false
29
29
  @compression = 1
30
30
 
@@ -99,7 +99,7 @@ module Pangolin
99
99
  raise ArgumentError, "\"#{file_path}\" does not exist"
100
100
  end
101
101
 
102
- @entries[archive_path || file_path] = File.new(file_path)
102
+ @entries[archive_path || file_path] = FileEntry.new(file_path)
103
103
  end
104
104
 
105
105
  # Adds a list of files to the archive, at paths relative to +base_dir+
@@ -112,7 +112,7 @@ module Pangolin
112
112
 
113
113
  # Adds a string to the archive at +archive_path+.
114
114
  def add_blob( str, archive_path )
115
- @entries[archive_path] = StringIO.new(str)
115
+ @entries[archive_path] = StringEntry.new(str)
116
116
  end
117
117
 
118
118
  def remove_entry( archive_path ) # :nodoc:
@@ -151,5 +151,36 @@ module Pangolin
151
151
  path
152
152
  end
153
153
 
154
+ class StringEntry
155
+ def initialize(str)
156
+ @str = str
157
+ end
158
+ def open
159
+ io = StringIO.new(@str)
160
+ if block_given?
161
+ yield io
162
+ else
163
+ io
164
+ end
165
+ end
166
+ def close
167
+ end
168
+ end
169
+
170
+ class FileEntry
171
+ def initialize(path)
172
+ @path = path
173
+ end
174
+ def open(&block)
175
+ if block_given?
176
+ File.open(@path, 'r', &block)
177
+ else
178
+ @io = File.new(@path)
179
+ end
180
+ end
181
+ def close
182
+ @io.close
183
+ end
184
+ end
154
185
  end
155
186
  end
@@ -10,9 +10,11 @@ module Pangolin
10
10
 
11
11
  def create_zipfile # :nodoc:
12
12
  ZipFile.open(@output, ZipFile::CREATE) do |zipfile|
13
- @entries.each do |path, io|
13
+ @entries.each do |path, entry|
14
14
  zipfile.get_output_stream(path) do |f|
15
- f.write(io.read)
15
+ entry.open do |io|
16
+ f.write(io.read)
17
+ end
16
18
  end
17
19
  end
18
20
  end
@@ -17,13 +17,13 @@ module Pangolin
17
17
 
18
18
  zipstream = ZipOutputStream.new(FileOutputStream.new(@output))
19
19
 
20
- @entries.each do |path, io|
20
+ @entries.each do |path, entry|
21
+ io = entry.open
21
22
  while buffer = io.read(buffer_size)
22
23
  zipstream.put_next_entry(ZipEntry.new(path))
23
24
  zipstream.write(buffer.to_java_bytes, 0, buffer.length)
24
25
  zipstream.close_entry
25
26
  end
26
-
27
27
  io.close
28
28
  end
29
29
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pangolin}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Theo Hultberg"]
12
- s.date = %q{2010-05-19}
12
+ s.date = %q{2010-07-31}
13
13
  s.description = %q{Ant is a nice tool for writing Java build scripts, but Rake is nicer. The only thing missing from Rake is a way to run javac and jar, and although it's easy to run these as shell scripts you have to wait for the JVM to start. In combination with JRuby this gem lets you run javac and jar in your Rake scripts without exec'ing.}
14
14
  s.email = %q{theo@iconara.net}
15
15
  s.extensions = ["Rakefile"]
@@ -66,26 +66,26 @@ Gem::Specification.new do |s|
66
66
  s.homepage = %q{http://github.com/iconara/pangolin}
67
67
  s.rdoc_options = ["--charset=UTF-8"]
68
68
  s.require_paths = ["lib"]
69
- s.rubygems_version = %q{1.3.6}
69
+ s.rubygems_version = %q{1.3.7}
70
70
  s.summary = %q{Ruby wrappers for javac and jar that don't just exec}
71
71
  s.test_files = [
72
- "spec/jar_cmd_spec.rb",
72
+ "spec/integration/jar_intg_spec.rb",
73
+ "spec/integration/javac_intg_spec.rb",
74
+ "spec/integration/junit_intg_spec.rb",
75
+ "spec/jar_cmd_spec.rb",
73
76
  "spec/jar_spec.rb",
74
77
  "spec/javac_cmd_spec.rb",
75
78
  "spec/javac_spec.rb",
76
79
  "spec/junit_cmd_spec.rb",
77
80
  "spec/junit_spec.rb",
78
- "spec/spec_helper.rb",
79
- "spec/integration/jar_intg_spec.rb",
80
- "spec/integration/javac_intg_spec.rb",
81
- "spec/integration/junit_intg_spec.rb"
81
+ "spec/spec_helper.rb"
82
82
  ]
83
83
 
84
84
  if s.respond_to? :specification_version then
85
85
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
86
86
  s.specification_version = 3
87
87
 
88
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
88
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
89
89
  s.add_runtime_dependency(%q<rubyzip>, [">= 0.9.1"])
90
90
  s.add_development_dependency(%q<rspec>, [">= 0"])
91
91
  else
metadata CHANGED
@@ -1,140 +1,149 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pangolin
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 9
4
5
  prerelease: false
5
6
  segments:
6
- - 0
7
- - 4
8
- - 2
9
- version: 0.4.2
7
+ - 0
8
+ - 4
9
+ - 3
10
+ version: 0.4.3
10
11
  platform: ruby
11
12
  authors:
12
- - Theo Hultberg
13
+ - Theo Hultberg
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-19 00:00:00 +02:00
18
+ date: 2010-07-31 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rubyzip
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 9
30
- - 1
31
- version: 0.9.1
32
- type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
44
- type: :development
45
- version_requirements: *id002
21
+ - !ruby/object:Gem::Dependency
22
+ name: rubyzip
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 57
30
+ segments:
31
+ - 0
32
+ - 9
33
+ - 1
34
+ version: 0.9.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
46
51
  description: Ant is a nice tool for writing Java build scripts, but Rake is nicer. The only thing missing from Rake is a way to run javac and jar, and although it's easy to run these as shell scripts you have to wait for the JVM to start. In combination with JRuby this gem lets you run javac and jar in your Rake scripts without exec'ing.
47
52
  email: theo@iconara.net
48
53
  executables: []
49
54
 
50
55
  extensions:
51
- - Rakefile
56
+ - Rakefile
52
57
  extra_rdoc_files:
53
- - LICENSE
54
- - README.rdoc
58
+ - LICENSE
59
+ - README.rdoc
55
60
  files:
56
- - LICENSE
57
- - README.rdoc
58
- - Rakefile
59
- - VERSION
60
- - examples/compile/Rakefile
61
- - examples/compile/src/com/example/HelloWorld.java
62
- - examples/errors/Rakefile
63
- - examples/errors/src/com/example/HelloWorld.java
64
- - examples/package/Rakefile
65
- - examples/package/src/com/example/HelloWorld.java
66
- - examples/test/Rakefile
67
- - examples/test/src/com/example/HelloWorld.java
68
- - examples/test/test/com/example/TestHelloWorld.java
69
- - lib/pangolin.rb
70
- - lib/pangolin/common/jar_common.rb
71
- - lib/pangolin/common/javac_common.rb
72
- - lib/pangolin/common/junit_common.rb
73
- - lib/pangolin/exec/jar.rb
74
- - lib/pangolin/exec/javac.rb
75
- - lib/pangolin/exec/junit.rb
76
- - lib/pangolin/java/jar.rb
77
- - lib/pangolin/java/javac.rb
78
- - lib/pangolin/java/junit.rb
79
- - lib/pangolin/output/formatting.rb
80
- - pangolin.gemspec
81
- - spec/integration/data/classes/com/example/HelloWorld.class
82
- - spec/integration/data/sources/com/example/Error.java
83
- - spec/integration/data/sources/com/example/HelloWorld.java
84
- - spec/integration/data/tests/com/example/HelloWorld.class
85
- - spec/integration/data/tests/com/example/TestHelloWorld.class
86
- - spec/integration/jar_intg_spec.rb
87
- - spec/integration/javac_intg_spec.rb
88
- - spec/integration/junit_intg_spec.rb
89
- - spec/jar_cmd_spec.rb
90
- - spec/jar_spec.rb
91
- - spec/javac_cmd_spec.rb
92
- - spec/javac_spec.rb
93
- - spec/junit_cmd_spec.rb
94
- - spec/junit_spec.rb
95
- - spec/spec.opts
96
- - spec/spec_helper.rb
97
- - tasks/gem.rake
98
- - tasks/rdoc.rake
99
- - tasks/spec.rake
61
+ - LICENSE
62
+ - README.rdoc
63
+ - Rakefile
64
+ - VERSION
65
+ - examples/compile/Rakefile
66
+ - examples/compile/src/com/example/HelloWorld.java
67
+ - examples/errors/Rakefile
68
+ - examples/errors/src/com/example/HelloWorld.java
69
+ - examples/package/Rakefile
70
+ - examples/package/src/com/example/HelloWorld.java
71
+ - examples/test/Rakefile
72
+ - examples/test/src/com/example/HelloWorld.java
73
+ - examples/test/test/com/example/TestHelloWorld.java
74
+ - lib/pangolin.rb
75
+ - lib/pangolin/common/jar_common.rb
76
+ - lib/pangolin/common/javac_common.rb
77
+ - lib/pangolin/common/junit_common.rb
78
+ - lib/pangolin/exec/jar.rb
79
+ - lib/pangolin/exec/javac.rb
80
+ - lib/pangolin/exec/junit.rb
81
+ - lib/pangolin/java/jar.rb
82
+ - lib/pangolin/java/javac.rb
83
+ - lib/pangolin/java/junit.rb
84
+ - lib/pangolin/output/formatting.rb
85
+ - pangolin.gemspec
86
+ - spec/integration/data/classes/com/example/HelloWorld.class
87
+ - spec/integration/data/sources/com/example/Error.java
88
+ - spec/integration/data/sources/com/example/HelloWorld.java
89
+ - spec/integration/data/tests/com/example/HelloWorld.class
90
+ - spec/integration/data/tests/com/example/TestHelloWorld.class
91
+ - spec/integration/jar_intg_spec.rb
92
+ - spec/integration/javac_intg_spec.rb
93
+ - spec/integration/junit_intg_spec.rb
94
+ - spec/jar_cmd_spec.rb
95
+ - spec/jar_spec.rb
96
+ - spec/javac_cmd_spec.rb
97
+ - spec/javac_spec.rb
98
+ - spec/junit_cmd_spec.rb
99
+ - spec/junit_spec.rb
100
+ - spec/spec.opts
101
+ - spec/spec_helper.rb
102
+ - tasks/gem.rake
103
+ - tasks/rdoc.rake
104
+ - tasks/spec.rake
100
105
  has_rdoc: true
101
106
  homepage: http://github.com/iconara/pangolin
102
107
  licenses: []
103
108
 
104
109
  post_install_message:
105
110
  rdoc_options:
106
- - --charset=UTF-8
111
+ - --charset=UTF-8
107
112
  require_paths:
108
- - lib
113
+ - lib
109
114
  required_ruby_version: !ruby/object:Gem::Requirement
115
+ none: false
110
116
  requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- segments:
114
- - 0
115
- version: "0"
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
116
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
+ none: false
117
125
  requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- segments:
121
- - 0
122
- version: "0"
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
123
132
  requirements: []
124
133
 
125
134
  rubyforge_project:
126
- rubygems_version: 1.3.6
135
+ rubygems_version: 1.3.7
127
136
  signing_key:
128
137
  specification_version: 3
129
138
  summary: Ruby wrappers for javac and jar that don't just exec
130
139
  test_files:
131
- - spec/jar_cmd_spec.rb
132
- - spec/jar_spec.rb
133
- - spec/javac_cmd_spec.rb
134
- - spec/javac_spec.rb
135
- - spec/junit_cmd_spec.rb
136
- - spec/junit_spec.rb
137
- - spec/spec_helper.rb
138
- - spec/integration/jar_intg_spec.rb
139
- - spec/integration/javac_intg_spec.rb
140
- - spec/integration/junit_intg_spec.rb
140
+ - spec/integration/jar_intg_spec.rb
141
+ - spec/integration/javac_intg_spec.rb
142
+ - spec/integration/junit_intg_spec.rb
143
+ - spec/jar_cmd_spec.rb
144
+ - spec/jar_spec.rb
145
+ - spec/javac_cmd_spec.rb
146
+ - spec/javac_spec.rb
147
+ - spec/junit_cmd_spec.rb
148
+ - spec/junit_spec.rb
149
+ - spec/spec_helper.rb