dotsync 0.1.2 → 0.1.3
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/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -3
- data/README.md +36 -0
- data/dotsync.gemspec +0 -1
- data/lib/dotsync/actions/base_action.rb +0 -23
- data/lib/dotsync/actions/concerns/mappings_transfer.rb +25 -0
- data/lib/dotsync/actions/config/mapping_entry.rb +8 -5
- data/lib/dotsync/actions/pull_action.rb +10 -17
- data/lib/dotsync/actions/push_action.rb +4 -12
- data/lib/dotsync/actions/watch_action.rb +9 -13
- data/lib/dotsync/icons.rb +74 -0
- data/lib/dotsync/logger.rb +17 -41
- data/lib/dotsync/version.rb +1 -1
- data/lib/dotsync.rb +4 -0
- metadata +4 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e8cf43f8c36d398e1f87c3dd0e84ec9e36a6b1da7de4b3002546f0bbacb3e4ff
|
|
4
|
+
data.tar.gz: b32a336b5a4e63983a4a6ee3a7bcc4f50cb70ccd268a0066f8343e05fa8cf5d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28e35c812f55e418525df64090b3b119f250561f209a1e2788218e4a0c41360824aaba93531cd6ad969d022795a0b7a92e046c26e62dad829d64535d7f7d995b
|
|
7
|
+
data.tar.gz: d8812f07850fa2823448e59a78471655735a9b7f78f6d9983ab8e5c83aa8adf887b47dd4e517901046666d85d412bbd5ea08e07656aee8186aceeaf4f2f441bd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# 0.1.3
|
|
2
|
+
|
|
3
|
+
PushAction: Avoid error on missing destination
|
|
4
|
+
Unify mappings print. Use icon for ignores presence.
|
|
5
|
+
Extracted icons to its own module
|
|
6
|
+
Reviewed icons
|
|
7
|
+
Updated README with existing mapping entries icons
|
|
8
|
+
Customizable icons
|
|
9
|
+
Logger review
|
|
10
|
+
|
|
1
11
|
# 0.1.2
|
|
2
12
|
|
|
3
13
|
Add gem version on usage banner
|
data/Gemfile.lock
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
dotsync (0.1.
|
|
4
|
+
dotsync (0.1.3)
|
|
5
5
|
fileutils (~> 1.7.3)
|
|
6
6
|
listen (~> 3.9.0)
|
|
7
7
|
logger (~> 1.7.0)
|
|
8
|
-
ostruct (~> 0.6.3)
|
|
9
8
|
toml-rb (~> 4.0.0)
|
|
10
9
|
|
|
11
10
|
GEM
|
|
@@ -33,7 +32,6 @@ GEM
|
|
|
33
32
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
34
33
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
35
34
|
logger (1.7.0)
|
|
36
|
-
ostruct (0.6.3)
|
|
37
35
|
parallel (1.27.0)
|
|
38
36
|
parser (3.3.9.0)
|
|
39
37
|
ast (~> 2.4.1)
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Dotsync
|
|
2
2
|
|
|
3
|
+
**⚠️ Warning: This gem is under active development. You can expect new changes that may not be backward-compatible.**
|
|
4
|
+
|
|
3
5
|
[](https://github.com/dsaenztagarro/dotsync/actions)
|
|
4
6
|
|
|
5
7
|
Welcome to Dotsync! This gem helps you manage and synchronize your dotfiles effortlessly. Below you'll find information on installation, usage, and some tips for getting started.
|
|
@@ -72,6 +74,40 @@ mappings = [
|
|
|
72
74
|
]
|
|
73
75
|
```
|
|
74
76
|
|
|
77
|
+
#### `force` and `ignore` Options in Mappings
|
|
78
|
+
|
|
79
|
+
Each mapping entry supports the following options:
|
|
80
|
+
|
|
81
|
+
- **`force`**: A boolean (true/false) value. When set to `true`, it forces deletion of the destination folder before transferring files from the source. This is particularly useful when you need to ensure that the destination is clean before a transfer.
|
|
82
|
+
- **`ignore`**: An array of patterns or file names to exclude during the transfer. This allows you to specify files or folders that should not be copied from the source to the destination.
|
|
83
|
+
|
|
84
|
+
These options apply when the source is a directory and are relevant for both `push` and `pull` operations.
|
|
85
|
+
|
|
86
|
+
### Rendering Mappings with Icons
|
|
87
|
+
|
|
88
|
+
When running `push` or `pull` actions, the mappings are rendered in the console with relevant icons to provide visual feedback on the status of each mapping. To correctly view these icons, ensure you are using a terminal that supports a patched [Nerd Font](https://www.nerdfonts.com). Below are some examples of how the mappings are displayed:
|
|
89
|
+
|
|
90
|
+
- **Force Icon**:
|
|
91
|
+
```
|
|
92
|
+
Mappings:
|
|
93
|
+
$DOTFILES_DIR/config/ → $XDG_CONFIG_HOME ⚡
|
|
94
|
+
```
|
|
95
|
+
The ⚡ icon (`Dotsync::Icons::FORCE`) indicates that the `force` option is enabled and the destination folder will be cleared before the transfer.
|
|
96
|
+
|
|
97
|
+
- **Ignore Icon**:
|
|
98
|
+
```
|
|
99
|
+
Mappings:
|
|
100
|
+
$DOTFILES_DIR/home/.zshenv → $HOME 🚫
|
|
101
|
+
```
|
|
102
|
+
The 🚫 icon (`Dotsync::Icons::IGNORE`) indicates that certain files or patterns are being ignored during the transfer.
|
|
103
|
+
|
|
104
|
+
- **Invalid Icon**:
|
|
105
|
+
```
|
|
106
|
+
Mappings:
|
|
107
|
+
$DOTFILES_DIR/home/.vimrc → $HOME ❌
|
|
108
|
+
```
|
|
109
|
+
The ❌ icon (`Dotsync::Icons::INVALID`) indicates that the mapping is invalid due to missing source or destination paths.
|
|
110
|
+
|
|
75
111
|
### Pro Tips
|
|
76
112
|
|
|
77
113
|
- **Using rbenv**: To ensure the gem uses the correct Ruby version managed by rbenv, you can run:
|
data/dotsync.gemspec
CHANGED
|
@@ -29,7 +29,6 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_dependency "listen", "~> 3.9.0"
|
|
30
30
|
spec.add_dependency "fileutils", "~> 1.7.3"
|
|
31
31
|
spec.add_dependency "logger", "~> 1.7.0" # No longer part of default gems from Ruby 3.5
|
|
32
|
-
spec.add_dependency "ostruct", "~> 0.6.3" # No longer part of default gems from Ruby 3.5
|
|
33
32
|
spec.add_development_dependency "rake", "~> 13.3.0"
|
|
34
33
|
spec.add_development_dependency "rspec", "~> 3.13.1"
|
|
35
34
|
spec.add_development_dependency "rubocop", "~> 1.81.1"
|
|
@@ -9,35 +9,12 @@ module Dotsync
|
|
|
9
9
|
def_delegator :logger, :action
|
|
10
10
|
|
|
11
11
|
def initialize(config, logger)
|
|
12
|
-
@log_queue = Queue.new
|
|
13
12
|
@config = config
|
|
14
13
|
@logger = logger
|
|
15
|
-
setup_logger_thread
|
|
16
|
-
setup_signal_trap
|
|
17
14
|
end
|
|
18
15
|
|
|
19
16
|
def execute
|
|
20
17
|
raise NotImplementedError
|
|
21
18
|
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def setup_signal_trap
|
|
26
|
-
Signal.trap("INT") do
|
|
27
|
-
@log_queue << { type: :info, message: "Shutting down gracefully...", icon: :bell }
|
|
28
|
-
exit
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def setup_logger_thread
|
|
33
|
-
return if ENV['TEST_ENV'] == 'true'
|
|
34
|
-
|
|
35
|
-
Thread.new do
|
|
36
|
-
loop do
|
|
37
|
-
log_entry = @log_queue.pop
|
|
38
|
-
@logger.info(log_entry[:message], icon: log_entry[:icon])
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
19
|
end
|
|
43
20
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Dotsync
|
|
2
|
+
module MappingsTransfer
|
|
3
|
+
extend Forwardable # def_delegator
|
|
4
|
+
|
|
5
|
+
def_delegator :@config, :mappings
|
|
6
|
+
|
|
7
|
+
def show_mappings
|
|
8
|
+
info("Mappings:", icon: :config, )
|
|
9
|
+
|
|
10
|
+
mappings.each do |mapping|
|
|
11
|
+
info(" #{mapping}")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def transfer_mappings
|
|
16
|
+
valid_mappings.each do |mapping|
|
|
17
|
+
Dotsync::FileTransfer.new(mapping).transfer
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def valid_mappings
|
|
22
|
+
mappings.select(&:valid?)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -32,12 +32,15 @@ module Dotsync
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def valid?
|
|
35
|
-
File.exist?(@sanitized_src) && File.exist?(@sanitized_dest)
|
|
35
|
+
File.exist?(@sanitized_src) && File.exist?(File.dirname(@sanitized_dest))
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def to_s
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
msg = ["#{original_src} → #{original_dest}"]
|
|
40
|
+
msg << Icons.force if force?
|
|
41
|
+
msg << Icons.ignore if ignores?
|
|
42
|
+
msg << Icons.invalid unless valid?
|
|
43
|
+
msg.join(" ")
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
def applied_to(path)
|
|
@@ -57,8 +60,8 @@ module Dotsync
|
|
|
57
60
|
|
|
58
61
|
private
|
|
59
62
|
|
|
60
|
-
def
|
|
61
|
-
|
|
63
|
+
def ignores?
|
|
64
|
+
@original_ignores.any?
|
|
62
65
|
end
|
|
63
66
|
end
|
|
64
67
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module Dotsync
|
|
2
2
|
class PullAction < BaseAction
|
|
3
|
-
|
|
3
|
+
include MappingsTransfer
|
|
4
|
+
|
|
4
5
|
def_delegator :@config, :backups_root
|
|
5
6
|
|
|
6
7
|
def execute
|
|
@@ -15,12 +16,13 @@ module Dotsync
|
|
|
15
16
|
private
|
|
16
17
|
|
|
17
18
|
def show_config
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
show_mappings
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def pull_dotfiles
|
|
23
|
+
transfer_mappings
|
|
24
|
+
|
|
25
|
+
action("Dotfiles pulled", icon: :copy)
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def show_backup
|
|
@@ -37,7 +39,7 @@ module Dotsync
|
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
def create_backup
|
|
40
|
-
return false unless
|
|
42
|
+
return false unless valid_mappings.any?
|
|
41
43
|
FileUtils.mkdir_p(backup_path)
|
|
42
44
|
mappings.each do |mapping|
|
|
43
45
|
next unless File.exist?(mapping.dest)
|
|
@@ -61,14 +63,5 @@ module Dotsync
|
|
|
61
63
|
end
|
|
62
64
|
end
|
|
63
65
|
end
|
|
64
|
-
|
|
65
|
-
def pull_dotfiles
|
|
66
|
-
mappings.each { |mapping| Dotsync::FileTransfer.new(mapping).transfer }
|
|
67
|
-
action("Dotfiles pulled", icon: :copy)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def icon_delete
|
|
71
|
-
Dotsync::Logger::ICONS[:delete]
|
|
72
|
-
end
|
|
73
66
|
end
|
|
74
67
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Dotsync
|
|
2
2
|
class PushAction < BaseAction
|
|
3
|
-
|
|
3
|
+
include MappingsTransfer
|
|
4
4
|
|
|
5
5
|
def execute
|
|
6
6
|
show_config
|
|
@@ -10,21 +10,13 @@ module Dotsync
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
12
|
def show_config
|
|
13
|
-
|
|
14
|
-
mappings.each do |mapping|
|
|
15
|
-
force_icon = mapping.force? ? " #{icon_delete}" : ""
|
|
16
|
-
info(" src: #{mapping.original_src} -> dest: #{mapping.original_dest}#{force_icon}", icon: :copy)
|
|
17
|
-
info(" ignores: #{mapping.original_ignores.join(', ')}", icon: :exclude) if mapping.ignores.any?
|
|
18
|
-
end
|
|
13
|
+
show_mappings
|
|
19
14
|
end
|
|
20
15
|
|
|
21
16
|
def push_dotfiles
|
|
22
|
-
|
|
23
|
-
action("Dotfiles pushed", icon: :copy)
|
|
24
|
-
end
|
|
17
|
+
transfer_mappings
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
Dotsync::Logger::ICONS[:delete]
|
|
19
|
+
action("Dotfiles pushed", icon: :copy)
|
|
28
20
|
end
|
|
29
21
|
end
|
|
30
22
|
end
|
|
@@ -5,7 +5,6 @@ module Dotsync
|
|
|
5
5
|
def initialize(config, logger)
|
|
6
6
|
super
|
|
7
7
|
setup_listeners
|
|
8
|
-
setup_logger_thread
|
|
9
8
|
setup_signal_trap
|
|
10
9
|
end
|
|
11
10
|
|
|
@@ -14,19 +13,16 @@ module Dotsync
|
|
|
14
13
|
|
|
15
14
|
@listeners.each(&:start)
|
|
16
15
|
|
|
17
|
-
logger.action("Listening for changes..."
|
|
18
|
-
|
|
16
|
+
logger.action("Listening for changes...")
|
|
17
|
+
logger.action("Press Ctrl+C to exit.")
|
|
19
18
|
sleep
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
private
|
|
23
22
|
|
|
24
23
|
def show_config
|
|
25
|
-
info("Mappings:", icon: :
|
|
26
|
-
mappings.each
|
|
27
|
-
info(" #{mapping}", icon: :copy)
|
|
28
|
-
info(" Excludes: #{mapping.ignores.join(', ')}", icon: :exclude) if mapping.ignores.any?
|
|
29
|
-
end
|
|
24
|
+
logger.info("Mappings:", icon: :config)
|
|
25
|
+
mappings.each { |mapping| logger.log(" #{mapping}") }
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
def setup_listeners
|
|
@@ -51,22 +47,22 @@ module Dotsync
|
|
|
51
47
|
def handle_file_changes(mapping, modified, added, removed)
|
|
52
48
|
(modified + added).each do |path|
|
|
53
49
|
new_mapping = mapping.applied_to(path)
|
|
54
|
-
logger.info("Copied file: #{new_mapping
|
|
50
|
+
logger.info("Copied file: #{new_mapping}", icon: :copy)
|
|
55
51
|
Dotsync::FileTransfer.new(new_mapping).transfer
|
|
56
52
|
end
|
|
57
53
|
removed.each do |path|
|
|
58
|
-
logger.info("File removed: #{path}", icon: :delete)
|
|
54
|
+
logger.info("File removed: #{path}", icon: :delete, bold: false)
|
|
59
55
|
end
|
|
60
56
|
end
|
|
61
57
|
|
|
62
58
|
def setup_signal_trap
|
|
63
|
-
listeners = @listeners.dup
|
|
64
59
|
Signal.trap("INT") do
|
|
65
60
|
# Using a new thread to handle the signal trap context,
|
|
66
61
|
# as Signal.trap runs in a more restrictive environment
|
|
67
62
|
Thread.new do
|
|
68
|
-
logger.
|
|
69
|
-
|
|
63
|
+
logger.log("")
|
|
64
|
+
logger.action("Shutting down listeners...")
|
|
65
|
+
@listeners.each(&:stop)
|
|
70
66
|
exit
|
|
71
67
|
end
|
|
72
68
|
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module Dotsync
|
|
2
|
+
module Icons
|
|
3
|
+
# Log level icons
|
|
4
|
+
INFO = " "
|
|
5
|
+
ERROR = " "
|
|
6
|
+
|
|
7
|
+
# Configuration icon
|
|
8
|
+
CONFIG = " "
|
|
9
|
+
|
|
10
|
+
# Default MappingEntry icons
|
|
11
|
+
DEFAULT_FORCE = " "
|
|
12
|
+
DEFAULT_IGNORE = " "
|
|
13
|
+
DEFAULT_INVALID = " "
|
|
14
|
+
|
|
15
|
+
# Action icons
|
|
16
|
+
PULL = " "
|
|
17
|
+
PUSH = " "
|
|
18
|
+
WATCH = " "
|
|
19
|
+
|
|
20
|
+
# TODO: review icons needed
|
|
21
|
+
CONSOLE = " "
|
|
22
|
+
LISTEN = " "
|
|
23
|
+
SOURCE = " " # "
|
|
24
|
+
DEST = " " # " "
|
|
25
|
+
BELL = " "
|
|
26
|
+
COPY = " "
|
|
27
|
+
SKIP = " "
|
|
28
|
+
DONE = " "
|
|
29
|
+
BACKUP = " "
|
|
30
|
+
|
|
31
|
+
@custom_icons = {}
|
|
32
|
+
|
|
33
|
+
def self.load_custom_icons(config)
|
|
34
|
+
@custom_icons = {
|
|
35
|
+
force: config.dig("icons", "force") || DEFAULT_FORCE,
|
|
36
|
+
ignore: config.dig("icons", "ignore") || DEFAULT_IGNORE,
|
|
37
|
+
invalid: config.dig("icons", "invalid") || DEFAULT_INVALID
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.force
|
|
42
|
+
@custom_icons[:force] || DEFAULT_FORCE
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.ignore
|
|
46
|
+
@custom_icons[:ignore] || DEFAULT_IGNORE
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.invalid
|
|
50
|
+
@custom_icons[:invalid] || DEFAULT_INVALID
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# https://www.nerdfonts.com
|
|
54
|
+
MAPPINGS = {
|
|
55
|
+
info: INFO,
|
|
56
|
+
error: ERROR,
|
|
57
|
+
config: CONFIG,
|
|
58
|
+
force: -> { force },
|
|
59
|
+
ignore: -> { ignore },
|
|
60
|
+
pull: PULL,
|
|
61
|
+
push: PUSH,
|
|
62
|
+
watch: WATCH,
|
|
63
|
+
console: CONSOLE,
|
|
64
|
+
listen: LISTEN,
|
|
65
|
+
source: SOURCE,
|
|
66
|
+
dest: DEST,
|
|
67
|
+
bell: BELL,
|
|
68
|
+
copy: COPY,
|
|
69
|
+
skip: SKIP,
|
|
70
|
+
done: DONE,
|
|
71
|
+
backup: BACKUP
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/dotsync/logger.rb
CHANGED
|
@@ -2,60 +2,36 @@ module Dotsync
|
|
|
2
2
|
class Logger
|
|
3
3
|
attr_accessor :output
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
ICONS = {
|
|
7
|
-
info: " ",
|
|
8
|
-
listen: " ",
|
|
9
|
-
error: " ",
|
|
10
|
-
watch: " ",
|
|
11
|
-
source: " ", # ",
|
|
12
|
-
dest: " ", # " ",
|
|
13
|
-
delete: " ",
|
|
14
|
-
bell: " ",
|
|
15
|
-
copy: " ",
|
|
16
|
-
skip: " ",
|
|
17
|
-
done: " ",
|
|
18
|
-
backup: " ",
|
|
19
|
-
clean: " ",
|
|
20
|
-
}
|
|
5
|
+
# NOTE: use Rake tasks "palette:fg" and "palette:bg" to select a proper ASCII color code
|
|
21
6
|
|
|
22
7
|
def initialize(output = $stdout)
|
|
23
8
|
@output = output
|
|
24
9
|
end
|
|
25
10
|
|
|
26
|
-
def
|
|
27
|
-
log(:
|
|
11
|
+
def action(message, color: 153, bold: true, icon: :console)
|
|
12
|
+
log(message, color: color, bold: bold, icon: icon)
|
|
28
13
|
end
|
|
29
14
|
|
|
30
|
-
def
|
|
31
|
-
log(:
|
|
15
|
+
def info(message, color: 103, bold: true, icon: :info)
|
|
16
|
+
log(message, color: color, bold: bold, icon: icon)
|
|
32
17
|
end
|
|
33
18
|
|
|
34
|
-
def
|
|
35
|
-
log(:
|
|
19
|
+
def error(message, color: 196, bold: true, icon: :error)
|
|
20
|
+
log(message, color: color, bold: bold, icon: icon)
|
|
36
21
|
end
|
|
37
22
|
|
|
38
|
-
def
|
|
39
|
-
|
|
40
|
-
end
|
|
23
|
+
def log(message, color: 0, bold: false, icon: nil)
|
|
24
|
+
mapped_icon = Dotsync::Icons::MAPPINGS[icon] if icon
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
msg = []
|
|
27
|
+
msg << "\e[38;5;#{color}m" if color > 0
|
|
28
|
+
msg << "\e[1m" if bold
|
|
29
|
+
msg << mapped_icon if mapped_icon
|
|
30
|
+
msg << message
|
|
31
|
+
msg << "\e[0m" if color > 0 # reset color
|
|
32
|
+
msg = msg.join("")
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
icon = options[:icon]
|
|
48
|
-
color = {
|
|
49
|
-
info: 103, action: 153, error: 196, event: 141, warning: 31, copy: 32,
|
|
50
|
-
skip: 33, done: 32, backup: 35,
|
|
51
|
-
clean: 34
|
|
52
|
-
}[type] || 0
|
|
53
|
-
|
|
54
|
-
if icon.nil?
|
|
55
|
-
@output.puts message
|
|
56
|
-
else
|
|
57
|
-
@output.puts "\e[38;5;#{color}m\e[1m#{ICONS[icon]}#{message}\e[0m"
|
|
58
|
-
end
|
|
34
|
+
@output.puts msg
|
|
59
35
|
end
|
|
60
36
|
end
|
|
61
37
|
end
|
data/lib/dotsync/version.rb
CHANGED
data/lib/dotsync.rb
CHANGED
|
@@ -10,6 +10,7 @@ require 'ostruct'
|
|
|
10
10
|
require_relative "dotsync/errors"
|
|
11
11
|
|
|
12
12
|
# Utils
|
|
13
|
+
require_relative 'dotsync/icons'
|
|
13
14
|
require_relative 'dotsync/logger'
|
|
14
15
|
require_relative 'dotsync/file_transfer'
|
|
15
16
|
require_relative 'dotsync/path_utils'
|
|
@@ -22,6 +23,9 @@ require_relative "dotsync/actions/config/pull_action_config"
|
|
|
22
23
|
require_relative "dotsync/actions/config/push_action_config"
|
|
23
24
|
require_relative "dotsync/actions/config/watch_action_config"
|
|
24
25
|
|
|
26
|
+
# Concerns
|
|
27
|
+
require_relative "dotsync/actions/concerns/mappings_transfer"
|
|
28
|
+
|
|
25
29
|
# Actions
|
|
26
30
|
require_relative "dotsync/actions/base_action"
|
|
27
31
|
require_relative "dotsync/actions/pull_action"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dotsync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Sáenz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-10-
|
|
11
|
+
date: 2025-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: toml-rb
|
|
@@ -66,20 +66,6 @@ dependencies:
|
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: 1.7.0
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: ostruct
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.6.3
|
|
76
|
-
type: :runtime
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.6.3
|
|
83
69
|
- !ruby/object:Gem::Dependency
|
|
84
70
|
name: rake
|
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -179,6 +165,7 @@ files:
|
|
|
179
165
|
- exe/setup
|
|
180
166
|
- lib/dotsync.rb
|
|
181
167
|
- lib/dotsync/actions/base_action.rb
|
|
168
|
+
- lib/dotsync/actions/concerns/mappings_transfer.rb
|
|
182
169
|
- lib/dotsync/actions/config/base_config.rb
|
|
183
170
|
- lib/dotsync/actions/config/mapping_entry.rb
|
|
184
171
|
- lib/dotsync/actions/config/pull_action_config.rb
|
|
@@ -190,6 +177,7 @@ files:
|
|
|
190
177
|
- lib/dotsync/actions/watch_action.rb
|
|
191
178
|
- lib/dotsync/errors.rb
|
|
192
179
|
- lib/dotsync/file_transfer.rb
|
|
180
|
+
- lib/dotsync/icons.rb
|
|
193
181
|
- lib/dotsync/logger.rb
|
|
194
182
|
- lib/dotsync/path_utils.rb
|
|
195
183
|
- lib/dotsync/runner.rb
|