sourmix 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/sourmix/main.rb +2 -1
- data/lib/sourmix/perform.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae2ee642e11bf966d53ffa6f600688c4e08f7293
|
4
|
+
data.tar.gz: 7a4059b0661c2315ceef17505c23f88abf37cdeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 872ca15d8c207e1bfcdb7f772627a6f71c71ff32e95209624e64d03dc6a94b8f450ffcc4d12a442bcd0e2f0c8a383dc1fde9275b941d06c2a510dfb31d35b542
|
7
|
+
data.tar.gz: 4f30fe8cbbe30c7e207a2521e0213307075252abbeacac51b1cb23f4e7cd039710c1695183d16ec9454408fa8fe34f2eeb7ac15e9b9f4304f782bc079b68317d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/sourmix/main.rb
CHANGED
@@ -8,6 +8,7 @@ Thread.abort_on_exception = true
|
|
8
8
|
module SourMix
|
9
9
|
class Main < Mjolnir
|
10
10
|
include Perform
|
11
|
+
ONE_HOUR_AGO = (Time.now - 60 * 60).strftime('%Y-%m-%d')
|
11
12
|
|
12
13
|
|
13
14
|
desc 'version', 'Echo the application version'
|
@@ -28,7 +29,7 @@ module SourMix
|
|
28
29
|
aliases: %w[ -d ],
|
29
30
|
desc: 'Date to index (YYYY-mm-dd)',
|
30
31
|
required: true,
|
31
|
-
default:
|
32
|
+
default: ENV['SOURMIX_DATE'] || ONE_HOUR_AGO
|
32
33
|
option :mixpanel_api_key, \
|
33
34
|
type: :string,
|
34
35
|
aliases: %w[ -k ],
|
data/lib/sourmix/perform.rb
CHANGED
@@ -94,12 +94,12 @@ module SourMix
|
|
94
94
|
log.debug event: :gzip_results
|
95
95
|
started, total_size = Time.now.to_f, 0
|
96
96
|
|
97
|
-
results.map do |
|
97
|
+
results.map do |page|
|
98
98
|
Thread.new do
|
99
|
-
gzip_result = 'gzip -k %s' % Shellwords.escape(
|
99
|
+
gzip_result = 'gzip -k %s' % Shellwords.escape(page.path)
|
100
100
|
_, elapsed_s = timed { sh gzip_result }
|
101
101
|
|
102
|
-
size = File::Stat.new(
|
102
|
+
size = File::Stat.new(page.path + '.gz').size
|
103
103
|
total_size += size
|
104
104
|
|
105
105
|
log.debug event: :gzip_result, exited: $?.exitstatus, elapsed_s: elapsed_s, size: size
|
@@ -122,18 +122,18 @@ module SourMix
|
|
122
122
|
auth_opt = theon_auth.nil? ? nil : '-u %s' % Shellwords.escape(theon_auth)
|
123
123
|
started = Time.now.to_f
|
124
124
|
|
125
|
-
results.map do |
|
125
|
+
results.map do |page|
|
126
126
|
Thread.new do
|
127
127
|
report_result = \
|
128
128
|
'curl %{auth} -Lf %{url} -XPOST %{headers} --data-binary @%{out}.gz' % {
|
129
129
|
auth: auth_opt,
|
130
130
|
url: Shellwords.escape(theon_url),
|
131
|
-
out: Shellwords.escape(
|
131
|
+
out: Shellwords.escape(page.path),
|
132
132
|
headers: "-H 'Content-Encoding: gzip'"
|
133
133
|
}
|
134
134
|
|
135
135
|
_, elapsed_s = timed { sh report_result }
|
136
|
-
|
136
|
+
page.unlink
|
137
137
|
|
138
138
|
log.debug event: :report_result, exited: $?.exitstatus, elapsed_s: elapsed_s
|
139
139
|
end
|
@@ -156,6 +156,7 @@ module SourMix
|
|
156
156
|
end
|
157
157
|
e['@timestamp'] = Time.at(e['time']).utc.iso8601(3)
|
158
158
|
e['@id'] = digest
|
159
|
+
e['type'] = 'mixpanel'
|
159
160
|
e
|
160
161
|
end
|
161
162
|
|