crawling 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13849e800ed4fb364505efc1e53cfbf78488400a3ec203576daf4c52f60098b1
4
- data.tar.gz: 85c64d262232bd4e812dfa2a705d09a89d72fed162a494331bf0376d8f8fea3f
3
+ metadata.gz: f24e27ea229eaf1f3bd1760fefd0b53a759b16aa3354b06f68bc9710d874501a
4
+ data.tar.gz: eab9333641ee6dcde030089df2970b253f9e514362be54df3a55d6cb3bf71971
5
5
  SHA512:
6
- metadata.gz: 8fce41a1275e5f2b994a94f020716a29135fdcb73503d561a3eedb048648cbe43802115f9942d2c5f920161f70442759de4c3fb58c2f797e88c7f8d13bcde5d2
7
- data.tar.gz: a18b47adb620dd73eac107640bfc600d3649cef11232db8c6d9dddcfa16d355b3bb8664aa1cdce203caee730d3dc65046567f28733bb29ade722d4af8954138b
6
+ metadata.gz: 1e9fb2363d3413e29d378f59e507fc9fcca62f1ec6afa385992f88a109fc6334d53ce60c0546c7d02f638a53fe9a5652c0f9744350306cc8da853d4ca1efe09e
7
+ data.tar.gz: a8c8038e9799dd55287d9c02447a7a327b05e1a5d82296111ac3a7c338e97d693139e6a1643734c9ae4401e196a66a560b245997a26116576f6a9b8f5426534f
@@ -1,3 +1,3 @@
1
1
  module Crawling
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
data/lib/crawling.rb CHANGED
@@ -3,12 +3,6 @@ require "diffy"
3
3
  require "pathname"
4
4
 
5
5
  module Crawling
6
- # path to repository for user(s)
7
- HOME_PARENT_DIR = 'home'
8
-
9
- # path to repository for the system
10
- SYSTEM_PARENT_DIR = 'system'
11
-
12
6
  N_LINES_DIFF_CONTEXT = 3
13
7
 
14
8
  def self.child_files_recursive path
@@ -63,7 +57,10 @@ module Crawling
63
57
  @config_pathname = Pathname.new(@config_dir).expand_path
64
58
  @merge_app = merge_app || 'nvim -d %s %h'
65
59
 
66
- stores = { 'home' => @home_dir }
60
+ stores = {
61
+ 'home' => @home_dir,
62
+ # 'system' => '/',
63
+ }
67
64
  @stores = stores.map do |store_dir, sys_dir|
68
65
  store_dir = File.join(@config_dir, store_dir)
69
66
  Store.new store_dir, sys_dir
@@ -71,7 +68,7 @@ module Crawling
71
68
  end
72
69
 
73
70
  def cd
74
- FileUtils::mkdir_p @config_dir unless Dir.exists? @config_dir
71
+ FileUtils.mkdir_p @config_dir unless Dir.exist? @config_dir
75
72
  Dir.chdir @config_dir
76
73
  puts "creating shell in #{@config_dir}, type exit or ctrl-D to exit"
77
74
  system ENV['SHELL']
@@ -82,7 +79,7 @@ module Crawling
82
79
  raise "add command requires paths" if paths.empty?
83
80
 
84
81
  paths.each do |path|
85
- raise "path #{path} does not exist" unless File.exists? path
82
+ raise "path #{path} does not exist" unless File.exist? path
86
83
 
87
84
  each_with_storage_path(files_from path) do |file, storage_file|
88
85
  Crawling.copy_file file, storage_file
@@ -94,7 +91,7 @@ module Crawling
94
91
  raise "get command requires paths" if paths.empty?
95
92
 
96
93
  each_with_storage_path(paths) do |path, storage_path|
97
- raise "path #{path} does not exist in storage" unless File.exists? storage_path
94
+ raise "path #{path} does not exist in storage" unless File.exist? storage_path
98
95
 
99
96
  files_from(storage_path).each do |storage_file|
100
97
  if storage_file == storage_path
@@ -187,11 +184,17 @@ module Crawling
187
184
  end
188
185
  end
189
186
 
187
+ # if path is in the store then return it with the system path, if it
188
+ # is a system path then return it with the store path
190
189
  def get_path_pair path
191
190
  path = File.absolute_path path
192
191
  @stores.each do |store|
193
192
  sys_path = store.get_sys_path path
194
193
  return [ sys_path, path ] if sys_path
194
+ end
195
+
196
+ # path is not in the store
197
+ @stores.each do |store|
195
198
  store_path = store.get_store_path path
196
199
  return [ path, store_path ] if store_path
197
200
  end
@@ -209,17 +212,17 @@ module Crawling
209
212
  end
210
213
 
211
214
  def files_from path
212
- Dir.exists?(path) ? Crawling.child_files_recursive(path) : [path]
215
+ Dir.exist?(path) ? Crawling.child_files_recursive(path) : [path]
213
216
  end
214
217
 
215
218
  def file_or_storage_file_doesnt_exist file, storage_file
216
- if not File.exists? file
217
- if File.exists? storage_file
219
+ if not File.exist? file
220
+ if File.exist? storage_file
218
221
  'system'
219
222
  else
220
223
  'system directory or store'
221
224
  end
222
- elsif not File.exists? storage_file
225
+ elsif not File.exist? storage_file
223
226
  'store'
224
227
  end
225
228
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crawling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2024-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -119,7 +119,7 @@ licenses:
119
119
  - MIT
120
120
  metadata:
121
121
  allowed_push_host: https://rubygems.org
122
- post_install_message:
122
+ post_install_message:
123
123
  rdoc_options: []
124
124
  require_paths:
125
125
  - lib
@@ -134,8 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
- rubygems_version: 3.0.3
138
- signing_key:
137
+ rubygems_version: 3.4.20
138
+ signing_key:
139
139
  specification_version: 4
140
140
  summary: Tool to manage personal configuration and environment files.
141
141
  test_files: []