corn 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/corn.rb +21 -4
- data/lib/corn/rack.rb +1 -1
- metadata +16 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5e0101cf31cad4b5ec030daadb7e18bc3b4a52
|
4
|
+
data.tar.gz: d74e50037d0cc22b80c25e0c832bc0132d041a96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b27f66407aaea5d4cc9d5402a10b7653895c4c63b6446b7e775f8ed0abfc9e3cf2b775d84d6085052018ddc4b5e4b297e512b1ca08cd83f680482f266ad04b5
|
7
|
+
data.tar.gz: 54fefb61535630425386803e9645d63dffd6191e9fc3a44563beac9fcb63e6d4d731f4367fdebac3d73550c9718541361c0e9a726d6321e974e1c6e7d0f13a49
|
data/lib/corn.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'sampling_prof'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
require 'net/http/post/multipart'
|
2
5
|
require 'corn/rack'
|
3
6
|
|
4
7
|
module Corn
|
@@ -30,10 +33,7 @@ module Corn
|
|
30
33
|
def submit(name)
|
31
34
|
@prof.stop
|
32
35
|
if configured?
|
33
|
-
|
34
|
-
if $?.exitstatus != 0
|
35
|
-
log("Submit report error: \n#{o}")
|
36
|
-
end
|
36
|
+
upload(@prof.output_file, name)
|
37
37
|
else
|
38
38
|
log("No CORN_CLIENT_ID configured, profiling data is not submitted")
|
39
39
|
end
|
@@ -46,4 +46,21 @@ module Corn
|
|
46
46
|
def log(msg)
|
47
47
|
$stderr.puts msg
|
48
48
|
end
|
49
|
+
|
50
|
+
def upload(file, name)
|
51
|
+
url = URI.parse(submit_url)
|
52
|
+
File.open(file) do |f|
|
53
|
+
req = Net::HTTP::Post::Multipart.new(url.path,
|
54
|
+
"data" => UploadIO.new(f, "text/plain"),
|
55
|
+
'client_id' => client_id,
|
56
|
+
'name' => name)
|
57
|
+
res = Net::HTTP.start(url.host, url.port) do |http|
|
58
|
+
http.use_ssl = url.scheme == 'https'
|
59
|
+
http.request(req)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
rescue => e
|
63
|
+
log("upload #{file} to #{submit_url} failed: #{e.message}")
|
64
|
+
log(e.backtrace.join("\n"))
|
65
|
+
end
|
49
66
|
end
|
data/lib/corn/rack.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xiao Li
|
@@ -9,21 +9,28 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-08 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: multipart-post
|
16
16
|
prerelease: false
|
17
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: "0.1"
|
22
19
|
- - ">="
|
23
20
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
21
|
+
version: "2.0"
|
25
22
|
type: :runtime
|
26
23
|
version_requirements: *id001
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: sampling_prof
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: "0.1"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id002
|
27
34
|
description: |
|
28
35
|
Corn collects your application's profiling data by sampling_prof gem, and submits the result to server, so that you can merge multiple server's profiling data and do analysis together.
|
29
36
|
|
@@ -51,13 +58,13 @@ require_paths:
|
|
51
58
|
- lib
|
52
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
53
60
|
requirements:
|
54
|
-
- &
|
61
|
+
- &id003
|
55
62
|
- ">="
|
56
63
|
- !ruby/object:Gem::Version
|
57
64
|
version: "0"
|
58
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
66
|
requirements:
|
60
|
-
- *
|
67
|
+
- *id003
|
61
68
|
requirements: []
|
62
69
|
|
63
70
|
rubyforge_project:
|