tmm1-perftools.rb 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. data/ext/extconf.rb +19 -10
  2. data/perftools.rb.gemspec +1 -1
  3. metadata +1 -1
@@ -2,20 +2,24 @@ require 'mkmf'
2
2
  require 'fileutils'
3
3
  require 'net/http'
4
4
 
5
- # http://google-perftools.googlecode.com/files/google-perftools-1.2.tar.gz
6
- perftools = "google-perftools-1.2.tar.gz"
5
+ url = 'http://google-perftools.googlecode.com/files/google-perftools-1.2.tar.gz'
6
+ perftools = File.basename(url)
7
7
  dir = File.basename(perftools, '.tar.gz')
8
8
 
9
9
  Logging.message "(I'm about to download and compile google-perftools.. this will definitely take a while)"
10
10
 
11
- FileUtils.mkdir("src") unless File.exists?("src")
12
- Dir.chdir("src") do
13
- Net::HTTP.start("google-perftools.googlecode.com") { |http|
14
- resp = http.get("/files/#{perftools}")
15
- open(perftools, "wb") { |file|
16
- file.write(resp.body)
17
- }
18
- } unless File.exists?(perftools)
11
+ FileUtils.mkdir_p('src')
12
+
13
+ Dir.chdir('src') do
14
+ unless File.exists?(perftools)
15
+ Net::HTTP.get_response(URI(url)) do |res|
16
+ File.open(perftools, 'wb') do |out|
17
+ res.read_body do |chunk|
18
+ out.write(chunk)
19
+ end
20
+ end
21
+ end
22
+ end
19
23
 
20
24
  unless File.exists?(dir)
21
25
  xsystem("tar zxvf #{perftools}")
@@ -42,5 +46,10 @@ Dir.chdir("src") do
42
46
  end
43
47
  end
44
48
 
49
+ case RUBY_PLATFORM
50
+ when /darwin/, /linux/
51
+ CONFIG['LDSHARED'] = "$(CXX) " + CONFIG['LDSHARED'].split[1..-1].join(' ')
52
+ end
53
+
45
54
  $libs = append_library($libs, 'profiler')
46
55
  create_makefile 'perftools'
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'perftools.rb'
3
- s.version = '0.1.3'
3
+ s.version = '0.1.4'
4
4
  s.date = '2009-06-01'
5
5
  s.summary = 'google-perftools for ruby code'
6
6
  s.description = 'A sampling profiler for ruby code based on patches to google-perftools'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmm1-perftools.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta