dotsync 0.1.7 → 0.1.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 +4 -4
 - data/CHANGELOG.md +14 -0
 - data/Gemfile.lock +1 -1
 - data/README.md +41 -19
 - data/exe/dotsync +12 -4
 - data/lib/dotsync/actions/base_action.rb +9 -0
 - data/lib/dotsync/actions/concerns/mappings_transfer.rb +34 -12
 - data/lib/dotsync/actions/pull_action.rb +9 -13
 - data/lib/dotsync/actions/push_action.rb +8 -14
 - data/lib/dotsync/config/{xdg_base_directory_spec.rb → concerns/xdg_base_directory.rb} +4 -4
 - data/lib/dotsync/config/pull_action_config.rb +1 -1
 - data/lib/dotsync/icons.rb +7 -1
 - data/lib/dotsync/models/mapping.rb +22 -6
 - data/lib/dotsync/runner.rb +13 -6
 - data/lib/dotsync/utils/directory_differ.rb +56 -75
 - data/lib/dotsync/utils/path_utils.rb +4 -0
 - data/lib/dotsync/version.rb +1 -1
 - data/lib/dotsync.rb +3 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3499c4ca658689253d20ed6408821dfdc997cb5e9c31aaacb23c4027945c7d57
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1f2d711a45e9e508a57533a0bd0e4a7479f83b52a81afe807895b41bd2408970
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ac05c1125d6a5843e70d7510c7f0717625a3a616932bee521be80d793ce918b8871e92a85975e61a1c7d63e9a929cf25c26c91f1fedd212d0d24c637549a1fce
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 316fb8fe0723d26d6646ea8370124744fc1f2596185c1239bef12a737f0c1b89a7d6531b0bac02b12e5e47407206c0809d2ddacd598e8d6bbe0e6ae93a89c459
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # 0.1.9
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            - Exe: improved banner with options
         
     | 
| 
      
 4 
     | 
    
         
            +
            - Options: added "--apply"
         
     | 
| 
      
 5 
     | 
    
         
            +
            - Options: added "--environment-variables"
         
     | 
| 
      
 6 
     | 
    
         
            +
            - Differ: show full path using original mapping paths
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Readme: add gem version badge
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Readme: add requirements section
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            # 0.1.8
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            - Show full relative path on diff
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Show Diff section header
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       1 
15 
     | 
    
         
             
            # 0.1.7
         
     | 
| 
       2 
16 
     | 
    
         | 
| 
       3 
17 
     | 
    
         
             
            - Fixes broken runner
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,11 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Dotsync
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://rubygems.org/gems/sidekiq)
         
     | 
| 
       5 
4 
     | 
    
         
             
            [](https://github.com/dsaenztagarro/dotsync/actions)
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
      
 6 
     | 
    
         
            +
            > [!WARNING]
         
     | 
| 
      
 7 
     | 
    
         
            +
            > This gem is under active development. You can expect new changes that may not be backward-compatible.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       7 
9 
     | 
    
         
             
            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.
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            ## Requirements
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Ruby: MRI 3.2+
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       9 
14 
     | 
    
         
             
            ## Installation
         
     | 
| 
       10 
15 
     | 
    
         | 
| 
       11 
16 
     | 
    
         
             
            Add this line to your application's Gemfile:
         
     | 
| 
         @@ -55,25 +60,42 @@ Dotsync provides the following commands to manage your dotfiles: 
     | 
|
| 
       55 
60 
     | 
    
         
             
            The configuration file uses a `mappings` structure to define the source and destination of your dotfiles. Here is an example:
         
     | 
| 
       56 
61 
     | 
    
         | 
| 
       57 
62 
     | 
    
         
             
            ```toml
         
     | 
| 
       58 
     | 
    
         
            -
            [pull]
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            ]
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
            mappings 
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 63 
     | 
    
         
            +
            [[pull.mappings]]
         
     | 
| 
      
 64 
     | 
    
         
            +
            src = "$XDG_CONFIG_HOME_MIRROR"
         
     | 
| 
      
 65 
     | 
    
         
            +
            dest = "$XDG_CONFIG_HOME"
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
            [[pull.mappings]]
         
     | 
| 
      
 68 
     | 
    
         
            +
            src = "$HOME_MIRROR/.zshenv"
         
     | 
| 
      
 69 
     | 
    
         
            +
            dest = "$HOME" }
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            [[push.mappings]]
         
     | 
| 
      
 73 
     | 
    
         
            +
            src = "$HOME/.zshenv"
         
     | 
| 
      
 74 
     | 
    
         
            +
            src = "$HOME_MIRROR/.zshenv"
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            [[push.mappings]]
         
     | 
| 
      
 77 
     | 
    
         
            +
            src = "$XDG_CONFIG_HOME/alacritty"
         
     | 
| 
      
 78 
     | 
    
         
            +
            dest = "$DOTFILES_DIR/config/alacritty"
         
     | 
| 
      
 79 
     | 
    
         
            +
            force = true # it forces the deletion of destination folder
         
     | 
| 
      
 80 
     | 
    
         
            +
            ignore = ["themes/rose-pine.toml"] # use relative paths to "dest" to ignore files and folders
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            [[watch.mappings]]
         
     | 
| 
      
 84 
     | 
    
         
            +
            src = "$HOME/.zshenv"
         
     | 
| 
      
 85 
     | 
    
         
            +
            src = "$HOME_MIRROR/.zshenv"
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            [[watch.mappings]]
         
     | 
| 
      
 88 
     | 
    
         
            +
            src = "$XDG_CONFIG_HOME/alacritty"
         
     | 
| 
      
 89 
     | 
    
         
            +
            dest = "$DOTFILES_DIR/config/alacritty"
         
     | 
| 
       75 
90 
     | 
    
         
             
            ```
         
     | 
| 
       76 
91 
     | 
    
         | 
| 
      
 92 
     | 
    
         
            +
            > [!TIP]
         
     | 
| 
      
 93 
     | 
    
         
            +
            > I use mirror environment variables to cleaner configuration
         
     | 
| 
      
 94 
     | 
    
         
            +
            >
         
     | 
| 
      
 95 
     | 
    
         
            +
            >  ```bash
         
     | 
| 
      
 96 
     | 
    
         
            +
            >  export XDG_CONFIG_HOME_MIRROR="$HOME/Code/dotfiles/xdg_config_home"
         
     | 
| 
      
 97 
     | 
    
         
            +
            >  ```
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
       77 
99 
     | 
    
         
             
            #### `force` and `ignore` Options in Mappings
         
     | 
| 
       78 
100 
     | 
    
         | 
| 
       79 
101 
     | 
    
         
             
            Each mapping entry supports the following options:
         
     | 
    
        data/exe/dotsync
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require_relative "../lib/dotsync"
         
     | 
| 
       5 
5 
     | 
    
         
             
            require "optparse"
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            {}
         
     | 
| 
      
 7 
     | 
    
         
            +
            options = { apply: false }
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            opt_parser = OptionParser.new do |opts|
         
     | 
| 
       10 
10 
     | 
    
         
             
              opts.banner = <<~BANNER
         
     | 
| 
         @@ -16,10 +16,18 @@ opt_parser = OptionParser.new do |opts| 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  pull   Download remote changes to the local
         
     | 
| 
       17 
17 
     | 
    
         
             
                  watch  Continuously monitor and sync changes
         
     | 
| 
       18 
18 
     | 
    
         
             
                  setup  Initialize a default configuration file
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                Options:
         
     | 
| 
      
 21 
     | 
    
         
            +
                  -a, --apply   Apply changes (push or pull)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  -h, --help    Show this help message
         
     | 
| 
       19 
23 
     | 
    
         
             
              BANNER
         
     | 
| 
       20 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
              opts.on("-a", "--apply", "Apply changes (push or pull)") do
         
     | 
| 
      
 26 
     | 
    
         
            +
                options[:apply] = true
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       21 
29 
     | 
    
         
             
              opts.on("-h", "--help", "Show this help message") do
         
     | 
| 
       22 
     | 
    
         
            -
                puts  
     | 
| 
      
 30 
     | 
    
         
            +
                puts opt_parser.banner
         
     | 
| 
       23 
31 
     | 
    
         
             
                exit
         
     | 
| 
       24 
32 
     | 
    
         
             
              end
         
     | 
| 
       25 
33 
     | 
    
         
             
            end
         
     | 
| 
         @@ -30,9 +38,9 @@ command = ARGV.shift 
     | 
|
| 
       30 
38 
     | 
    
         | 
| 
       31 
39 
     | 
    
         
             
            case command
         
     | 
| 
       32 
40 
     | 
    
         
             
            when "push"
         
     | 
| 
       33 
     | 
    
         
            -
              Dotsync::Runner.new.run(:push)
         
     | 
| 
      
 41 
     | 
    
         
            +
              Dotsync::Runner.new.run(:push, options)
         
     | 
| 
       34 
42 
     | 
    
         
             
            when "pull"
         
     | 
| 
       35 
     | 
    
         
            -
              Dotsync::Runner.new.run(:pull)
         
     | 
| 
      
 43 
     | 
    
         
            +
              Dotsync::Runner.new.run(:pull, options)
         
     | 
| 
       36 
44 
     | 
    
         
             
            when "watch"
         
     | 
| 
       37 
45 
     | 
    
         
             
              Dotsync::Runner.new.run(:watch)
         
     | 
| 
       38 
46 
     | 
    
         
             
            when "setup"
         
     | 
| 
         @@ -18,5 +18,14 @@ module Dotsync 
     | 
|
| 
       18 
18 
     | 
    
         
             
                def execute
         
     | 
| 
       19 
19 
     | 
    
         
             
                  raise NotImplementedError
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                private
         
     | 
| 
      
 23 
     | 
    
         
            +
                  def show_options(options)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    info("Options:", icon: :options)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    logger.log("  Apply: #{options[:apply] ? "TRUE" : "FALSE"}")
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  def show_env_vars
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
       21 
30 
     | 
    
         
             
              end
         
     | 
| 
       22 
31 
     | 
    
         
             
            end
         
     | 
| 
         @@ -6,8 +6,18 @@ module Dotsync 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def_delegator :@config, :mappings
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
                def show_env_vars
         
     | 
| 
      
 10 
     | 
    
         
            +
                  env_vars = mappings_env_vars
         
     | 
| 
      
 11 
     | 
    
         
            +
                  return unless env_vars.any?
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  info("Environment variables:", icon: :env_vars)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  env_vars.each do |env_var|
         
     | 
| 
      
 15 
     | 
    
         
            +
                    logger.log("  #{env_var}: #{ENV[env_var]}")
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       9 
19 
     | 
    
         
             
                def show_mappings
         
     | 
| 
       10 
     | 
    
         
            -
                  info("Mappings:", icon: :config 
     | 
| 
      
 20 
     | 
    
         
            +
                  info("Mappings:", icon: :config)
         
     | 
| 
       11 
21 
     | 
    
         | 
| 
       12 
22 
     | 
    
         
             
                  mappings.each do |mapping|
         
     | 
| 
       13 
23 
     | 
    
         
             
                    logger.log("  #{mapping}")
         
     | 
| 
         @@ -18,14 +28,17 @@ module Dotsync 
     | 
|
| 
       18 
28 
     | 
    
         
             
                  diffs = valid_mappings.map do |mapping|
         
     | 
| 
       19 
29 
     | 
    
         
             
                    Dotsync::DirectoryDiffer.new(mapping).diff
         
     | 
| 
       20 
30 
     | 
    
         
             
                  end
         
     | 
| 
       21 
     | 
    
         
            -
                  diffs. 
     | 
| 
       22 
     | 
    
         
            -
                     
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                     
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
      
 31 
     | 
    
         
            +
                  if diffs.any?
         
     | 
| 
      
 32 
     | 
    
         
            +
                    info("Diff:", icon: :diff)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    diffs.flat_map(&:additions).sort.each do |path|
         
     | 
| 
      
 34 
     | 
    
         
            +
                      logger.log("  #{path}", color: Dotsync::Colors.diff_additions)
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
                    diffs.flat_map(&:modifications).sort.each do |path|
         
     | 
| 
      
 37 
     | 
    
         
            +
                      logger.log("  #{path}", color: Dotsync::Colors.diff_modifications)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
                    diffs.flat_map(&:removals).sort.each do |path|
         
     | 
| 
      
 40 
     | 
    
         
            +
                      logger.log("  #{path}", color: Dotsync::Colors.diff_removals)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    end
         
     | 
| 
       29 
42 
     | 
    
         
             
                  end
         
     | 
| 
       30 
43 
     | 
    
         
             
                end
         
     | 
| 
       31 
44 
     | 
    
         | 
| 
         @@ -35,8 +48,17 @@ module Dotsync 
     | 
|
| 
       35 
48 
     | 
    
         
             
                  end
         
     | 
| 
       36 
49 
     | 
    
         
             
                end
         
     | 
| 
       37 
50 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                 
     | 
| 
       39 
     | 
    
         
            -
                   
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
                private
         
     | 
| 
      
 52 
     | 
    
         
            +
                  def mappings_env_vars
         
     | 
| 
      
 53 
     | 
    
         
            +
                    paths = mappings.flat_map do |mapping|
         
     | 
| 
      
 54 
     | 
    
         
            +
                      [mapping.original_src, mapping.original_dest]
         
     | 
| 
      
 55 
     | 
    
         
            +
                    end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                    paths.flat_map { |path| extract_env_vars(path) }.uniq
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  def valid_mappings
         
     | 
| 
      
 61 
     | 
    
         
            +
                    mappings.select(&:valid?)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
       41 
63 
     | 
    
         
             
              end
         
     | 
| 
       42 
64 
     | 
    
         
             
            end
         
     | 
| 
         @@ -6,27 +6,23 @@ module Dotsync 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def_delegator :@config, :backups_root
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                def execute
         
     | 
| 
       10 
     | 
    
         
            -
                   
     | 
| 
      
 9 
     | 
    
         
            +
                def execute(options = {})
         
     | 
| 
      
 10 
     | 
    
         
            +
                  show_options(options)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  show_env_vars
         
     | 
| 
      
 12 
     | 
    
         
            +
                  show_mappings
         
     | 
| 
       11 
13 
     | 
    
         
             
                  show_changes
         
     | 
| 
      
 14 
     | 
    
         
            +
                  return unless options[:apply]
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       12 
16 
     | 
    
         
             
                  if create_backup
         
     | 
| 
       13 
17 
     | 
    
         
             
                    show_backup
         
     | 
| 
       14 
18 
     | 
    
         
             
                    purge_old_backups
         
     | 
| 
       15 
19 
     | 
    
         
             
                  end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  transfer_mappings
         
     | 
| 
      
 22 
     | 
    
         
            +
                  action("Dotfiles pulled")
         
     | 
| 
       17 
23 
     | 
    
         
             
                end
         
     | 
| 
       18 
24 
     | 
    
         | 
| 
       19 
25 
     | 
    
         
             
                private
         
     | 
| 
       20 
     | 
    
         
            -
                  def show_config
         
     | 
| 
       21 
     | 
    
         
            -
                    show_mappings
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  def pull_dotfiles
         
     | 
| 
       25 
     | 
    
         
            -
                    transfer_mappings
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    action("Dotfiles pulled")
         
     | 
| 
       28 
     | 
    
         
            -
                  end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
26 
     | 
    
         
             
                  def show_backup
         
     | 
| 
       31 
27 
     | 
    
         
             
                    action("Backup created:")
         
     | 
| 
       32 
28 
     | 
    
         
             
                    logger.log("  #{backup_root_path}")
         
     | 
| 
         @@ -4,21 +4,15 @@ module Dotsync 
     | 
|
| 
       4 
4 
     | 
    
         
             
              class PushAction < BaseAction
         
     | 
| 
       5 
5 
     | 
    
         
             
                include MappingsTransfer
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                def execute
         
     | 
| 
       8 
     | 
    
         
            -
                   
     | 
| 
      
 7 
     | 
    
         
            +
                def execute(options = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                  show_options(options)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  show_env_vars
         
     | 
| 
      
 10 
     | 
    
         
            +
                  show_mappings
         
     | 
| 
       9 
11 
     | 
    
         
             
                  show_changes
         
     | 
| 
       10 
     | 
    
         
            -
                   
     | 
| 
       11 
     | 
    
         
            -
                end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                private
         
     | 
| 
       14 
     | 
    
         
            -
                  def show_config
         
     | 
| 
       15 
     | 
    
         
            -
                    show_mappings
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
                  return unless options[:apply]
         
     | 
| 
       17 
13 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    action("Dotfiles pushed", icon: :copy)
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  transfer_mappings
         
     | 
| 
      
 15 
     | 
    
         
            +
                  action("Dotfiles pushed", icon: :copy)
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
       23 
17 
     | 
    
         
             
              end
         
     | 
| 
       24 
18 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,20 +2,20 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Dotsync
         
     | 
| 
       4 
4 
     | 
    
         
             
              # https://specifications.freedesktop.org/basedir-spec/latest/
         
     | 
| 
       5 
     | 
    
         
            -
              module  
     | 
| 
      
 5 
     | 
    
         
            +
              module XDGBaseDirectory
         
     | 
| 
       6 
6 
     | 
    
         
             
                def xdg_data_home
         
     | 
| 
       7 
7 
     | 
    
         
             
                  File.expand_path(ENV["XDG_DATA_HOME"] || "$HOME/.local/share")
         
     | 
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                def  
     | 
| 
      
 10 
     | 
    
         
            +
                def xdg_config_home
         
     | 
| 
       11 
11 
     | 
    
         
             
                  File.expand_path(ENV["XDG_CONFIG_HOME"] || "$HOME/.config")
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                def  
     | 
| 
      
 14 
     | 
    
         
            +
                def xdg_cache_home
         
     | 
| 
       15 
15 
     | 
    
         
             
                  File.expand_path(ENV["XDG_CACHE_HOME"] || "$HOME/.cache")
         
     | 
| 
       16 
16 
     | 
    
         
             
                end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                def  
     | 
| 
      
 18 
     | 
    
         
            +
                def xdg_bin_home
         
     | 
| 
       19 
19 
     | 
    
         
             
                  File.expand_path(ENV["XDG_BIN_HOME"] || "$HOME/.local/bin")
         
     | 
| 
       20 
20 
     | 
    
         
             
                end
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
    
        data/lib/dotsync/icons.rb
    CHANGED
    
    | 
         @@ -7,7 +7,10 @@ module Dotsync 
     | 
|
| 
       7 
7 
     | 
    
         
             
                ERROR = " "
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                # Configuration icon
         
     | 
| 
      
 10 
     | 
    
         
            +
                OPTIONS = " "
         
     | 
| 
      
 11 
     | 
    
         
            +
                ENV_VARS = " "
         
     | 
| 
       10 
12 
     | 
    
         
             
                CONFIG = " "
         
     | 
| 
      
 13 
     | 
    
         
            +
                DIFF = " "
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
       12 
15 
     | 
    
         
             
                # Default Mapping icons
         
     | 
| 
       13 
16 
     | 
    
         
             
                DEFAULT_FORCE = " "
         
     | 
| 
         @@ -19,8 +22,8 @@ module Dotsync 
     | 
|
| 
       19 
22 
     | 
    
         
             
                PUSH = " "
         
     | 
| 
       20 
23 
     | 
    
         
             
                WATCH = " "
         
     | 
| 
       21 
24 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                # TODO: review icons needed
         
     | 
| 
       23 
25 
     | 
    
         
             
                CONSOLE = " "
         
     | 
| 
      
 26 
     | 
    
         
            +
                # TODO: review icons needed
         
     | 
| 
       24 
27 
     | 
    
         
             
                LISTEN = " "
         
     | 
| 
       25 
28 
     | 
    
         
             
                SOURCE = " " #  "
         
     | 
| 
       26 
29 
     | 
    
         
             
                DEST = " " # " "
         
     | 
| 
         @@ -56,7 +59,10 @@ module Dotsync 
     | 
|
| 
       56 
59 
     | 
    
         
             
                MAPPINGS = {
         
     | 
| 
       57 
60 
     | 
    
         
             
                  info: INFO,
         
     | 
| 
       58 
61 
     | 
    
         
             
                  error: ERROR,
         
     | 
| 
      
 62 
     | 
    
         
            +
                  env_vars: ENV_VARS,
         
     | 
| 
      
 63 
     | 
    
         
            +
                  options: OPTIONS,
         
     | 
| 
       59 
64 
     | 
    
         
             
                  config: CONFIG,
         
     | 
| 
      
 65 
     | 
    
         
            +
                  diff: DIFF,
         
     | 
| 
       60 
66 
     | 
    
         
             
                  force: -> { force },
         
     | 
| 
       61 
67 
     | 
    
         
             
                  ignore: -> { ignore },
         
     | 
| 
       62 
68 
     | 
    
         
             
                  pull: PULL,
         
     | 
| 
         @@ -12,9 +12,11 @@ module Dotsync 
     | 
|
| 
       12 
12 
     | 
    
         
             
                  @original_ignores = Array(attributes["ignore"])
         
     | 
| 
       13 
13 
     | 
    
         
             
                  @force = attributes["force"] || false
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                  @sanitized_src =  
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
                  @sanitized_src, @sanitized_dest, @sanitized_ignore = process_paths(
         
     | 
| 
      
 16 
     | 
    
         
            +
                    @original_src,
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @original_dest,
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @original_ignores
         
     | 
| 
      
 19 
     | 
    
         
            +
                  )
         
     | 
| 
       18 
20 
     | 
    
         
             
                end
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
                def src
         
     | 
| 
         @@ -33,10 +35,17 @@ module Dotsync 
     | 
|
| 
       33 
35 
     | 
    
         
             
                  @force
         
     | 
| 
       34 
36 
     | 
    
         
             
                end
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                def directories?
         
     | 
| 
      
 39 
     | 
    
         
            +
                  File.directory?(src) && File.directory?(dest)
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def files?
         
     | 
| 
      
 43 
     | 
    
         
            +
                  return true if File.file?(src) && File.file?(dest)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  File.file?(src) && !File.exist?(dest) && File.directory?(File.dirname(dest))
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       36 
47 
     | 
    
         
             
                def valid?
         
     | 
| 
       37 
     | 
    
         
            -
                   
     | 
| 
       38 
     | 
    
         
            -
                  (File.directory?(src) && File.directory?(dest)) ||
         
     | 
| 
       39 
     | 
    
         
            -
                  (File.file?(src) && !File.exist?(dest) && File.directory?(File.dirname(dest)))
         
     | 
| 
      
 48 
     | 
    
         
            +
                  directories? || files?
         
     | 
| 
       40 
49 
     | 
    
         
             
                end
         
     | 
| 
       41 
50 
     | 
    
         | 
| 
       42 
51 
     | 
    
         
             
                def backup_possible?
         
     | 
| 
         @@ -78,5 +87,12 @@ module Dotsync 
     | 
|
| 
       78 
87 
     | 
    
         
             
                  def ignores?
         
     | 
| 
       79 
88 
     | 
    
         
             
                    @original_ignores.any?
         
     | 
| 
       80 
89 
     | 
    
         
             
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                  def process_paths(src, dest, ignores)
         
     | 
| 
      
 92 
     | 
    
         
            +
                    sanitized_src = sanitize_path(src)
         
     | 
| 
      
 93 
     | 
    
         
            +
                    sanitized_dest = sanitize_path(dest)
         
     | 
| 
      
 94 
     | 
    
         
            +
                    sanitized_ignore = ignores.map { |path| File.join(sanitized_src, path) }
         
     | 
| 
      
 95 
     | 
    
         
            +
                    [sanitized_src, sanitized_dest, sanitized_ignore]
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
       81 
97 
     | 
    
         
             
              end
         
     | 
| 
       82 
98 
     | 
    
         
             
            end
         
     | 
    
        data/lib/dotsync/runner.rb
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ module Dotsync 
     | 
|
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                # action_name should be a symbol, e.g., :pull, :watch, :sync
         
     | 
| 
       10 
     | 
    
         
            -
                def run(action_name)
         
     | 
| 
      
 10 
     | 
    
         
            +
                def run(action_name, options = {})
         
     | 
| 
       11 
11 
     | 
    
         
             
                  case action_name
         
     | 
| 
       12 
12 
     | 
    
         
             
                  when :setup
         
     | 
| 
       13 
13 
     | 
    
         
             
                    setup_config
         
     | 
| 
         @@ -22,7 +22,7 @@ module Dotsync 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                      action = action_class.new(config, @logger)
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                      action.execute
         
     | 
| 
      
 25 
     | 
    
         
            +
                      action.execute(options)
         
     | 
| 
       26 
26 
     | 
    
         
             
                    rescue ConfigError => e
         
     | 
| 
       27 
27 
     | 
    
         
             
                      @logger.error("[#{action_name}] config error:")
         
     | 
| 
       28 
28 
     | 
    
         
             
                      @logger.info(e.message)
         
     | 
| 
         @@ -46,21 +46,28 @@ module Dotsync 
     | 
|
| 
       46 
46 
     | 
    
         
             
                    FileUtils.mkdir_p(File.dirname(config_path))
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                    example_mappings = {
         
     | 
| 
      
 49 
     | 
    
         
            +
                      "icons" => {
         
     | 
| 
      
 50 
     | 
    
         
            +
                        "options" => "⚙️",
         
     | 
| 
      
 51 
     | 
    
         
            +
                        "config" => "📄",
         
     | 
| 
      
 52 
     | 
    
         
            +
                        "force" => "🔥",
         
     | 
| 
      
 53 
     | 
    
         
            +
                        "ignore" => "🚫",
         
     | 
| 
      
 54 
     | 
    
         
            +
                        "invalid" => "❌"
         
     | 
| 
      
 55 
     | 
    
         
            +
                      },
         
     | 
| 
       49 
56 
     | 
    
         
             
                      "pull" => {
         
     | 
| 
       50 
57 
     | 
    
         
             
                        "mappings" => [
         
     | 
| 
       51 
     | 
    
         
            -
                          { "src" => "$ 
     | 
| 
       52 
     | 
    
         
            -
                          { "src" => "$ 
     | 
| 
      
 58 
     | 
    
         
            +
                          { "src" => "$XDG_CONFIG_HOME_MIRROR", "dest" => "$XDG_CONFIG_HOME" },
         
     | 
| 
      
 59 
     | 
    
         
            +
                          { "src" => "$HOME_MIRROR/.zshenv", "dest" => "$HOME" }
         
     | 
| 
       53 
60 
     | 
    
         
             
                        ],
         
     | 
| 
       54 
61 
     | 
    
         
             
                      },
         
     | 
| 
       55 
62 
     | 
    
         
             
                      "push" => {
         
     | 
| 
       56 
63 
     | 
    
         
             
                        "mappings" => [
         
     | 
| 
       57 
64 
     | 
    
         
             
                          { "src" => "$HOME/.zshenv", "dest" => "$DOTFILES_DIR/home/.zshenv" },
         
     | 
| 
       58 
     | 
    
         
            -
                          { "src" => "$XDG_CONFIG_HOME/alacritty", "dest" => "$ 
     | 
| 
      
 65 
     | 
    
         
            +
                          { "src" => "$XDG_CONFIG_HOME/alacritty", "dest" => "$XDG_CONFIG_HOME_MIRROR/alacritty" }
         
     | 
| 
       59 
66 
     | 
    
         
             
                        ]
         
     | 
| 
       60 
67 
     | 
    
         
             
                      },
         
     | 
| 
       61 
68 
     | 
    
         
             
                      "watch" => {
         
     | 
| 
       62 
69 
     | 
    
         
             
                        "mappings" => [
         
     | 
| 
       63 
     | 
    
         
            -
                          { "src" => "$HOME/.zshenv", "dest" => "$ 
     | 
| 
      
 70 
     | 
    
         
            +
                          { "src" => "$HOME/.zshenv", "dest" => "$HOME_MIRROR/.zshenv" },
         
     | 
| 
       64 
71 
     | 
    
         
             
                          { "src" => "$XDG_CONFIG_HOME/alacritty", "dest" => "$DOTFILES_DIR/config/alacritty" }
         
     | 
| 
       65 
72 
     | 
    
         
             
                        ]
         
     | 
| 
       66 
73 
     | 
    
         
             
                      }
         
     | 
| 
         @@ -1,103 +1,84 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Dotsync
         
     | 
| 
       4 
     | 
    
         
            -
              # Usage:
         
     | 
| 
       5 
     | 
    
         
            -
              # differ = DirectoryDiffer.new("/path/to/src", "/path/to/dest")
         
     | 
| 
       6 
     | 
    
         
            -
              # differences = differ.diff
         
     | 
| 
       7 
4 
     | 
    
         
             
              class DirectoryDiffer
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                #  
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
       16 
     | 
    
         
            -
                 
     | 
| 
      
 5 
     | 
    
         
            +
                extend Forwardable
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                # attr_reader :src, :dest
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def_delegator :@mapping, :src, :mapping_src
         
     | 
| 
      
 10 
     | 
    
         
            +
                def_delegator :@mapping, :dest, :mapping_dest
         
     | 
| 
      
 11 
     | 
    
         
            +
                def_delegator :@mapping, :original_src, :mapping_original_src
         
     | 
| 
      
 12 
     | 
    
         
            +
                def_delegator :@mapping, :original_dest, :mapping_original_dest
         
     | 
| 
      
 13 
     | 
    
         
            +
                def_delegator :@mapping, :force?, :force?
         
     | 
| 
      
 14 
     | 
    
         
            +
                def_delegator :@mapping, :original_ignores, :ignores
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       17 
16 
     | 
    
         
             
                def initialize(mapping)
         
     | 
| 
       18 
     | 
    
         
            -
                  @ 
     | 
| 
       19 
     | 
    
         
            -
                  @dest = mapping.dest
         
     | 
| 
       20 
     | 
    
         
            -
                  @force = mapping.force?
         
     | 
| 
       21 
     | 
    
         
            -
                  @ignores = mapping.original_ignores || []
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @mapping = mapping
         
     | 
| 
       22 
18 
     | 
    
         
             
                end
         
     | 
| 
       23 
19 
     | 
    
         | 
| 
       24 
20 
     | 
    
         
             
                def diff
         
     | 
| 
       25 
     | 
    
         
            -
                   
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                   
     | 
| 
      
 21 
     | 
    
         
            +
                  if @mapping.directories?
         
     | 
| 
      
 22 
     | 
    
         
            +
                    diff_mapping_directories
         
     | 
| 
      
 23 
     | 
    
         
            +
                  elsif @mapping.files?
         
     | 
| 
      
 24 
     | 
    
         
            +
                    diff_mapping_files
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                private
         
     | 
| 
      
 29 
     | 
    
         
            +
                  def diff_mapping_directories
         
     | 
| 
      
 30 
     | 
    
         
            +
                    additions = []
         
     | 
| 
      
 31 
     | 
    
         
            +
                    modifications = []
         
     | 
| 
      
 32 
     | 
    
         
            +
                    removals = []
         
     | 
| 
       28 
33 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                    next if rel_path.empty?
         
     | 
| 
      
 34 
     | 
    
         
            +
                    Find.find(mapping_src) do |src_path|
         
     | 
| 
      
 35 
     | 
    
         
            +
                      rel_path = src_path.sub(/^#{Regexp.escape(mapping_src)}\/?/, "")
         
     | 
| 
       32 
36 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 37 
     | 
    
         
            +
                      dest_path = File.join(mapping_dest, rel_path)
         
     | 
| 
       34 
38 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                      if !File.exist?(dest_path)
         
     | 
| 
      
 40 
     | 
    
         
            +
                        additions << rel_path
         
     | 
| 
      
 41 
     | 
    
         
            +
                      elsif File.file?(src_path) && File.file?(dest_path)
         
     | 
| 
      
 42 
     | 
    
         
            +
                        if File.size(src_path) != File.size(dest_path)
         
     | 
| 
      
 43 
     | 
    
         
            +
                          modifications << rel_path
         
     | 
| 
      
 44 
     | 
    
         
            +
                        end
         
     | 
| 
       40 
45 
     | 
    
         
             
                      end
         
     | 
| 
       41 
46 
     | 
    
         
             
                    end
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
47 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
                    if force?
         
     | 
| 
      
 49 
     | 
    
         
            +
                      Find.find(mapping_dest) do |dest_path|
         
     | 
| 
      
 50 
     | 
    
         
            +
                        rel_path = dest_path.sub(/^#{Regexp.escape(mapping_dest)}\/?/, "")
         
     | 
| 
      
 51 
     | 
    
         
            +
                        next if rel_path.empty?
         
     | 
| 
       48 
52 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
      
 53 
     | 
    
         
            +
                        src_path = File.join(mapping_src, rel_path)
         
     | 
| 
       50 
54 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 55 
     | 
    
         
            +
                        if !File.exist?(src_path)
         
     | 
| 
      
 56 
     | 
    
         
            +
                          removals << rel_path
         
     | 
| 
      
 57 
     | 
    
         
            +
                        end
         
     | 
| 
       53 
58 
     | 
    
         
             
                      end
         
     | 
| 
       54 
59 
     | 
    
         
             
                    end
         
     | 
| 
       55 
     | 
    
         
            -
                  end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                  if @ignores.any?
         
     | 
| 
       58 
     | 
    
         
            -
                    additions = filter_paths(additions, @ignores)
         
     | 
| 
       59 
     | 
    
         
            -
                    modifications = filter_paths(modifications, @ignores)
         
     | 
| 
       60 
     | 
    
         
            -
                    removals = filter_paths(removals, @ignores)
         
     | 
| 
       61 
     | 
    
         
            -
                  end
         
     | 
| 
       62 
60 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
                    diffs = []
         
     | 
| 
       69 
     | 
    
         
            -
                    Find.find(src) do |src_path|
         
     | 
| 
       70 
     | 
    
         
            -
                      rel_path = src_path.sub(/^#{Regexp.escape(src)}\/?/, "")
         
     | 
| 
       71 
     | 
    
         
            -
                      next if rel_path.empty?
         
     | 
| 
      
 61 
     | 
    
         
            +
                    if ignores.any?
         
     | 
| 
      
 62 
     | 
    
         
            +
                      additions = filter_paths(additions, ignores)
         
     | 
| 
      
 63 
     | 
    
         
            +
                      modifications = filter_paths(modifications, ignores)
         
     | 
| 
      
 64 
     | 
    
         
            +
                      removals = filter_paths(removals, ignores)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    end
         
     | 
| 
       72 
66 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
      
 67 
     | 
    
         
            +
                    additions.map! { |rel_path| File.join(mapping_original_dest, rel_path) }
         
     | 
| 
      
 68 
     | 
    
         
            +
                    modifications.map! { |rel_path| File.join(mapping_original_dest, rel_path) }
         
     | 
| 
      
 69 
     | 
    
         
            +
                    removals.map! { |rel_path| File.join(mapping_original_src, rel_path) }
         
     | 
| 
       74 
70 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                        diffs << rel_path
         
     | 
| 
       77 
     | 
    
         
            -
                      elsif File.directory?(src_path) && !File.directory?(dest_path)
         
     | 
| 
       78 
     | 
    
         
            -
                        diffs << rel_path
         
     | 
| 
       79 
     | 
    
         
            -
                      elsif File.file?(src_path) && !File.file?(dest_path)
         
     | 
| 
       80 
     | 
    
         
            -
                        diffs << rel_path
         
     | 
| 
       81 
     | 
    
         
            -
                      elsif File.file?(src_path) && File.file?(dest_path)
         
     | 
| 
       82 
     | 
    
         
            -
                        if File.size(src_path) != File.size(dest_path)
         
     | 
| 
       83 
     | 
    
         
            -
                          diffs << rel_path
         
     | 
| 
       84 
     | 
    
         
            -
                        end
         
     | 
| 
       85 
     | 
    
         
            -
                      end
         
     | 
| 
       86 
     | 
    
         
            -
                    end
         
     | 
| 
       87 
     | 
    
         
            -
                    diffs
         
     | 
| 
      
 71 
     | 
    
         
            +
                    Dotsync::Diff.new(additions: additions, modifications: modifications, removals: removals)
         
     | 
| 
       88 
72 
     | 
    
         
             
                  end
         
     | 
| 
       89 
73 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                  def  
     | 
| 
       91 
     | 
    
         
            -
                     
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                       
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                      if !File.exist?(src_path)
         
     | 
| 
       97 
     | 
    
         
            -
                        diffs << rel_path
         
     | 
| 
      
 74 
     | 
    
         
            +
                  def diff_mapping_files
         
     | 
| 
      
 75 
     | 
    
         
            +
                    Dotsync::Diff.new.tap do |diff|
         
     | 
| 
      
 76 
     | 
    
         
            +
                      if !File.exist?(@mapping.dest)
         
     | 
| 
      
 77 
     | 
    
         
            +
                        diff.additions << @mapping.original_dest
         
     | 
| 
      
 78 
     | 
    
         
            +
                      else
         
     | 
| 
      
 79 
     | 
    
         
            +
                        diff.modifications << @mapping.original_dest
         
     | 
| 
       98 
80 
     | 
    
         
             
                      end
         
     | 
| 
       99 
81 
     | 
    
         
             
                    end
         
     | 
| 
       100 
     | 
    
         
            -
                    diffs
         
     | 
| 
       101 
82 
     | 
    
         
             
                  end
         
     | 
| 
       102 
83 
     | 
    
         | 
| 
       103 
84 
     | 
    
         
             
                  def filter_paths(all_paths, ignore_paths)
         
     | 
    
        data/lib/dotsync/version.rb
    CHANGED
    
    
    
        data/lib/dotsync.rb
    CHANGED
    
    | 
         @@ -19,8 +19,10 @@ require_relative "dotsync/utils/path_utils" 
     | 
|
| 
       19 
19 
     | 
    
         
             
            require_relative "dotsync/models/mapping"
         
     | 
| 
       20 
20 
     | 
    
         
             
            require_relative "dotsync/models/diff"
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
            # Config Concerns
         
     | 
| 
      
 23 
     | 
    
         
            +
            require_relative "dotsync/config/concerns/xdg_base_directory"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       22 
25 
     | 
    
         
             
            # Config
         
     | 
| 
       23 
     | 
    
         
            -
            require_relative "dotsync/config/xdg_base_directory_spec"
         
     | 
| 
       24 
26 
     | 
    
         
             
            require_relative "dotsync/config/base_config"
         
     | 
| 
       25 
27 
     | 
    
         
             
            require_relative "dotsync/config/pull_action_config"
         
     | 
| 
       26 
28 
     | 
    
         
             
            require_relative "dotsync/config/push_action_config"
         
     | 
    
        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.9
         
     | 
| 
       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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-11-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: toml-rb
         
     | 
| 
         @@ -256,10 +256,10 @@ files: 
     | 
|
| 
       256 
256 
     | 
    
         
             
            - lib/dotsync/actions/watch_action.rb
         
     | 
| 
       257 
257 
     | 
    
         
             
            - lib/dotsync/colors.rb
         
     | 
| 
       258 
258 
     | 
    
         
             
            - lib/dotsync/config/base_config.rb
         
     | 
| 
      
 259 
     | 
    
         
            +
            - lib/dotsync/config/concerns/xdg_base_directory.rb
         
     | 
| 
       259 
260 
     | 
    
         
             
            - lib/dotsync/config/pull_action_config.rb
         
     | 
| 
       260 
261 
     | 
    
         
             
            - lib/dotsync/config/push_action_config.rb
         
     | 
| 
       261 
262 
     | 
    
         
             
            - lib/dotsync/config/watch_action_config.rb
         
     | 
| 
       262 
     | 
    
         
            -
            - lib/dotsync/config/xdg_base_directory_spec.rb
         
     | 
| 
       263 
263 
     | 
    
         
             
            - lib/dotsync/errors.rb
         
     | 
| 
       264 
264 
     | 
    
         
             
            - lib/dotsync/icons.rb
         
     | 
| 
       265 
265 
     | 
    
         
             
            - lib/dotsync/models/diff.rb
         
     |