standard_path 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/standard_path.rb +19 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ec8d3c8fcc063e727341c00c0528cff401c6f8f0c8c1b200b295a5e8144d70e
4
- data.tar.gz: ef58cf85453846ee77ad014ec77ef2e06c4329f4557592081ab692cf1faddfc3
3
+ metadata.gz: fb25f68c9afbe80376afa4c0aa97b5044812be8fccc689aa22ebbbd9cb17744c
4
+ data.tar.gz: 31bf5bb8ed44a16b4370d6a38e9be7c539105a47356538bc8740b887ac49c774
5
5
  SHA512:
6
- metadata.gz: c6799c4d00cc68f4cb3256cf7800b90b088051867ab1b3a41ee62ca10329f7be20cc9bf3a7292868918b9e950d62eedf0343df0d168856c2f24da1c6c7bd46ea
7
- data.tar.gz: 2e66f7fdcf3f8abb3e66af9a46648a35489072ed075d1e9fc4d74842fe9d40ff187ed3e5359ef7b68d2980ebdb76c970cec15061c743d8617c3740aa97754acd
6
+ metadata.gz: 0ab936cbdedf5fd9684127a3fa8bc5ca21de5bd54d2ff556c8ca8fb8f0fdbb68e5e2dcf44d8ae6531ca42d024e3b38169ff8830d22d2bd33094ef484b08870f6
7
+ data.tar.gz: 9d72136d45a8dbdf1b99a3a2ff774662d2742f31927f6b243fecbfb544484f1b5d6f60b7b2a548aa053678350355aee36902554fb9eb4fce2f83d4815afa0898
data/README.md CHANGED
@@ -18,6 +18,8 @@ StandardPath.app_local_data(my_app)
18
18
 
19
19
  ## APIs
20
20
 
21
+ - `.os`
22
+
21
23
  - `.desktop`
22
24
  - `.documents`
23
25
  - `.downloads`
@@ -29,3 +31,4 @@ StandardPath.app_local_data(my_app)
29
31
  - `.app_local_data(name)`
30
32
  - `.app_config(name)`
31
33
  - `.app_cache(name)`
34
+ - `.app_temp(name)`
data/lib/standard_path.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # File : standard_path.rb
3
3
  # Authors : Aoran Zeng <ccmywish@qq.com>
4
4
  # Created on : <2023-05-19>
5
- # Last modified : <2023-05-19>
5
+ # Last modified : <2023-05-29>
6
6
  #
7
7
  # stardard_path:
8
8
  #
@@ -11,7 +11,7 @@
11
11
 
12
12
  module StandardPath
13
13
 
14
- VERSION = "0.1.0"
14
+ VERSION = "0.1.1"
15
15
 
16
16
  OSes = ['Windows', 'macOS', 'Linux']
17
17
 
@@ -168,4 +168,21 @@ class << StandardPath
168
168
  File.expand_path base
169
169
  end
170
170
 
171
+
172
+ def app_temp(app, os = self.os)
173
+ base = case os
174
+ when 'Windows'
175
+ File.join "~/AppData/Local/Temp", app
176
+ when 'macOS'
177
+ # NOTE: I'm not sure if this dir is the most proper for macOS
178
+ # Please affirm or fix it if you are sure.
179
+ File.join "/tmp", app
180
+ when 'Linux'
181
+ File.join '/tmp', app
182
+ else
183
+ raise NotSupportedOS, "#{self.name} doesn't know about #{__method__} path of '#{os}' you specify"
184
+ end
185
+ File.expand_path base
186
+ end
187
+
171
188
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_path
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aoran Zeng
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-19 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Standard Path for corss-platform gems.
14
14