k_fileset 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/STORIES.md +5 -5
- data/k_fileset.gemspec +3 -0
- data/lib/k_fileset/file_set_examples.rb +1 -0
- data/lib/k_fileset/glob_entry.rb +1 -7
- data/lib/k_fileset/glob_info.rb +1 -2
- data/lib/k_fileset/path_entry.rb +18 -12
- data/lib/k_fileset/version.rb +1 -1
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60cabf5a1063e88d67ebdff8af24230b9c9c4b55de8a0248afc6f166a43b3005
|
4
|
+
data.tar.gz: a49cea9c66ed620e707eb4772795bf5a501ed8ca41653c54630e199a76d5b8fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af05f5a0331394c973664c19e0eecedb4403b79cfd2d3c59b5965760076dba82713a94cdc5110a3fad457834575bfadec278771b8dca663c39a4500cf8dfd828
|
7
|
+
data.tar.gz: 61d7c3ec2fb997a029ab15168b99321a7fa790d10e8e80e35c0facc4f40ae92b1564b62943e767f95580effec7f30339e969d3f53ed7ae7b0fdfde1033436724
|
data/STORIES.md
CHANGED
@@ -20,11 +20,6 @@ As a Developer, I want to add or remove files based on configured pattern (inclu
|
|
20
20
|
|
21
21
|
- Be able to add or remove files from the fileset
|
22
22
|
|
23
|
-
Setup GitHub Action (test and lint)
|
24
|
-
|
25
|
-
- Setup Rspec action
|
26
|
-
- Setup RuboCop action
|
27
|
-
|
28
23
|
## Stories and tasks
|
29
24
|
|
30
25
|
### Tasks - completed
|
@@ -41,6 +36,11 @@ Setup project management, requirement and SCRUM documents
|
|
41
36
|
- Setup a project backlog
|
42
37
|
- Setup an examples/usage document
|
43
38
|
|
39
|
+
Setup GitHub Action (test and lint)
|
40
|
+
|
41
|
+
- Setup Rspec action
|
42
|
+
- Setup RuboCop action
|
43
|
+
|
44
44
|
Setup new Ruby GEM
|
45
45
|
|
46
46
|
- Build out a standard GEM structure
|
data/k_fileset.gemspec
CHANGED
data/lib/k_fileset/glob_entry.rb
CHANGED
@@ -20,13 +20,7 @@ module KFileset
|
|
20
20
|
Dir.chdir(working_directory) do
|
21
21
|
Dir.glob(glob, flags)
|
22
22
|
.reject { |file| exclusions.any? { |pattern| pattern_match?(pattern, file) } }
|
23
|
-
.map
|
24
|
-
# pathname = Pathname.new(file)
|
25
|
-
# key = pathname.realpath.to_s
|
26
|
-
# key = File.join(key, '.') if file.ends_with?('.')
|
27
|
-
# PathEntry.new(key, pathname, Dir.pwd, file)
|
28
|
-
PathEntry.new(file)
|
29
|
-
end
|
23
|
+
.map { |file| PathEntry.new(file) }
|
30
24
|
end
|
31
25
|
end
|
32
26
|
|
data/lib/k_fileset/glob_info.rb
CHANGED
@@ -11,7 +11,6 @@ module KFileset
|
|
11
11
|
@glob += File::SEPARATOR if glob.end_with?(File::SEPARATOR)
|
12
12
|
@flags = flags
|
13
13
|
|
14
|
-
# absolute_path_glob
|
15
14
|
@exclusions = build_exclusions(exclude)
|
16
15
|
end
|
17
16
|
|
@@ -40,7 +39,7 @@ module KFileset
|
|
40
39
|
|
41
40
|
private
|
42
41
|
|
43
|
-
#
|
42
|
+
# Handle string based Glob, Regexp pattern or lambda expressions
|
44
43
|
def build_exclusions(exclude)
|
45
44
|
return [] if exclude.nil?
|
46
45
|
return [exclude] if valid_exclusion?(exclude)
|
data/lib/k_fileset/path_entry.rb
CHANGED
@@ -27,7 +27,7 @@ module KFileset
|
|
27
27
|
return @key if defined? @key
|
28
28
|
|
29
29
|
@key = begin
|
30
|
-
key =
|
30
|
+
key = safe_realpath
|
31
31
|
key = File.join(key, '.') if basename.to_s == '.' # if pathname.ends_with?('.')
|
32
32
|
key
|
33
33
|
end
|
@@ -40,11 +40,26 @@ module KFileset
|
|
40
40
|
# path_name.realpath(working_directory).to_s
|
41
41
|
# end
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
# Friendly path will return absolute path if the folder/file exists.
|
44
|
+
# If the file/folder does NOT exist then the the value of the underlying @path
|
45
|
+
# is used and this is likely to be a relative path
|
46
|
+
def safe_realpath
|
47
|
+
# Cannot use @path because that instance variable is already used on Pathname
|
48
|
+
@safe_realpath ||= exist? ? realpath.to_s : File.expand_path(self)
|
49
|
+
end
|
50
|
+
|
51
|
+
def uri
|
52
|
+
URI::File.build(host: nil, path: safe_realpath)
|
45
53
|
end
|
46
54
|
|
47
55
|
def debug
|
56
|
+
log.kv 'key', key
|
57
|
+
log.kv 'working_directory', working_directory
|
58
|
+
log.kv 'safe_realpath', safe_realpath
|
59
|
+
log.kv 'to_path', to_path
|
60
|
+
log.kv 'cleanpath', cleanpath
|
61
|
+
log.line
|
62
|
+
|
48
63
|
# puts "expand_path : #{self.expand_path.to_s}"
|
49
64
|
# puts "realdirpath : #{self.realdirpath.to_s}"
|
50
65
|
# puts "realpath : #{self.realpath.to_s}"
|
@@ -54,13 +69,6 @@ module KFileset
|
|
54
69
|
# puts "to_path : #{self.to_path.to_s}"
|
55
70
|
# puts "parent : #{self.parent.to_s}"
|
56
71
|
# log.line
|
57
|
-
log.kv 'key', key
|
58
|
-
log.kv 'working_directory', working_directory
|
59
|
-
log.kv 'pathname', path
|
60
|
-
|
61
|
-
log.kv 'to_path', to_path
|
62
|
-
log.kv 'cleanpath', cleanpath
|
63
|
-
|
64
72
|
# log.kv 'directory?', directory?
|
65
73
|
# log.kv 'root?', root?
|
66
74
|
# log.kv 'absolute?', absolute?
|
@@ -80,8 +88,6 @@ module KFileset
|
|
80
88
|
# log.kv 'dirname', dirname
|
81
89
|
# log.kv 'to_path', to_path
|
82
90
|
# log.kv 'size', size
|
83
|
-
|
84
|
-
log.line
|
85
91
|
end
|
86
92
|
end
|
87
93
|
end
|
data/lib/k_fileset/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_fileset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: k_log
|
@@ -65,9 +65,7 @@ homepage: http://appydave.com/gems/k-fileset
|
|
65
65
|
licenses:
|
66
66
|
- MIT
|
67
67
|
metadata:
|
68
|
-
|
69
|
-
source_code_uri: https://github.com/klueless-io/k_fileset
|
70
|
-
changelog_uri: https://github.com/klueless-io/k_fileset/commits/master
|
68
|
+
rubygems_mfa_required: 'true'
|
71
69
|
post_install_message:
|
72
70
|
rdoc_options: []
|
73
71
|
require_paths:
|
@@ -83,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
81
|
- !ruby/object:Gem::Version
|
84
82
|
version: '0'
|
85
83
|
requirements: []
|
86
|
-
rubygems_version: 3.2.
|
84
|
+
rubygems_version: 3.2.33
|
87
85
|
signing_key:
|
88
86
|
specification_version: 4
|
89
87
|
summary: K-Fileset provides file system snapshot using GLOB inclusions and exclusions
|