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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0c6ebc81463c4886df159ad4e39c821d1a9affc9805ddc1842f30cc3c7a6db9
4
- data.tar.gz: e86c18d57611ed75f718382d21ad3587da1744a4fff0e0d59528c245d6e29597
3
+ metadata.gz: 60cabf5a1063e88d67ebdff8af24230b9c9c4b55de8a0248afc6f166a43b3005
4
+ data.tar.gz: a49cea9c66ed620e707eb4772795bf5a501ed8ca41653c54630e199a76d5b8fe
5
5
  SHA512:
6
- metadata.gz: 8d6d7e7fa4e16bb8ddfcc09af65eff8b2fef7d77ea3d5375c29d54bf0490c8936ba975e46125a9595cd767c6a3b38602168c0c728410a6856b053162ddb14e4a
7
- data.tar.gz: 44e0430b450557ed803767c0e6d9d825792f6bf9572df6eae39d83027c75f2c7c5838fe93305681724c84d9aa94ddb11805ebb8c36cbc6c78a7ebce49824d20c
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
@@ -41,4 +41,7 @@ Gem::Specification.new do |spec|
41
41
  spec.add_dependency 'k_log' , '~> 0.0.0'
42
42
  # spec.add_dependency 'k_type' , '~> 0.0.0'
43
43
  # spec.add_dependency 'k_util' , '~> 0.0.0'
44
+ spec.metadata = {
45
+ 'rubygems_mfa_required' => 'true'
46
+ }
44
47
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # NEED to convert this into RSPEC-USECASE
3
4
  module KFileset
4
5
  # FileSet will build up a list of files using Glob patterns.
5
6
  #
@@ -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 do |file|
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
 
@@ -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
- # Handles String based Glob, Regexp pattern or lambda expression
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)
@@ -27,7 +27,7 @@ module KFileset
27
27
  return @key if defined? @key
28
28
 
29
29
  @key = begin
30
- key = realpath.to_s
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
- def path
44
- realpath.to_s
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KFileset
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.5'
5
5
  end
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.3
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-19 00:00:00.000000000 Z
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
- homepage_uri: http://appydave.com/gems/k-fileset
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.7
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