filedepot 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b2297095fcd44cd4bc54bf159dba4db6b67eb01097b81d7b568fbdd09b508394
4
+ data.tar.gz: 5057493bcdc4ad7e83dbd6f6b1469b38b9317003674ecfd291c3c2c3c1e6b243
5
+ SHA512:
6
+ metadata.gz: 0f88deafeeed98b2b9ddcb4b47179b9da164c583f7e1b8690ac92976fd551e475ae73511b66eef239c59e735a31d878c5c074dd2802543503bd8d0dfc1a5b64a
7
+ data.tar.gz: b8b7726ae00b0c3fd64faf4bf97112f6ff8b3183c5c9ea82f8f6a67b95bbdfb51bc776594dd2f5e181e439b3a6fc422c82a6b90dbded855cb2eedd77fd6700b1
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Filedepot
2
+
3
+ Command-line tool to sync files on remote storage via SSH.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ gem install filedepot
9
+ ```
10
+
11
+ Or add to your Gemfile:
12
+
13
+ ```ruby
14
+ gem "filedepot"
15
+ ```
16
+
17
+ ## Configuration
18
+
19
+ Config file: `$HOME/.filedepot/config.yml`
20
+
21
+ On first run, a default config is created:
22
+
23
+ ```yaml
24
+ default_source: test
25
+ sources:
26
+ - name: test
27
+ ssh: ssh
28
+ host: 127.0.0.1
29
+ username:
30
+ base_path: /Users/user/filedepot
31
+ ```
32
+
33
+ ## Commands
34
+
35
+ | Command | Description |
36
+ |---------|-------------|
37
+ | `filedepot` | Show current source and available commands |
38
+ | `filedepot config` | Open config file with $EDITOR |
39
+ | `filedepot push HANDLE` | Send file to current storage |
40
+ | `filedepot pull HANDLE [VERSION]` | Get file from storage |
41
+ | `filedepot versions HANDLE` | List all versions of a handle |
42
+ | `filedepot delete HANDLE [VERSION]` | Delete file(s) after confirmation |
43
+
44
+ ## License
45
+
46
+ MIT
data/bin/filedepot ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "filedepot"
5
+
6
+ # Handle no-args: Thor by default shows help, we want our custom default output
7
+ if ARGV.empty?
8
+ Filedepot::CLI.new.invoke(:default)
9
+ else
10
+ Filedepot::CLI.start(ARGV)
11
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
4
+
5
+ module Filedepot
6
+ class CLI < Thor
7
+ package_name "filedepot"
8
+
9
+ COMMAND_HELP = {
10
+ config: <<~HELP,
11
+ Usage:
12
+ filedepot config
13
+
14
+ Opens the config file ($HOME/.filedepot/config.yml) using $EDITOR.
15
+ HELP
16
+ push: <<~HELP,
17
+ Usage:
18
+ filedepot push HANDLE
19
+
20
+ Send a file with a specific handle to the current storage.
21
+ HELP
22
+ pull: <<~HELP,
23
+ Usage:
24
+ filedepot pull HANDLE [VERSION]
25
+
26
+ Get the latest version of file with a specific handle from the current storage.
27
+ VERSION is optional; if omitted, retrieves the latest version.
28
+ HELP
29
+ versions: <<~HELP,
30
+ Usage:
31
+ filedepot versions HANDLE
32
+
33
+ List all versions of a handle. Each version has an integer ID from 1 to n.
34
+ HELP
35
+ delete: <<~HELP
36
+ Usage:
37
+ filedepot delete HANDLE [VERSION]
38
+
39
+ After confirmation, deletes all versions of a file.
40
+ If VERSION is specified, deletes only that specific version.
41
+ HELP
42
+ }.freeze
43
+
44
+ desc "config", "Open the config file using $EDITOR"
45
+ def config
46
+ config_path = Config::CONFIG_PATH
47
+ Config.ensure_config!
48
+ editor = ENV["EDITOR"] || "vim"
49
+ exec(editor, config_path)
50
+ end
51
+
52
+ desc "push HANDLE", "Send a file with a specific handle to the current storage"
53
+ def push(handle = nil)
54
+ if handle.nil?
55
+ puts COMMAND_HELP[:push]
56
+ return
57
+ end
58
+ puts "push: would send file with handle '#{handle}' to current storage (not implemented)"
59
+ end
60
+
61
+ desc "pull HANDLE [VERSION]", "Get the latest version of file with a specific handle from the current storage"
62
+ def pull(handle = nil, version = nil)
63
+ if handle.nil?
64
+ puts COMMAND_HELP[:pull]
65
+ return
66
+ end
67
+ version_str = version ? " version #{version}" : " latest version"
68
+ puts "pull: would get file '#{handle}'#{version_str} from current storage (not implemented)"
69
+ end
70
+
71
+ desc "versions HANDLE", "List all versions of a handle (each version has an integer from 1 to n)"
72
+ def versions(handle = nil)
73
+ if handle.nil?
74
+ puts COMMAND_HELP[:versions]
75
+ return
76
+ end
77
+ puts "versions: would list all versions of handle '#{handle}' (not implemented)"
78
+ end
79
+
80
+ desc "delete HANDLE [VERSION]", "After confirmation, delete all versions of a file; or only a specific version if specified"
81
+ def delete(handle = nil, version = nil)
82
+ if handle.nil?
83
+ puts COMMAND_HELP[:delete]
84
+ return
85
+ end
86
+ version_str = version ? " version #{version}" : " all versions"
87
+ puts "delete: would delete file '#{handle}'#{version_str} after confirmation (not implemented)"
88
+ end
89
+
90
+ default_task :default
91
+
92
+ desc "default", "Show current source and list of available commands"
93
+ def default
94
+ source = Config.current_source
95
+ config = Config.load
96
+ default_name = config["default_source"]
97
+
98
+ puts "filedepot"
99
+ puts "--------"
100
+ puts "Current source: #{default_name}"
101
+ if source
102
+ puts " Type: #{source['ssh']} (#{source['host']})"
103
+ puts " Base path: #{source['base_path']}"
104
+ end
105
+ puts ""
106
+ puts "Available commands:"
107
+ puts " filedepot config Open config file using $EDITOR"
108
+ puts " filedepot push HANDLE Send file to current storage"
109
+ puts " filedepot pull HANDLE [VER] Get file from storage (version optional)"
110
+ puts " filedepot versions HANDLE List all versions of a handle"
111
+ puts " filedepot delete HANDLE [VER] Delete file(s) after confirmation"
112
+ puts ""
113
+ puts "Use 'filedepot help COMMAND' for more information on a command."
114
+ end
115
+
116
+ def self.exit_on_failure?
117
+ true
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "yaml"
5
+
6
+ module Filedepot
7
+ class Config
8
+ CONFIG_DIR = File.expand_path("~/.filedepot")
9
+ CONFIG_PATH = File.join(CONFIG_DIR, "config.yml")
10
+
11
+ DEFAULT_CONFIG = <<~YAML
12
+ default_source: test
13
+ sources:
14
+ - name: test
15
+ ssh: ssh
16
+ host: 127.0.0.1
17
+ username:
18
+ base_path: %<base_path>s
19
+ YAML
20
+
21
+ class << self
22
+ def ensure_config!
23
+ return if File.exist?(CONFIG_PATH)
24
+
25
+ FileUtils.mkdir_p(CONFIG_DIR)
26
+ base_path = File.join(File.expand_path("~"), "filedepot")
27
+ File.write(CONFIG_PATH, format(DEFAULT_CONFIG, base_path: base_path))
28
+ end
29
+
30
+ def load
31
+ ensure_config!
32
+ YAML.load_file(CONFIG_PATH)
33
+ end
34
+
35
+ def current_source
36
+ config = load
37
+ default = config["default_source"]
38
+ sources = config["sources"] || []
39
+ sources.find { |s| s["name"] == default }
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Filedepot
4
+ VERSION = "0.1.0"
5
+ end
data/lib/filedepot.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "filedepot/version"
4
+ require "filedepot/config"
5
+ require "filedepot/cli"
6
+
7
+ module Filedepot
8
+ class Error < StandardError; end
9
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: filedepot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Filedepot
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ description: Command-line tool to sync files on remote storage via SSH
28
+ email:
29
+ - ''
30
+ executables:
31
+ - filedepot
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - README.md
36
+ - bin/filedepot
37
+ - lib/filedepot.rb
38
+ - lib/filedepot/cli.rb
39
+ - lib/filedepot/config.rb
40
+ - lib/filedepot/version.rb
41
+ homepage: https://github.com/filedepot/filedepot
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://github.com/filedepot/filedepot
46
+ source_code_uri: https://github.com/filedepot/filedepot
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.0.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.5.22
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Sync files on remote storage
66
+ test_files: []