shiftzilla 0.2.19 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/shiftzilla +7 -7
- data/lib/shiftzilla/engine.rb +0 -1
- data/lib/shiftzilla/source.rb +8 -7
- data/lib/shiftzilla/version.rb +1 -1
- data/shiftzilla.gemspec +1 -1
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b70c6e87cb9017c6d7d978e11e8bc4c4ab1e363c20b44ca6ec3aca6c71c971e0
|
4
|
+
data.tar.gz: d7b4f410f27e5a63e941c295e2b493ccae41928593286bc2dfbd68dc6497334a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f717332b7b3835943abdb63fb206bb2766d5b3658a86948058ae34f9da189543e21d04f2711a5305f25d9682701da0e9cd6763768a20a094f01a77e6cf9ae49
|
7
|
+
data.tar.gz: bf2cab87b689a2f626739622c5f78da03d1786d05e7520f3f0743cdef8110273ddf6f61eb951efbce5f125447076909653a70ce4c4a3420554a54691d261522e
|
data/bin/shiftzilla
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require 'shiftzilla/engine'
|
4
4
|
require 'shiftzilla/helpers'
|
5
5
|
require 'shiftzilla/version'
|
6
|
-
require '
|
6
|
+
require 'optimist'
|
7
7
|
|
8
8
|
include Shiftzilla::Engine
|
9
9
|
include Shiftzilla::Helpers
|
10
10
|
|
11
11
|
SUB_COMMANDS = %w{help version load build purge triage}
|
12
|
-
|
12
|
+
Optimist::options do
|
13
13
|
version Shiftzilla::VERSION
|
14
14
|
banner <<-EOF
|
15
15
|
Usage:
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
cmd = ARGV.shift
|
34
34
|
cmd_opts = case cmd
|
35
35
|
when 'load'
|
36
|
-
|
36
|
+
Optimist::options do
|
37
37
|
banner <<-EOF
|
38
38
|
Usage:
|
39
39
|
#$0 load <options>
|
@@ -49,7 +49,7 @@ EOF
|
|
49
49
|
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
50
50
|
end
|
51
51
|
when 'build'
|
52
|
-
|
52
|
+
Optimist::options do
|
53
53
|
banner <<-EOF
|
54
54
|
Usage:
|
55
55
|
#$0 build <options>
|
@@ -65,7 +65,7 @@ EOF
|
|
65
65
|
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
66
66
|
end
|
67
67
|
when 'purge'
|
68
|
-
|
68
|
+
Optimist::options do
|
69
69
|
banner <<-EOF
|
70
70
|
Usage:
|
71
71
|
#$0 purge <options>
|
@@ -78,7 +78,7 @@ EOF
|
|
78
78
|
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
79
79
|
end
|
80
80
|
when 'triage'
|
81
|
-
|
81
|
+
Optimist::options do
|
82
82
|
banner <<-EOF
|
83
83
|
Usage:
|
84
84
|
#$0 triage <options>
|
@@ -92,7 +92,7 @@ EOF
|
|
92
92
|
opt :configdir, "Specify a config directory for shiftzilla to use.", :default => DEFAULT_DIR
|
93
93
|
end
|
94
94
|
when 'help'
|
95
|
-
|
95
|
+
Optimist::educate
|
96
96
|
when 'version'
|
97
97
|
puts Shiftzilla::VERSION
|
98
98
|
exit 0
|
data/lib/shiftzilla/engine.rb
CHANGED
data/lib/shiftzilla/source.rb
CHANGED
@@ -15,7 +15,7 @@ module Shiftzilla
|
|
15
15
|
|
16
16
|
def has_records_for_today?
|
17
17
|
count = 0
|
18
|
-
dbh.execute("SELECT count(*) FROM #{@table} WHERE Snapshot = date('now')") do |row|
|
18
|
+
dbh.execute("SELECT count(*) FROM #{@table} WHERE Snapshot = date('now','localtime')") do |row|
|
19
19
|
count = row[0].to_i
|
20
20
|
end
|
21
21
|
return count > 0
|
@@ -25,13 +25,14 @@ module Shiftzilla
|
|
25
25
|
output_format = @fields.map{ |fld| "%{#{fld.to_s}}" }.join("\x1F")
|
26
26
|
table_fields = @fields.map{ |fld| "\"#{field_map[fld]}\"" }.join(',')
|
27
27
|
insert_frame = @fields.map{ |fld| '?' }.join(', ')
|
28
|
-
bz_command = "bugzilla query --savedsearch #{@search} --savedsearch-sharer-id=#{@sharer} --outputformat='#{output_format}'"
|
28
|
+
bz_command = "bugzilla query --savedsearch #{@search} --savedsearch-sharer-id=#{@sharer} --outputformat='#{output_format}||EOR'"
|
29
29
|
bz_csv = `#{bz_command}`
|
30
30
|
retrieved = []
|
31
|
-
bz_csv.split("\n").each do |row|
|
32
|
-
values = row.split("\x1F")
|
31
|
+
bz_csv.split("||EOR\n").each do |row|
|
32
|
+
values = row.split("\x1F").map{ |v| v.strip }
|
33
|
+
next unless values.length > 0
|
33
34
|
if not @external_bugs_idx.nil?
|
34
|
-
if not @external_sub.nil? and values[@external_bugs_idx].include?(@external_sub)
|
35
|
+
if not @external_sub.nil? and not values[@external_bugs_idx].nil? and values[@external_bugs_idx].include?(@external_sub)
|
35
36
|
values[@external_bugs_idx] = 1
|
36
37
|
else
|
37
38
|
values[@external_bugs_idx] = 0
|
@@ -51,14 +52,14 @@ module Shiftzilla
|
|
51
52
|
retrieved.each do |values|
|
52
53
|
dbh.execute("INSERT INTO #{@table} (#{table_fields}) VALUES (#{insert_frame})", values)
|
53
54
|
end
|
54
|
-
dbh.execute("UPDATE #{@table} SET Snapshot = date('now') WHERE Snapshot ISNULL")
|
55
|
+
dbh.execute("UPDATE #{@table} SET Snapshot = date('now','localtime') WHERE Snapshot ISNULL")
|
55
56
|
dbh.commit
|
56
57
|
end
|
57
58
|
return retrieved.length
|
58
59
|
end
|
59
60
|
|
60
61
|
def purge_records
|
61
|
-
dbh.execute("DELETE FROM #{@table} WHERE Snapshot == date('now') OR Snapshot ISNULL")
|
62
|
+
dbh.execute("DELETE FROM #{@table} WHERE Snapshot == date('now','localtime') OR Snapshot ISNULL")
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
data/lib/shiftzilla/version.rb
CHANGED
data/shiftzilla.gemspec
CHANGED
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'json', '~> 2.1'
|
27
27
|
spec.add_dependency 'sqlite3', '~> 1.3', '>= 1.3.13'
|
28
28
|
spec.add_dependency 'terminal-table', '~> 1.8'
|
29
|
-
spec.add_dependency '
|
29
|
+
spec.add_dependency 'optimist', '~> 3.0'
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiftzilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- N. Harrison Ripps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,25 +139,19 @@ dependencies:
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '1.8'
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
|
-
name:
|
142
|
+
name: optimist
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
145
|
- - "~>"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: '
|
148
|
-
- - ">="
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: 2.1.2
|
147
|
+
version: '3.0'
|
151
148
|
type: :runtime
|
152
149
|
prerelease: false
|
153
150
|
version_requirements: !ruby/object:Gem::Requirement
|
154
151
|
requirements:
|
155
152
|
- - "~>"
|
156
153
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
158
|
-
- - ">="
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: 2.1.2
|
154
|
+
version: '3.0'
|
161
155
|
description: Shiftzilla is a tool for providing historical reports based on Bugzilla
|
162
156
|
data
|
163
157
|
email:
|