dotsync 0.1.0 → 0.1.2
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 +8 -0
 - data/Gemfile.lock +1 -1
 - data/README.md +41 -36
 - data/RELEASING.md +8 -0
 - data/exe/dotsync +47 -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: '08b051bb2f245604662fd3f8347c70152dffb43d243d96bef919c38433a53124'
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 79c2af0084417ad7c8253deac085b0466bbfd5d3c7b0c20054e92899907921b9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 21107170e600b1649aebdf5c5b4a2b4750c796c6800684a3a9bf3bf32eac88c6ea3a55056c7bab5a910b4a244aa95bae56627d222f56756f376704992a3bbdd7
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4b920346a4a3dd410e35374678a957517a53d3dbcbe4fff737c7a0e88040c842e0a526728d923bd471b85c5660a5505ea0eeb4e5fe7dd22734b45e7b4c6d1d63
         
     | 
| 
         @@ -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,35 @@ 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 
     | 
    
         
            +
              During the `pull` operation, `Dotsync::PullAction` creates a backup of the existing files on the destination. These backups are stored in a directory under the XDG path, with each backup organized by a timestamp. To prevent excessive storage usage, only the 10 most recent backups are retained. Older backups are automatically purged, ensuring efficient storage management.
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            - **Watch**: Continuously monitor and sync changes between your local machine and the repository.
         
     | 
| 
      
 42 
     | 
    
         
            +
              ```shell
         
     | 
| 
      
 43 
     | 
    
         
            +
              dotsync watch
         
     | 
| 
      
 44 
     | 
    
         
            +
              ```
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            - **Setup**: Generate a default configuration file at `~/.config/dotsync.toml` with example mappings for `pull`, `push`, and `watch`.
         
     | 
| 
      
 47 
     | 
    
         
            +
              ```shell
         
     | 
| 
      
 48 
     | 
    
         
            +
              dotsync setup
         
     | 
| 
      
 49 
     | 
    
         
            +
              ```
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
       25 
51 
     | 
    
         
             
            ### Configuration
         
     | 
| 
       26 
52 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
            The configuration file  
     | 
| 
      
 53 
     | 
    
         
            +
            The configuration file uses a `mappings` structure to define the source and destination of your dotfiles. Here is an example:
         
     | 
| 
       28 
54 
     | 
    
         | 
| 
       29 
55 
     | 
    
         
             
            ```toml
         
     | 
| 
       30 
56 
     | 
    
         
             
            [pull]
         
     | 
| 
         @@ -36,46 +62,29 @@ mappings = [ 
     | 
|
| 
       36 
62 
     | 
    
         
             
            [push]
         
     | 
| 
       37 
63 
     | 
    
         
             
            mappings = [
         
     | 
| 
       38 
64 
     | 
    
         
             
              { 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" }
         
     | 
| 
      
 65 
     | 
    
         
            +
              { src = "$XDG_CONFIG_HOME/alacritty", dest = "$DOTFILES_DIR/config/alacritty" }
         
     | 
| 
       48 
66 
     | 
    
         
             
            ]
         
     | 
| 
       49 
67 
     | 
    
         | 
| 
       50 
68 
     | 
    
         
             
            [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/'
         
     | 
| 
      
 69 
     | 
    
         
            +
            mappings = [
         
     | 
| 
      
 70 
     | 
    
         
            +
              { src = "$HOME/.zshenv", dest = "$DOTFILES_DIR/home/.zshenv" },
         
     | 
| 
      
 71 
     | 
    
         
            +
              { src = "$XDG_CONFIG_HOME/alacritty", dest = "$DOTFILES_DIR/config/alacritty" }
         
     | 
| 
       61 
72 
     | 
    
         
             
            ]
         
     | 
| 
       62 
73 
     | 
    
         
             
            ```
         
     | 
| 
       63 
74 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
            ###  
     | 
| 
      
 75 
     | 
    
         
            +
            ### Pro Tips
         
     | 
| 
       65 
76 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
            To  
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
            - **Push**: Transfer dotfiles from your local machine to the destination repository.
         
     | 
| 
      
 77 
     | 
    
         
            +
            - **Using rbenv**: To ensure the gem uses the correct Ruby version managed by rbenv, you can run:
         
     | 
| 
       69 
78 
     | 
    
         
             
              ```shell
         
     | 
| 
       70 
     | 
    
         
            -
              dotsync push
         
     | 
| 
      
 79 
     | 
    
         
            +
              RBENV_VERSION=3.2.0 dotsync push
         
     | 
| 
       71 
80 
     | 
    
         
             
              ```
         
     | 
| 
       72 
81 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
            - ** 
     | 
| 
      
 82 
     | 
    
         
            +
            - **Global Installation**: Install the gem using a globally available Ruby version to make the executable accessible anywhere:
         
     | 
| 
       74 
83 
     | 
    
         
             
              ```shell
         
     | 
| 
       75 
     | 
    
         
            -
              dotsync 
     | 
| 
      
 84 
     | 
    
         
            +
              gem install dotsync
         
     | 
| 
       76 
85 
     | 
    
         
             
              ```
         
     | 
| 
       77 
86 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
            ## Development
         
     | 
| 
       79 
88 
     | 
    
         | 
| 
       80 
89 
     | 
    
         
             
            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 
90 
     | 
    
         | 
| 
         @@ -91,8 +100,4 @@ The gem is available as open source under the terms of the [MIT License](https:/ 
     | 
|
| 
       91 
100 
     | 
    
         | 
| 
       92 
101 
     | 
    
         
             
            ## Code of Conduct
         
     | 
| 
       93 
102 
     | 
    
         | 
| 
       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`
         
     | 
| 
      
 103 
     | 
    
         
            +
            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,47 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
                dotsync #{Dotsync::VERSION}
         
     | 
| 
      
 11 
     | 
    
         
            +
                Usage: dotsync [command] [options]
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                Commands:
         
     | 
| 
      
 14 
     | 
    
         
            +
                  push   Upload local changes to the remote
         
     | 
| 
      
 15 
     | 
    
         
            +
                  pull   Download remote changes to the local
         
     | 
| 
      
 16 
     | 
    
         
            +
                  watch  Continuously monitor and sync changes
         
     | 
| 
      
 17 
     | 
    
         
            +
                  setup  Initialize a default configuration file
         
     | 
| 
      
 18 
     | 
    
         
            +
              BANNER
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              opts.on("-h", "--help", "Show this help message") do
         
     | 
| 
      
 21 
     | 
    
         
            +
                puts opts
         
     | 
| 
      
 22 
     | 
    
         
            +
                exit
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            opt_parser.parse!
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            command = ARGV.shift
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            case command
         
     | 
| 
      
 31 
     | 
    
         
            +
            when "push"
         
     | 
| 
      
 32 
     | 
    
         
            +
              Dotsync::Runner.new.run(:push)
         
     | 
| 
      
 33 
     | 
    
         
            +
            when "pull"
         
     | 
| 
      
 34 
     | 
    
         
            +
              Dotsync::Runner.new.run(:pull)
         
     | 
| 
      
 35 
     | 
    
         
            +
            when "watch"
         
     | 
| 
      
 36 
     | 
    
         
            +
              Dotsync::Runner.new.run(:watch)
         
     | 
| 
      
 37 
     | 
    
         
            +
            when "setup"
         
     | 
| 
      
 38 
     | 
    
         
            +
              Dotsync::Runner.new.run(:setup)
         
     | 
| 
      
 39 
     | 
    
         
            +
            else
         
     | 
| 
      
 40 
     | 
    
         
            +
              if command
         
     | 
| 
      
 41 
     | 
    
         
            +
                puts "dotsync: no such command '#{command}'"
         
     | 
| 
      
 42 
     | 
    
         
            +
              else
         
     | 
| 
      
 43 
     | 
    
         
            +
                puts opt_parser.banner
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
              exit 1
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
    
        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.2
         
     | 
| 
       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
         
     |