gem_lint 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.0.3 (10th December 2010)
2
+ * use pure ruby to unpack gems
3
+
1
4
  v0.0.2 (29th November 2010)
2
5
  * add a --detailed flag to the lint command
3
6
 
@@ -90,10 +90,6 @@ module GemLint
90
90
  @data_path ||= File.join(unpack_path, "data")
91
91
  end
92
92
 
93
- def data_file
94
- @data_file ||= File.join(unpack_path, "data.tar.gz")
95
- end
96
-
97
93
  def metadata_gz_file
98
94
  @metadata_gz_file ||= File.join(unpack_path, "metadata.gz")
99
95
  end
@@ -114,16 +110,19 @@ module GemLint
114
110
  @unpack_path ||= File.join(Dir.tmpdir, rand(100000).to_s)
115
111
  end
116
112
 
117
- # TODO: update this to use native ruby untar
118
113
  def unpack_gem
119
114
  Dir.mkdir(unpack_path)
120
115
  Dir.mkdir(data_path)
121
116
 
122
- `tar -xkC #{unpack_path} -f #{@filename} > /dev/null 2>&1`
123
- `tar -xzkC #{data_path} -f #{data_file} > /dev/null 2>&1`
124
- `gunzip #{metadata_file} > /dev/null 2>&1`
125
-
126
- FileUtils.remove_entry_secure(data_file) if File.file?(data_file)
117
+ format = Gem::Format.from_file_by_path(@filename)
118
+ File.open(metadata_file, "wb") { |out| YAML.dump(format.spec, out) }
119
+ format.file_entries.each do |entry, file_data|
120
+ path = entry['path']
121
+ path = File.expand_path File.join(data_path, path)
122
+ raise "Can't install files there" unless path[0, data_path.size] == data_path
123
+ FileUtils.mkdir_p File.dirname(path)
124
+ File.open(path, "wb") { |out| out.write file_data }
125
+ end
127
126
 
128
127
  true
129
128
  end
data/lib/gem_lint.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # stdlib
4
4
  require 'tmpdir'
5
5
  require 'fileutils'
6
+ require 'rubygems/format'
6
7
 
7
8
  # our own code
8
9
  require 'gem_lint/runner'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_lint
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - James Healy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-29 00:00:00 -08:00
18
+ date: 2010-12-10 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency