shiftzilla 0.2.12 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shiftzilla/source.rb +14 -12
- data/lib/shiftzilla/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02b6ae1a43c962225589c9524f4cc76689a9e689aa2918ad389eabff5fa83b74
|
4
|
+
data.tar.gz: bb297800cf229f014c589e28dde54b1e8188deee6e75341a899c7a903aa9ffcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c86774cf979c8fd2d7a0986458ee3006ea86b144b6383913fb9eb5b25a86b2a8ce6755cdee61f68cde4f6c0ce0840f22921c4371a199db7f76d33d64529becf
|
7
|
+
data.tar.gz: 4aab537430329fcea205cd3eaeea2c3e340e4c4c2e7a693eb92957ea55445778138ff59a63113ebc79983232dac76f061717f479490a6ea5b1d50a1d903f96c5
|
data/lib/shiftzilla/source.rb
CHANGED
@@ -27,7 +27,6 @@ module Shiftzilla
|
|
27
27
|
insert_frame = @fields.map{ |fld| '?' }.join(', ')
|
28
28
|
bz_command = "bugzilla query --savedsearch #{@search} --savedsearch-sharer-id=#{@sharer} --outputformat='#{output_format}'"
|
29
29
|
bz_csv = `#{bz_command}`
|
30
|
-
row_count = 0
|
31
30
|
retrieved = []
|
32
31
|
bz_csv.split("\n").each do |row|
|
33
32
|
values = row.split("\x1F")
|
@@ -39,20 +38,23 @@ module Shiftzilla
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
retrieved << values
|
42
|
-
row_count += 1
|
43
41
|
end
|
44
42
|
puts "Retrieved #{retrieved.length} rows"
|
45
|
-
if
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
dbh.
|
43
|
+
if retrieved.length > 0
|
44
|
+
if options[:purge]
|
45
|
+
# We know we have new data, so it is okay to nuke the old data
|
46
|
+
puts "Purging old records"
|
47
|
+
purge_records
|
48
|
+
end
|
49
|
+
puts "Loading new records"
|
50
|
+
dbh.transaction
|
51
|
+
retrieved.each do |values|
|
52
|
+
dbh.execute("INSERT INTO #{@table} (#{table_fields}) VALUES (#{insert_frame})", values)
|
53
|
+
end
|
54
|
+
dbh.execute("UPDATE #{@table} SET Snapshot = date('now') WHERE Snapshot ISNULL")
|
55
|
+
dbh.commit
|
53
56
|
end
|
54
|
-
|
55
|
-
return row_count
|
57
|
+
return retrieved.length
|
56
58
|
end
|
57
59
|
|
58
60
|
def purge_records
|
data/lib/shiftzilla/version.rb
CHANGED