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.
- checksums.yaml +4 -4
- data/lib/stocker.rb +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e69deb8fecd1264f0e87d6771fa6f523090dcff6
|
4
|
+
data.tar.gz: b2f11a35556495b07c4dbd266c01318db7089c94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80f238bc543d1d5bd8365d26336887772bcccac83c81f9a593a9a062526c519a72f39392c0b033d13f470d3a8f5b41d70366b3162c05476f5cc2567a2bb1513a
|
7
|
+
data.tar.gz: f83518d0fc073719113b7f58a3083972f0238b1ba007c6dcbc1dd4c65355a25c53d8afbf60f0568161cc4e4abaf511b76f28a65ad393e1abce13ba210e903c11
|
data/lib/stocker.rb
CHANGED
@@ -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"]
|
60
|
+
if value["total"] < value["min"]
|
60
61
|
puts "You're running low on #{key}!"
|
61
|
-
|
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
|