k_fileset 0.0.3 → 0.0.7

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: f0c6ebc81463c4886df159ad4e39c821d1a9affc9805ddc1842f30cc3c7a6db9
4
- data.tar.gz: e86c18d57611ed75f718382d21ad3587da1744a4fff0e0d59528c245d6e29597
3
+ metadata.gz: 2e411491078958c303420404166e6d5fa92f9b80bf5034c070f24a9b9c87d411
4
+ data.tar.gz: 7a5be4f7cbaa020517bc5d5f0ff3b813c4b9e9084cbf96b3b83126521c03d782
5
5
  SHA512:
6
- metadata.gz: 8d6d7e7fa4e16bb8ddfcc09af65eff8b2fef7d77ea3d5375c29d54bf0490c8936ba975e46125a9595cd767c6a3b38602168c0c728410a6856b053162ddb14e4a
7
- data.tar.gz: 44e0430b450557ed803767c0e6d9d825792f6bf9572df6eae39d83027c75f2c7c5838fe93305681724c84d9aa94ddb11805ebb8c36cbc6c78a7ebce49824d20c
6
+ metadata.gz: 811a328ff15ff7ca1c3ad5768662e000f0339341ec4bed89ca499ac9ced5dbf6c78b8e5947bfbba66e2b7f539977ebc7114659245cae888bdb4bb5b283a9cdde
7
+ data.tar.gz: 3bd6de4899fcc0c85f1ee3c36f7227555ca11f4ab82e9278aee1667d97cd456660fcbe6b7629385b66b62ef2771ef28a8ec6b7758bc9160bac44a8a4ea3ccb52
data/.rubocop.yml CHANGED
@@ -49,7 +49,7 @@ Metrics/MethodLength:
49
49
  Layout/LineLength:
50
50
  Max: 200
51
51
  # Ignores annotate output
52
- IgnoredPatterns: ['\A# \*\*']
52
+ AllowedPatterns: ['\A# \*\*']
53
53
  IgnoreCopDirectives: true
54
54
 
55
55
  Lint/UnusedMethodArgument:
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/hooks/update-version CHANGED
@@ -30,4 +30,4 @@ end
30
30
  output.push('')
31
31
 
32
32
  printf "%-25<label>s : %<version>s\n", label: 'GEM VERSION', version: version
33
- File.open('lib/k_fileset/version.rb', 'w+') { |f| f.write(output.join("\n")) }
33
+ File.write('lib/k_fileset/version.rb', output.join("\n"))
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.7'
5
5
  end
data/lib/k_fileset.rb CHANGED
@@ -16,7 +16,7 @@ module KFileset
16
16
  # Your code goes here...
17
17
  end
18
18
 
19
- if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
19
+ if ENV.fetch('KLUE_DEBUG', 'false').downcase == 'true'
20
20
  namespace = 'KFileset::Version'
21
21
  file_path = $LOADED_FEATURES.find { |f| f.include?('k_fileset/version') }
22
22
  version = KFileset::VERSION.ljust(9)
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.7
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: 2022-06-29 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.1.6
87
85
  signing_key:
88
86
  specification_version: 4
89
87
  summary: K-Fileset provides file system snapshot using GLOB inclusions and exclusions