filedepot 0.3.8 → 0.3.9
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/README.md +9 -1
- data/lib/filedepot/cli.rb +12 -2
- data/lib/filedepot/config.rb +8 -0
- data/lib/filedepot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3d859cea486eba574649212b623692be5849e755e9203f0f2d5041db37027b8
|
|
4
|
+
data.tar.gz: c9bfb1accde7c51e695f0690642f8c78fca7d78335aae790aec9b00b8a18b409
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c563cf82cac597b8fff7afba4fbf60f48c31c2adc265006892046ba6a1f3f3626f748322c7937e02f2c145ddc49e178a11266a3524c26dc339054a11e306e999
|
|
7
|
+
data.tar.gz: 73df31f57b95e0ae01f5b2d2b310ba7ee6745dc32ff7456128c6dbfaf464878b294756876ef910eb4f93c47f341d5cfe7337f8b0592dc863387ae2498b0a11cf
|
data/README.md
CHANGED
|
@@ -49,12 +49,20 @@ stores:
|
|
|
49
49
|
|
|
50
50
|
When `default_store` does not match any store name, the first store is used.
|
|
51
51
|
|
|
52
|
+
You can specify a store other than default by passing `--store [name]` for every command except `setup` and `config`.
|
|
53
|
+
|
|
52
54
|
## Permissions
|
|
53
55
|
|
|
54
56
|
On the server, use these commands to set up the folder for filedepot:
|
|
55
57
|
|
|
56
58
|
```bash
|
|
57
|
-
|
|
59
|
+
# set group
|
|
60
|
+
groupadd filedepot
|
|
61
|
+
usermod -aG filedepot user # for evey user you want allow filedepot
|
|
62
|
+
|
|
63
|
+
# set folder
|
|
64
|
+
mkdir -p /data/filedepot
|
|
65
|
+
chmod 2775 /data/filedepot
|
|
58
66
|
setfacl -d -m g:filedepot:rwx /data/filedepot
|
|
59
67
|
```
|
|
60
68
|
|
data/lib/filedepot/cli.rb
CHANGED
|
@@ -7,6 +7,8 @@ module Filedepot
|
|
|
7
7
|
class CLI < Thor
|
|
8
8
|
package_name "filedepot"
|
|
9
9
|
|
|
10
|
+
class_option :store, type: :string, desc: "Use this store instead of default"
|
|
11
|
+
|
|
10
12
|
COMMAND_HELP = {
|
|
11
13
|
config: <<~HELP,
|
|
12
14
|
Usage:
|
|
@@ -429,6 +431,8 @@ module Filedepot
|
|
|
429
431
|
puts "#{store.to_yaml}"
|
|
430
432
|
end
|
|
431
433
|
puts ""
|
|
434
|
+
puts "You can specify a store other than default by passing --store [name] for every command except setup and config."
|
|
435
|
+
puts ""
|
|
432
436
|
puts "Available commands:"
|
|
433
437
|
puts "filedepot setup Create or reconfigure config"
|
|
434
438
|
puts "filedepot config Open config file using $EDITOR"
|
|
@@ -462,9 +466,15 @@ module Filedepot
|
|
|
462
466
|
end
|
|
463
467
|
|
|
464
468
|
def check_config
|
|
465
|
-
|
|
469
|
+
store_name = options[:store].to_s.strip
|
|
470
|
+
store = if store_name.empty?
|
|
471
|
+
Config.current_store
|
|
472
|
+
else
|
|
473
|
+
Config.store_by_name(store_name)
|
|
474
|
+
end
|
|
466
475
|
if store.nil?
|
|
467
|
-
|
|
476
|
+
msg = store_name.empty? ? "No storage store configured. Run 'filedepot setup' to set up." : "Store '#{store_name}' not found."
|
|
477
|
+
puts "Error: #{msg}"
|
|
468
478
|
return nil
|
|
469
479
|
end
|
|
470
480
|
store
|
data/lib/filedepot/config.rb
CHANGED
|
@@ -30,6 +30,14 @@ module Filedepot
|
|
|
30
30
|
store = stores.find { |s| (s["name"] || s[:name]) == default }
|
|
31
31
|
store || stores.first
|
|
32
32
|
end
|
|
33
|
+
|
|
34
|
+
def store_by_name(name)
|
|
35
|
+
config = load
|
|
36
|
+
return nil if config.nil?
|
|
37
|
+
|
|
38
|
+
stores = config["stores"] || []
|
|
39
|
+
stores.find { |s| (s["name"] || s[:name]) == name }
|
|
40
|
+
end
|
|
33
41
|
end
|
|
34
42
|
end
|
|
35
43
|
end
|
data/lib/filedepot/version.rb
CHANGED