stocker 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stocker.rb +7 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91073f0183eae3aa6e8f8898e489e81a2c9bbdc8
4
- data.tar.gz: 32bfe4acd716f81e268c4371fb168243d74ba4cf
3
+ metadata.gz: e69deb8fecd1264f0e87d6771fa6f523090dcff6
4
+ data.tar.gz: b2f11a35556495b07c4dbd266c01318db7089c94
5
5
  SHA512:
6
- metadata.gz: 2f7b94bbee1bd040cac593ef2ae203071f72a1064773fa63d4fbd783775485d053104671ead7a15d801a3db13da4a0a034e14f67c49b92ba75f4e4827803df8a
7
- data.tar.gz: c7ceecd99192eb20328a3bd3d879a2f96ae9a5591a2414512aa13cb56016c6c2478a711050dc27d2cffeb391e7478fc4e159543b55fa98309efe407343b6546f
6
+ metadata.gz: 80f238bc543d1d5bd8365d26336887772bcccac83c81f9a593a9a062526c519a72f39392c0b033d13f470d3a8f5b41d70366b3162c05476f5cc2567a2bb1513a
7
+ data.tar.gz: f83518d0fc073719113b7f58a3083972f0238b1ba007c6dcbc1dd4c65355a25c53d8afbf60f0568161cc4e4abaf511b76f28a65ad393e1abce13ba210e903c11
@@ -20,12 +20,12 @@ module Stocker
20
20
  home_path = Pathname.new(home)
21
21
  db_path = Pathname.new(db)
22
22
  @@path = db_path || home_path
23
+ %x{mv #{@@path}/.stocker.yml #{@@path}.stocker.yaml} if File.exist?("#{@@path}/.stocker.yml")
23
24
  end
24
25
 
25
26
  public
26
27
 
27
28
  check_for_dropbox
28
- #TODO: mv .stocker.yml .stocker.yaml if .stocker.yml exists
29
29
  @@yaml = Pathname.new("#{@@path}/.stocker.yaml")
30
30
  `touch #{@@yaml}`
31
31
  @@stock = YAML.load(@@yaml.read)
@@ -54,13 +54,16 @@ module Stocker
54
54
 
55
55
  desc "check", "Check for low stock items."
56
56
  def check
57
+ links = []
57
58
  @@stock.each do |key, value|
58
59
  value["checked"] = Time.now
59
- if value["total"] <= value["min"]
60
+ if value["total"] < value["min"]
60
61
  puts "You're running low on #{key}!"
61
- buy(key)
62
+ links << key
62
63
  end
63
64
  end
65
+ links.uniq!
66
+ links.each { |link| buy(link)}
64
67
  end
65
68
 
66
69
  desc "total ITEM TOTAL", "Set TOTAL of ITEM."
@@ -160,4 +163,4 @@ module Stocker
160
163
  end
161
164
  end
162
165
  end
163
- end
166
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Pittman