gry 0.5.0 → 0.5.1
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/gry.rb +1 -0
- data/lib/gry/cli.rb +9 -6
- data/lib/gry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d98ff82687336eb4415781113ec6e57f4dbd0f0
|
4
|
+
data.tar.gz: c60d4f8ba0b5e842f702195a345de65be1bc51ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd0c95889ea318ea84506a05b184214bd2f38b9f0c29b604bcaf2aa8990537701338fed1d9b92b607c33636847046a0c2b3c0ff35275e07ffd3ca5fbc25d0dba
|
7
|
+
data.tar.gz: 972475b1098b2ddc90736dbb9e996f5af913ef7d20adb60744ef840752f5e15fbfb86d0155bcf8fa0d0e699829af28c41b93187f5a2ce4469c1ee419191a72fb
|
data/lib/gry.rb
CHANGED
data/lib/gry/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Gry
|
2
2
|
class CLI
|
3
|
-
|
3
|
+
CACHE_DIR = Pathname(ENV['XDG_CACHE_HOME'] || '~/.cache').expand_path / 'gry'
|
4
4
|
|
5
5
|
def initialize(argv)
|
6
6
|
@argv = argv
|
@@ -40,19 +40,18 @@ module Gry
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def save_cache(bills, cops)
|
43
|
-
cache_dir
|
44
|
-
Dir.mkdir(cache_dir) unless cache_dir.exist?
|
43
|
+
Dir.mkdir(cache_dir) unless CACHE_DIR.exist?
|
45
44
|
cache = {
|
46
45
|
bills: bills,
|
47
46
|
cops: cops,
|
48
47
|
created_at: Time.now,
|
49
48
|
}
|
50
|
-
File.write(
|
49
|
+
File.write(cache_path, Marshal.dump(cache))
|
51
50
|
end
|
52
51
|
|
53
52
|
def restore_cache(cops)
|
54
|
-
return unless
|
55
|
-
cache = Marshal.load(File.read(
|
53
|
+
return unless cache_path.exist?
|
54
|
+
cache = Marshal.load(File.read(cache_path))
|
56
55
|
|
57
56
|
return unless cops == cache[:cops]
|
58
57
|
|
@@ -62,5 +61,9 @@ module Gry
|
|
62
61
|
|
63
62
|
return cache[:bills]
|
64
63
|
end
|
64
|
+
|
65
|
+
def cache_path
|
66
|
+
CACHE_DIR / Digest::SHA1.hexdigest(Dir.pwd)
|
67
|
+
end
|
65
68
|
end
|
66
69
|
end
|
data/lib/gry/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|