dotsync 0.1.4 → 0.1.6
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 +4 -0
 - data/.rubocop.yml +353 -0
 - data/CHANGELOG.md +19 -9
 - data/Gemfile +0 -7
 - data/Gemfile.lock +20 -1
 - data/README.md +1 -1
 - data/Rakefile +4 -2
 - data/dotsync.gemspec +8 -1
 - data/exe/console +1 -0
 - data/exe/dotsync +4 -4
 - data/lib/dotsync/actions/base_action.rb +2 -0
 - data/lib/dotsync/actions/concerns/mappings_transfer.rb +18 -1
 - data/lib/dotsync/actions/pull_action.rb +19 -15
 - data/lib/dotsync/actions/push_action.rb +10 -8
 - data/lib/dotsync/actions/watch_action.rb +2 -1
 - data/lib/dotsync/colors.rb +37 -0
 - data/lib/dotsync/{actions/config → config}/base_config.rb +2 -1
 - data/lib/dotsync/{actions/config → config}/pull_action_config.rb +3 -2
 - data/lib/dotsync/{actions/config → config}/push_action_config.rb +3 -2
 - data/lib/dotsync/{actions/config → config}/watch_action_config.rb +2 -2
 - data/lib/dotsync/{actions/config → config}/xdg_base_directory_spec.rb +2 -0
 - data/lib/dotsync/errors.rb +3 -0
 - data/lib/dotsync/icons.rb +3 -1
 - data/lib/dotsync/models/diff.rb +18 -0
 - data/lib/dotsync/{actions/config/mapping_entry.rb → models/mapping.rb} +25 -13
 - data/lib/dotsync/runner.rb +37 -32
 - data/lib/dotsync/tasks/actions.rake +3 -1
 - data/lib/dotsync/utils/directory_differ.rb +111 -0
 - data/lib/dotsync/utils/file_transfer.rb +57 -0
 - data/lib/dotsync/{logger.rb → utils/logger.rb} +2 -0
 - data/lib/dotsync/{path_utils.rb → utils/path_utils.rb} +4 -2
 - data/lib/dotsync/version.rb +3 -1
 - data/lib/dotsync.rb +30 -26
 - metadata +85 -11
 - data/lib/dotsync/file_transfer.rb +0 -49
 
    
        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.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - David Sáenz
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-10-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: toml-rb
         
     | 
| 
         @@ -80,6 +80,20 @@ dependencies: 
     | 
|
| 
       80 
80 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
82 
     | 
    
         
             
                    version: 0.6.3
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: find
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: 0.2.0
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: 0.2.0
         
     | 
| 
       83 
97 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       84 
98 
     | 
    
         
             
              name: rake
         
     | 
| 
       85 
99 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -122,6 +136,62 @@ dependencies: 
     | 
|
| 
       122 
136 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       123 
137 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       124 
138 
     | 
    
         
             
                    version: 1.81.1
         
     | 
| 
      
 139 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 140 
     | 
    
         
            +
              name: rubocop-rspec
         
     | 
| 
      
 141 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 142 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 143 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 144 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 145 
     | 
    
         
            +
                    version: 3.7.0
         
     | 
| 
      
 146 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 147 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 148 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 149 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 150 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 151 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 152 
     | 
    
         
            +
                    version: 3.7.0
         
     | 
| 
      
 153 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 154 
     | 
    
         
            +
              name: rubocop-performance
         
     | 
| 
      
 155 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 156 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 157 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 158 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 159 
     | 
    
         
            +
                    version: 1.26.1
         
     | 
| 
      
 160 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 161 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 162 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 163 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 164 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 165 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 166 
     | 
    
         
            +
                    version: 1.26.1
         
     | 
| 
      
 167 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 168 
     | 
    
         
            +
              name: rubocop-rake
         
     | 
| 
      
 169 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 170 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 171 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 172 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 173 
     | 
    
         
            +
                    version: 0.7.1
         
     | 
| 
      
 174 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 175 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 176 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 177 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 178 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 179 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 180 
     | 
    
         
            +
                    version: 0.7.1
         
     | 
| 
      
 181 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 182 
     | 
    
         
            +
              name: rubocop-md
         
     | 
| 
      
 183 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 184 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 185 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 186 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 187 
     | 
    
         
            +
                    version: 2.0.3
         
     | 
| 
      
 188 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 189 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 190 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 191 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 192 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 193 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 194 
     | 
    
         
            +
                    version: 2.0.3
         
     | 
| 
       125 
195 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       126 
196 
     | 
    
         
             
              name: timecop
         
     | 
| 
       127 
197 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -164,6 +234,7 @@ files: 
     | 
|
| 
       164 
234 
     | 
    
         
             
            - ".github/workflows/gem-push.yml.bak"
         
     | 
| 
       165 
235 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       166 
236 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
      
 237 
     | 
    
         
            +
            - ".rubocop.yml"
         
     | 
| 
       167 
238 
     | 
    
         
             
            - ".ruby-version"
         
     | 
| 
       168 
239 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       169 
240 
     | 
    
         
             
            - CODE_OF_CONDUCT.md
         
     | 
| 
         @@ -180,22 +251,25 @@ files: 
     | 
|
| 
       180 
251 
     | 
    
         
             
            - lib/dotsync.rb
         
     | 
| 
       181 
252 
     | 
    
         
             
            - lib/dotsync/actions/base_action.rb
         
     | 
| 
       182 
253 
     | 
    
         
             
            - lib/dotsync/actions/concerns/mappings_transfer.rb
         
     | 
| 
       183 
     | 
    
         
            -
            - lib/dotsync/actions/config/base_config.rb
         
     | 
| 
       184 
     | 
    
         
            -
            - lib/dotsync/actions/config/mapping_entry.rb
         
     | 
| 
       185 
     | 
    
         
            -
            - lib/dotsync/actions/config/pull_action_config.rb
         
     | 
| 
       186 
     | 
    
         
            -
            - lib/dotsync/actions/config/push_action_config.rb
         
     | 
| 
       187 
     | 
    
         
            -
            - lib/dotsync/actions/config/watch_action_config.rb
         
     | 
| 
       188 
     | 
    
         
            -
            - lib/dotsync/actions/config/xdg_base_directory_spec.rb
         
     | 
| 
       189 
254 
     | 
    
         
             
            - lib/dotsync/actions/pull_action.rb
         
     | 
| 
       190 
255 
     | 
    
         
             
            - lib/dotsync/actions/push_action.rb
         
     | 
| 
       191 
256 
     | 
    
         
             
            - lib/dotsync/actions/watch_action.rb
         
     | 
| 
      
 257 
     | 
    
         
            +
            - lib/dotsync/colors.rb
         
     | 
| 
      
 258 
     | 
    
         
            +
            - lib/dotsync/config/base_config.rb
         
     | 
| 
      
 259 
     | 
    
         
            +
            - lib/dotsync/config/pull_action_config.rb
         
     | 
| 
      
 260 
     | 
    
         
            +
            - lib/dotsync/config/push_action_config.rb
         
     | 
| 
      
 261 
     | 
    
         
            +
            - lib/dotsync/config/watch_action_config.rb
         
     | 
| 
      
 262 
     | 
    
         
            +
            - lib/dotsync/config/xdg_base_directory_spec.rb
         
     | 
| 
       192 
263 
     | 
    
         
             
            - lib/dotsync/errors.rb
         
     | 
| 
       193 
     | 
    
         
            -
            - lib/dotsync/file_transfer.rb
         
     | 
| 
       194 
264 
     | 
    
         
             
            - lib/dotsync/icons.rb
         
     | 
| 
       195 
     | 
    
         
            -
            - lib/dotsync/ 
     | 
| 
       196 
     | 
    
         
            -
            - lib/dotsync/ 
     | 
| 
      
 265 
     | 
    
         
            +
            - lib/dotsync/models/diff.rb
         
     | 
| 
      
 266 
     | 
    
         
            +
            - lib/dotsync/models/mapping.rb
         
     | 
| 
       197 
267 
     | 
    
         
             
            - lib/dotsync/runner.rb
         
     | 
| 
       198 
268 
     | 
    
         
             
            - lib/dotsync/tasks/actions.rake
         
     | 
| 
      
 269 
     | 
    
         
            +
            - lib/dotsync/utils/directory_differ.rb
         
     | 
| 
      
 270 
     | 
    
         
            +
            - lib/dotsync/utils/file_transfer.rb
         
     | 
| 
      
 271 
     | 
    
         
            +
            - lib/dotsync/utils/logger.rb
         
     | 
| 
      
 272 
     | 
    
         
            +
            - lib/dotsync/utils/path_utils.rb
         
     | 
| 
       199 
273 
     | 
    
         
             
            - lib/dotsync/version.rb
         
     | 
| 
       200 
274 
     | 
    
         
             
            homepage: https://github.com/dsaenztagarro/dotsync
         
     | 
| 
       201 
275 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -1,49 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Dotsync
         
     | 
| 
       2 
     | 
    
         
            -
              class FileTransfer
         
     | 
| 
       3 
     | 
    
         
            -
                attr_reader :ignores
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                def initialize(config)
         
     | 
| 
       6 
     | 
    
         
            -
                  @src = config.src
         
     | 
| 
       7 
     | 
    
         
            -
                  @dest = config.dest
         
     | 
| 
       8 
     | 
    
         
            -
                  @force = config.force?
         
     | 
| 
       9 
     | 
    
         
            -
                  @ignores = config.ignores || []
         
     | 
| 
       10 
     | 
    
         
            -
                end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                def transfer
         
     | 
| 
       13 
     | 
    
         
            -
                  if File.file?(@src)
         
     | 
| 
       14 
     | 
    
         
            -
                    transfer_file(@src, @dest)
         
     | 
| 
       15 
     | 
    
         
            -
                  else
         
     | 
| 
       16 
     | 
    
         
            -
                    FileUtils.rm_rf(Dir.glob(File.join(@dest, '*'))) if @force
         
     | 
| 
       17 
     | 
    
         
            -
                    transfer_folder(@src, @dest)
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                private
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                def transfer_file(file_src, file_dest)
         
     | 
| 
       24 
     | 
    
         
            -
                  FileUtils.mkdir_p(File.dirname(file_dest))
         
     | 
| 
       25 
     | 
    
         
            -
                  FileUtils.cp(file_src, file_dest)
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                def transfer_folder(folder_src, folder_dest)
         
     | 
| 
       29 
     | 
    
         
            -
                  FileUtils.mkdir_p(folder_dest)
         
     | 
| 
       30 
     | 
    
         
            -
                  Dir.glob("#{folder_src}/*", File::FNM_DOTMATCH).each do |path|
         
     | 
| 
       31 
     | 
    
         
            -
                    next if ['.', '..'].include?(File.basename(path))
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                    full_path = File.expand_path(path)
         
     | 
| 
       34 
     | 
    
         
            -
                    next if ignore?(full_path)
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                    target = File.join(folder_dest, File.basename(path))
         
     | 
| 
       37 
     | 
    
         
            -
                    if File.file?(full_path)
         
     | 
| 
       38 
     | 
    
         
            -
                      FileUtils.cp(full_path, target)
         
     | 
| 
       39 
     | 
    
         
            -
                    else
         
     | 
| 
       40 
     | 
    
         
            -
                      transfer_folder(full_path, target)
         
     | 
| 
       41 
     | 
    
         
            -
                    end
         
     | 
| 
       42 
     | 
    
         
            -
                  end
         
     | 
| 
       43 
     | 
    
         
            -
                end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                def ignore?(path)
         
     | 
| 
       46 
     | 
    
         
            -
                  @ignores.any? { |ignore| path.start_with?(ignore) }
         
     | 
| 
       47 
     | 
    
         
            -
                end
         
     | 
| 
       48 
     | 
    
         
            -
              end
         
     | 
| 
       49 
     | 
    
         
            -
            end
         
     |