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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b57a705f8b8c54cbb0b5d9cd86921a8cd9fce4e7
4
- data.tar.gz: a4d7d2e672f212479b4dc80a4786ab16511d598b
3
+ metadata.gz: ae2ee642e11bf966d53ffa6f600688c4e08f7293
4
+ data.tar.gz: 7a4059b0661c2315ceef17505c23f88abf37cdeb
5
5
  SHA512:
6
- metadata.gz: 42a196ee0b5426b43bd50a903009679c74365562969196c426bb51c2451942d7fed355bde303c564d078754517e1ffea6e9f1732d89adab502bb3527e289a831
7
- data.tar.gz: f67e6ff4da041e5e9ce33e687fd1c068a273f1e1197d0e1a13b9c33a91d1b67c21884848f4df0a390519202de1ad6a8ee909bd1f458c9203a4c1d76d668d404a
6
+ metadata.gz: 872ca15d8c207e1bfcdb7f772627a6f71c71ff32e95209624e64d03dc6a94b8f450ffcc4d12a442bcd0e2f0c8a383dc1fde9275b941d06c2a510dfb31d35b542
7
+ data.tar.gz: 4f30fe8cbbe30c7e207a2521e0213307075252abbeacac51b1cb23f4e7cd039710c1695183d16ec9454408fa8fe34f2eeb7ac15e9b9f4304f782bc079b68317d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.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: Time.now.strftime('%Y-%m-%d')
32
+ default: ENV['SOURMIX_DATE'] || ONE_HOUR_AGO
32
33
  option :mixpanel_api_key, \
33
34
  type: :string,
34
35
  aliases: %w[ -k ],
@@ -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 |result|
97
+ results.map do |page|
98
98
  Thread.new do
99
- gzip_result = 'gzip -k %s' % Shellwords.escape(result.path)
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(result.path + '.gz').size
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 |result|
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(result.path),
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
- result.unlink
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sourmix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer