dotsync 0.1.0 → 0.1.1
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/.github/workflows/gem-push.yml +1 -0
- data/.github/workflows/gem-push.yml.bak +22 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +39 -36
- data/RELEASING.md +8 -0
- data/exe/dotsync +44 -0
- data/lib/dotsync/runner.rb +54 -17
- data/lib/dotsync/version.rb +1 -1
- metadata +10 -5
- /data/{bin → exe}/console +0 -0
- /data/{bin → exe}/setup +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7656490334da78bcf97bcadae816a7adb7993c0e39a6925c642ef3f0c79e39ad
|
|
4
|
+
data.tar.gz: '006061689d4068a5e73d7cbce3b36b8443090a8799095935b691dc3a7cdbcaca'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef03747509e578fe268adfe14f0834035d794bae10ec28432ca188771fa8909afeca678ee0e9557903c5aa7805476ccf9a9886faf79927178ddb5f726799cd15
|
|
7
|
+
data.tar.gz: bd06222f5a2b8e329833565a611a2cf2b2be93baa0fc1a34eaec4c8e4d6b84d897b2a0116bab4b11c1dfe500c3ca079cbb3f60c857d935359dd3073acc888be2
|
|
@@ -21,3 +21,25 @@ jobs:
|
|
|
21
21
|
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
|
22
22
|
OWNER: ${{ github.repository_owner }}
|
|
23
23
|
|
|
24
|
+
publish:
|
|
25
|
+
needs: test
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
if: github.ref == 'refs/heads/master' && matrix.ruby == '3.2'
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
|
|
32
|
+
- name: Set up Ruby
|
|
33
|
+
uses: ruby/setup-ruby@v1
|
|
34
|
+
with:
|
|
35
|
+
ruby-version: 3.2
|
|
36
|
+
bundler-cache: true
|
|
37
|
+
|
|
38
|
+
- name: Check if gem version has changed
|
|
39
|
+
id: gem_version_check
|
|
40
|
+
run: |
|
|
41
|
+
gem build *.gemspec
|
|
42
|
+
gem_name=$(ls *.gem | head -n 1)
|
|
43
|
+
gem info $gem_name --remote || echo "new_version" > version_changed
|
|
44
|
+
env:
|
|
45
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Dotsync
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/dsaenztagarro/dotsync/actions)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
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.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ gem 'dotsync'
|
|
|
14
14
|
|
|
15
15
|
And then execute:
|
|
16
16
|
|
|
17
|
-
$ bundle
|
|
17
|
+
$ bundle install
|
|
18
18
|
|
|
19
19
|
Or install it yourself as:
|
|
20
20
|
|
|
@@ -22,9 +22,33 @@ Or install it yourself as:
|
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
+
### Executable Commands
|
|
26
|
+
|
|
27
|
+
Dotsync provides the following commands to manage your dotfiles:
|
|
28
|
+
|
|
29
|
+
- **Push**: Transfer dotfiles from your local machine to the destination repository.
|
|
30
|
+
```shell
|
|
31
|
+
dotsync push
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **Pull**: Synchronize dotfiles from the repository to your local machine.
|
|
35
|
+
```shell
|
|
36
|
+
dotsync pull
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **Watch**: Continuously monitor and sync changes between your local machine and the repository.
|
|
40
|
+
```shell
|
|
41
|
+
dotsync watch
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Setup**: Generate a default configuration file at `~/.config/dotsync.toml` with example mappings for `pull`, `push`, and `watch`.
|
|
45
|
+
```shell
|
|
46
|
+
dotsync setup
|
|
47
|
+
```
|
|
48
|
+
|
|
25
49
|
### Configuration
|
|
26
50
|
|
|
27
|
-
The configuration file
|
|
51
|
+
The configuration file uses a `mappings` structure to define the source and destination of your dotfiles. Here is an example:
|
|
28
52
|
|
|
29
53
|
```toml
|
|
30
54
|
[pull]
|
|
@@ -36,46 +60,29 @@ mappings = [
|
|
|
36
60
|
[push]
|
|
37
61
|
mappings = [
|
|
38
62
|
{ src = "$HOME/.zshenv", dest = "$DOTFILES_DIR/home/.zshenv" },
|
|
39
|
-
{ src = "$XDG_CONFIG_HOME/alacritty", dest = "$DOTFILES_DIR/config/alacritty" }
|
|
40
|
-
{ src = "$XDG_CONFIG_HOME/brewfile", dest = "$DOTFILES_DIR/config/brewfile" },
|
|
41
|
-
{ src = "$XDG_CONFIG_HOME/exercism", dest = "$DOTFILES_DIR/config/exercism" },
|
|
42
|
-
{ src = "$XDG_CONFIG_HOME/git", dest = "$DOTFILES_DIR/config/git" },
|
|
43
|
-
{ src = "$XDG_CONFIG_HOME/nvim", dest = "$DOTFILES_DIR/config/nvim", ignore = "lazy-lock.json" },
|
|
44
|
-
{ src = "$XDG_CONFIG_HOME/zellij", dest = "$DOTFILES_DIR/config/zellij" },
|
|
45
|
-
{ src = "$XDG_CONFIG_HOME/zsh", dest = "$DOTFILES_DIR/config/zsh", ignore = [".zsh_sessions", ".zsh_history"] },
|
|
46
|
-
{ src = "$XDG_CONFIG_HOME/starship.toml", dest = "$DOTFILES_DIR/config/starship.toml" },
|
|
47
|
-
{ src = "$XDG_CONFIG_HOME/dotsync.toml", dest = "$DOTFILES_DIR/dotsync/macmini.toml" }
|
|
63
|
+
{ src = "$XDG_CONFIG_HOME/alacritty", dest = "$DOTFILES_DIR/config/alacritty" }
|
|
48
64
|
]
|
|
49
65
|
|
|
50
66
|
[watch]
|
|
51
|
-
|
|
52
|
-
dest =
|
|
53
|
-
|
|
54
|
-
'~/.config/alacritty/',
|
|
55
|
-
'~/.config/zellij/',
|
|
56
|
-
'~/.config/nvim/',
|
|
57
|
-
'~/.config/exercism/',
|
|
58
|
-
'~/.config/nvim/init.lua',
|
|
59
|
-
'~/.config/nvim/lua/',
|
|
60
|
-
'~/.config/nvim/after/'
|
|
67
|
+
mappings = [
|
|
68
|
+
{ src = "$HOME/.zshenv", dest = "$DOTFILES_DIR/home/.zshenv" },
|
|
69
|
+
{ src = "$XDG_CONFIG_HOME/alacritty", dest = "$DOTFILES_DIR/config/alacritty" }
|
|
61
70
|
]
|
|
62
71
|
```
|
|
63
72
|
|
|
64
|
-
###
|
|
65
|
-
|
|
66
|
-
To sync your configuration files, use the following commands:
|
|
73
|
+
### Pro Tips
|
|
67
74
|
|
|
68
|
-
- **
|
|
75
|
+
- **Using rbenv**: To ensure the gem uses the correct Ruby version managed by rbenv, you can run:
|
|
69
76
|
```shell
|
|
70
|
-
dotsync push
|
|
77
|
+
RBENV_VERSION=3.2.0 dotsync push
|
|
71
78
|
```
|
|
72
79
|
|
|
73
|
-
- **
|
|
80
|
+
- **Global Installation**: Install the gem using a globally available Ruby version to make the executable accessible anywhere:
|
|
74
81
|
```shell
|
|
75
|
-
dotsync
|
|
82
|
+
gem install dotsync
|
|
76
83
|
```
|
|
77
84
|
|
|
78
|
-
|
|
85
|
+
## Development
|
|
79
86
|
|
|
80
87
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
81
88
|
|
|
@@ -91,8 +98,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
91
98
|
|
|
92
99
|
## Code of Conduct
|
|
93
100
|
|
|
94
|
-
Everyone interacting in the Dotsync project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
|
95
|
-
|
|
96
|
-
## Rake tasks
|
|
97
|
-
|
|
98
|
-
List with `bundle exec rake -AT`
|
|
101
|
+
Everyone interacting in the Dotsync project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dsaenztagarro/dotsync/blob/master/CODE_OF_CONDUCT.md).
|
data/RELEASING.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## Check list for releasing a new version
|
|
2
|
+
|
|
3
|
+
- [ ] From the root of your gem project, build the gem using `gem build`. This will create a `.gem` file.
|
|
4
|
+
- [ ] Install the gem locally using `gem install ./your-gem-name-version.gem`. This will install the gem, including its executable.
|
|
5
|
+
- [ ] After installation, the executable should be available globally in your shell path.
|
|
6
|
+
- [ ] To ensure the proper Ruby version is used, confirm that your environment is set up with the correct Ruby version (e.g., using a Ruby version manager like rbenv or rvm).
|
|
7
|
+
- [ ] From any location, you can now run the executable by typing its name (e.g., `dotsync`) to verify it works as expected.
|
|
8
|
+
|
data/exe/dotsync
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require_relative '../lib/dotsync'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
|
|
6
|
+
options = {}
|
|
7
|
+
|
|
8
|
+
opt_parser = OptionParser.new do |opts|
|
|
9
|
+
opts.banner = <<~BANNER
|
|
10
|
+
Usage: dotsync [command] [options]
|
|
11
|
+
|
|
12
|
+
Commands:
|
|
13
|
+
push Upload local changes to the remote
|
|
14
|
+
pull Download remote changes to the local
|
|
15
|
+
watch Continuously monitor and sync changes
|
|
16
|
+
setup Initialize a default configuration file
|
|
17
|
+
BANNER
|
|
18
|
+
|
|
19
|
+
opts.on("-h", "--help", "Show this help message") do
|
|
20
|
+
puts opts
|
|
21
|
+
exit
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
opt_parser.parse!
|
|
26
|
+
|
|
27
|
+
command = ARGV.shift
|
|
28
|
+
|
|
29
|
+
case command
|
|
30
|
+
when "push"
|
|
31
|
+
Dotsync::Runner.new.run(:push)
|
|
32
|
+
when "pull"
|
|
33
|
+
Dotsync::Runner.new.run(:pull)
|
|
34
|
+
when "watch"
|
|
35
|
+
Dotsync::Runner.new.run(:watch)
|
|
36
|
+
when "setup"
|
|
37
|
+
Dotsync::Runner.new.run(:setup)
|
|
38
|
+
else
|
|
39
|
+
puts "Unknown command: #{command}"
|
|
40
|
+
puts
|
|
41
|
+
puts opt_parser.banner
|
|
42
|
+
exit 1
|
|
43
|
+
end
|
|
44
|
+
|
data/lib/dotsync/runner.rb
CHANGED
|
@@ -6,28 +6,65 @@ module Dotsync
|
|
|
6
6
|
|
|
7
7
|
# action_name should be a symbol, e.g., :pull, :watch, :sync
|
|
8
8
|
def run(action_name)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
case action_name
|
|
10
|
+
when :setup
|
|
11
|
+
setup_config
|
|
12
|
+
else
|
|
13
|
+
begin
|
|
14
|
+
action_class = Dotsync.const_get("#{camelize(action_name.to_s)}Action")
|
|
15
|
+
config_class = Dotsync.const_get("#{camelize(action_name.to_s)}ActionConfig")
|
|
16
|
+
|
|
17
|
+
config = config_class.new(Dotsync.config_path)
|
|
18
|
+
action = action_class.new(config, @logger)
|
|
19
|
+
action.execute
|
|
20
|
+
rescue ConfigError => e
|
|
21
|
+
@logger.error("[#{action_name}] config error:")
|
|
22
|
+
@logger.info(e.message)
|
|
23
|
+
rescue NameError => e
|
|
24
|
+
@logger.error("Unknown action '#{action_name}':")
|
|
25
|
+
@logger.info(e.message)
|
|
26
|
+
rescue => e
|
|
27
|
+
@logger.error("Error running '#{action_name}':")
|
|
28
|
+
@logger.info(e.message)
|
|
29
|
+
raise
|
|
30
|
+
end
|
|
26
31
|
end
|
|
27
32
|
end
|
|
28
33
|
|
|
29
34
|
private
|
|
30
35
|
|
|
36
|
+
def setup_config
|
|
37
|
+
require 'toml-rb'
|
|
38
|
+
require 'fileutils'
|
|
39
|
+
|
|
40
|
+
config_path = File.expand_path(Dotsync.config_path)
|
|
41
|
+
FileUtils.mkdir_p(File.dirname(config_path))
|
|
42
|
+
|
|
43
|
+
example_mappings = {
|
|
44
|
+
"pull" => {
|
|
45
|
+
"mappings" => [
|
|
46
|
+
{ "src" => "$DOTFILES_DIR/config/", "dest" => "$XDG_CONFIG_HOME", "force" => false },
|
|
47
|
+
{ "src" => "$DOTFILES_DIR/home/.zshenv", "dest" => "$HOME" }
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
"push" => {
|
|
51
|
+
"mappings" => [
|
|
52
|
+
{ "src" => "$HOME/.zshenv", "dest" => "$DOTFILES_DIR/home/.zshenv" },
|
|
53
|
+
{ "src" => "$XDG_CONFIG_HOME/alacritty", "dest" => "$DOTFILES_DIR/config/alacritty" }
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"watch" => {
|
|
57
|
+
"mappings" => [
|
|
58
|
+
{ "src" => "$HOME/.zshenv", "dest" => "$DOTFILES_DIR/home/.zshenv" },
|
|
59
|
+
{ "src" => "$XDG_CONFIG_HOME/alacritty", "dest" => "$DOTFILES_DIR/config/alacritty" }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
File.write(config_path, TomlRB.dump(example_mappings))
|
|
65
|
+
@logger.info("Configuration file created at #{config_path}")
|
|
66
|
+
end
|
|
67
|
+
|
|
31
68
|
# Utility to convert 'pull' to 'Pull', 'sync' to 'Sync', etc.
|
|
32
69
|
def camelize(str)
|
|
33
70
|
str.split('_').map(&:capitalize).join
|
data/lib/dotsync/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Sáenz
|
|
@@ -153,7 +153,10 @@ dependencies:
|
|
|
153
153
|
description: Keep in sync your dotfiles across machines with a single TOML file
|
|
154
154
|
email:
|
|
155
155
|
- david.saenz.tagarro@gmail.com
|
|
156
|
-
executables:
|
|
156
|
+
executables:
|
|
157
|
+
- console
|
|
158
|
+
- dotsync
|
|
159
|
+
- setup
|
|
157
160
|
extensions: []
|
|
158
161
|
extra_rdoc_files: []
|
|
159
162
|
files:
|
|
@@ -168,10 +171,12 @@ files:
|
|
|
168
171
|
- Gemfile.lock
|
|
169
172
|
- LICENSE.txt
|
|
170
173
|
- README.md
|
|
174
|
+
- RELEASING.md
|
|
171
175
|
- Rakefile
|
|
172
|
-
- bin/console
|
|
173
|
-
- bin/setup
|
|
174
176
|
- dotsync.gemspec
|
|
177
|
+
- exe/console
|
|
178
|
+
- exe/dotsync
|
|
179
|
+
- exe/setup
|
|
175
180
|
- lib/dotsync.rb
|
|
176
181
|
- lib/dotsync/actions/base_action.rb
|
|
177
182
|
- lib/dotsync/actions/config/base_config.rb
|
|
@@ -212,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
212
217
|
- !ruby/object:Gem::Version
|
|
213
218
|
version: '0'
|
|
214
219
|
requirements: []
|
|
215
|
-
rubygems_version: 3.
|
|
220
|
+
rubygems_version: 3.4.19
|
|
216
221
|
signing_key:
|
|
217
222
|
specification_version: 4
|
|
218
223
|
summary: Manage dotfiles like a boss
|
/data/{bin → exe}/console
RENAMED
|
File without changes
|
/data/{bin → exe}/setup
RENAMED
|
File without changes
|