stashify 1.0.4 → 1.0.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: ac39c7eaa7f0a6e924497457841cc2087d34cacda4d400d32d3fa3e95965de69
4
- data.tar.gz: fcb7cef63717efdbcb91eb0e668282352f62581e3205423bb16cfb4be0077210
3
+ metadata.gz: 86e630e47b96968aa141bde2d9d3375c02ca8384a762700e3bbac3bd00ca77c5
4
+ data.tar.gz: 85e2e7c64db43516d71934fab8a77f0d7becbc870170a7288979823bb0519a88
5
5
  SHA512:
6
- metadata.gz: 6e592aeefb27cd272449dc897ce23a59abd2f298f115280b5c5eac26d9b448c6169cb29280350ba4ab3f1c19746779b976c54a85aa95ca11bc61c20d451b0a3a
7
- data.tar.gz: 15ed987a91e39127836c08b7a9f4099aab4a2b16b804e3f944f987ce50b62ed9a65516032e99c27cd10efc65f177840b66bde5e19b779cf6f053f34453a5c967
6
+ metadata.gz: 8fec69068fb61f01f2bf0050dbafcf8769bda490b3d9fe9e1929c36c622ddba240e790346eff9cb8dc66a5b9aa6d4c4d27c5237776ec5512435691c402140450
7
+ data.tar.gz: 6552faa0bb0db1920b5629885f02c0827c96a087bfaeb5e3604c8b875aef6d164925feb185159ad9299d230e3d0a23ad200693e41ec33789e079fe2b7db3af85
data/.reek.yml CHANGED
@@ -13,3 +13,7 @@ detectors:
13
13
  FeatureEnvy:
14
14
  exclude:
15
15
  - Stashify::Directory::Local#write
16
+
17
+ ControlParameter:
18
+ exclude:
19
+ - Stashify::Directory#initialize
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stashify (1.0.4)
4
+ stashify (1.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -6,13 +6,6 @@ require "stashify/directory"
6
6
  module Stashify
7
7
  class Directory
8
8
  class Local < Stashify::Directory
9
- attr_reader :path
10
-
11
- def initialize(path)
12
- @path = path
13
- super(name: ::File.basename(path))
14
- end
15
-
16
9
  def write_directory(directory)
17
10
  FileUtils.mkdir(path_of(directory.name))
18
11
  super
@@ -23,24 +16,20 @@ module Stashify
23
16
  end
24
17
 
25
18
  def delete(name)
26
- path = ::File.join(@path, name)
27
- if ::File.directory?(path)
28
- FileUtils.rm_r(path)
19
+ name_path = ::File.join(path, name)
20
+ if ::File.directory?(name_path)
21
+ FileUtils.rm_r(name_path)
29
22
  else
30
- ::File.delete(path)
23
+ ::File.delete(name_path)
31
24
  end
32
25
  end
33
26
 
34
27
  def files
35
- Dir.entries(@path).grep_v(/^[.][.]?$/).map do |file_name|
28
+ Dir.entries(path).grep_v(/^[.][.]?$/).map do |file_name|
36
29
  find(::File.basename(file_name))
37
30
  end
38
31
  end
39
32
 
40
- def ==(other)
41
- @path == other.path
42
- end
43
-
44
33
  private
45
34
 
46
35
  def file?(name)
@@ -56,11 +45,7 @@ module Stashify
56
45
  end
57
46
 
58
47
  def directory(name)
59
- Stashify::Directory::Local.new(path_of(name))
60
- end
61
-
62
- def path_of(name)
63
- ::File.join(@path, name)
48
+ Stashify::Directory::Local.new(path: path_of(name))
64
49
  end
65
50
  end
66
51
  end
@@ -2,10 +2,13 @@
2
2
 
3
3
  module Stashify
4
4
  class Directory
5
- attr_reader :name, :files
5
+ attr_reader :name, :files, :path
6
6
 
7
- def initialize(name:, files: [])
8
- @name = name
7
+ def initialize(name: nil, path: nil, files: [])
8
+ raise StandardError, "name or path must be defined" unless name || path
9
+
10
+ @path = path
11
+ @name = name || ::File.basename(path)
9
12
  @files = files
10
13
  end
11
14
 
@@ -29,5 +32,19 @@ module Stashify
29
32
  subdir = self.directory(directory.name)
30
33
  directory.files.each { |file| subdir.write(file) }
31
34
  end
35
+
36
+ def ==(other)
37
+ files == other.files
38
+ end
39
+
40
+ def eql?(other)
41
+ self.class == other.class && name == other.name && path == other.path
42
+ end
43
+
44
+ private
45
+
46
+ def path_of(name)
47
+ ::File.join(path, name)
48
+ end
32
49
  end
33
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stashify
4
- VERSION = "1.0.4"
4
+ VERSION = "1.0.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stashify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lambda Null
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-25 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides an abstraction to various services (local filesystem, S3, etc)
14
14
  email: