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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd811460917ce36b7a1e5824ba5bea335ccc6dffffc7bd4af12be3c912125aa5
4
- data.tar.gz: 5e6fcc39b88b778229b76a1477a83a2c96f1bd70d795da1d6a31b190276f6b20
3
+ metadata.gz: d3d859cea486eba574649212b623692be5849e755e9203f0f2d5041db37027b8
4
+ data.tar.gz: c9bfb1accde7c51e695f0690642f8c78fca7d78335aae790aec9b00b8a18b409
5
5
  SHA512:
6
- metadata.gz: 0ef98097345bbafb83f37b34b0762b99125df858a051c8b01250cf361b8670292797dd036d1e70b0ca79ba24949661d9685e4fd468349dc9f876a4405c6d6ac7
7
- data.tar.gz: 0c909b09b651bd586fc0bf9029bb10067f19febf7742794768e49bcca5653339b275d732dd28d1b3ee251c86620315bbf5ce002e98e3b01fe0b358f86b84f2c4
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
- chmod 2775 /data/condivisa
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
- store = Config.current_store
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
- puts "Error: No storage store configured. Run 'filedepot setup' to set up."
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Filedepot
4
- VERSION = "0.3.8"
4
+ VERSION = "0.3.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filedepot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filedepot