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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecca05f2efb7dc60cd977affe6bfc7e48edb0e515787caabd1b27d911c293193
4
- data.tar.gz: 59c344e58a8e310063df6655cd377bb1a690ac0bd0cd29d61fe55f47dbf8eddb
3
+ metadata.gz: 02b6ae1a43c962225589c9524f4cc76689a9e689aa2918ad389eabff5fa83b74
4
+ data.tar.gz: bb297800cf229f014c589e28dde54b1e8188deee6e75341a899c7a903aa9ffcf
5
5
  SHA512:
6
- metadata.gz: 139a102ddff266faf520ebecc7439e4c6c2a77884d5b83514cd3269aa837146f08bf1538c23b1845f93a541111861b1ce0d38141dac7e80a827208d3e2acb984
7
- data.tar.gz: 8840df886a38558543d2b76a2e179ae6c2cb26d1bdcecc0efaf4e46dba1b1adb5d7d9e11b38037d2157fc897bbe012e51e714b52dd62e9845f5c0bd7b5efcf7f
6
+ metadata.gz: 3c86774cf979c8fd2d7a0986458ee3006ea86b144b6383913fb9eb5b25a86b2a8ce6755cdee61f68cde4f6c0ce0840f22921c4371a199db7f76d33d64529becf
7
+ data.tar.gz: 4aab537430329fcea205cd3eaeea2c3e340e4c4c2e7a693eb92957ea55445778138ff59a63113ebc79983232dac76f061717f479490a6ea5b1d50a1d903f96c5
@@ -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 options[:purge] and retrieved.length > 0
46
- # We know we have new data, so it is okay to nuke the old data
47
- puts "Purging old records"
48
- purge_records
49
- end
50
- puts "Loading new records"
51
- retrieved.each do |values|
52
- dbh.execute("INSERT INTO #{@table} (#{table_fields}) VALUES (#{insert_frame})", values)
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
- dbh.execute("UPDATE #{@table} SET Snapshot = date('now') WHERE Snapshot ISNULL")
55
- return row_count
57
+ return retrieved.length
56
58
  end
57
59
 
58
60
  def purge_records
@@ -1,3 +1,3 @@
1
1
  module Shiftzilla
2
- VERSION = "0.2.12"
2
+ VERSION = "0.2.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiftzilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - N. Harrison Ripps