stashify 2.0.0 → 2.1.1

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: 72261627ef443188786450d298ba1b7223c0297466b7991979ab34aa3b348bff
4
- data.tar.gz: 9544398bc63888267cafbb8ead584340fb7b2597a526a8b9e04adf2672fe1c9b
3
+ metadata.gz: 18e864a43d1dca35961fe21d01c9b93b9b79fc551f62925bb57f9727d92a3202
4
+ data.tar.gz: 993f5ac9a60bcc4ab8a80ffa03a75001b57da60d7789a3426c666b61151bd822
5
5
  SHA512:
6
- metadata.gz: e143737520b394cf9e5a652a34cb018f1a351bc9d0fe9ff2b5e6a4a8940f8de6b20e1a33a28ac3d42ab894d885b133fe64ebc2172889feaa70f5298e326407a9
7
- data.tar.gz: 73e3b1d0b25a2ed60d0654dadac1b65b8ee44b5359f5100ad2019e81b9fd79dd6660d478edb0d64a22198a3f2f355d7cdf2dd6442da04b022da62edd2653905f
6
+ metadata.gz: e7af61472c816f3120578e46cc6d70cbd3b4e616bfab8c85d664eeb5c77c2dbfab159325330800ab1ad746d7051394456f89276f267ef9811f867412232b38bc
7
+ data.tar.gz: 3ca532d8fffcc24d4ac5bdbd2b49b4963a2da12fcb27774340372c9965efbcbfd05209cb877262565ec5b004f92c303c97493adb55b86260ea0e73ebd5414deb
data/.reek.yml CHANGED
@@ -12,7 +12,8 @@ detectors:
12
12
 
13
13
  FeatureEnvy:
14
14
  exclude:
15
- - Stashify::Directory::Local#write
15
+ - Stashify::Directory::Local#write_file
16
+ - Stashify::Directory#delete_directory
16
17
 
17
18
  ControlParameter:
18
19
  exclude:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stashify (1.0.5)
4
+ stashify (2.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -15,15 +15,6 @@ module Stashify
15
15
  ::File.write(path_of(file.name), file.contents)
16
16
  end
17
17
 
18
- def delete(name)
19
- name_path = ::File.join(path, name)
20
- if ::File.directory?(name_path)
21
- FileUtils.rm_r(name_path)
22
- else
23
- ::File.delete(name_path)
24
- end
25
- end
26
-
27
18
  def files
28
19
  Dir.entries(path).grep_v(/^[.][.]?$/).map do |file_name|
29
20
  find(::File.basename(file_name))
@@ -47,6 +38,14 @@ module Stashify
47
38
  def directory(name)
48
39
  Stashify::Directory::Local.new(path: path_of(name))
49
40
  end
41
+
42
+ def delete_directory(name)
43
+ FileUtils.rm_r(path_of(name))
44
+ end
45
+
46
+ def delete_file(name)
47
+ ::File.delete(path_of(name))
48
+ end
50
49
  end
51
50
  end
52
51
  end
@@ -33,6 +33,19 @@ module Stashify
33
33
  directory.files.each { |file| subdir.write(file) }
34
34
  end
35
35
 
36
+ def delete(name)
37
+ if directory?(name)
38
+ delete_directory(name)
39
+ else
40
+ delete_file(name)
41
+ end
42
+ end
43
+
44
+ def delete_directory(name)
45
+ subdir = directory(name)
46
+ subdir.files.each { |file| subdir.delete(file.name) }
47
+ end
48
+
36
49
  def ==(other)
37
50
  files == other.files
38
51
  end
@@ -43,8 +56,8 @@ module Stashify
43
56
 
44
57
  private
45
58
 
46
- def path_of(name)
47
- ::File.join(path, name)
59
+ def path_of(*name)
60
+ ::File.join(path, *name)
48
61
  end
49
62
  end
50
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stashify
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.1"
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: 2.0.0
4
+ version: 2.1.1
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-28 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides an abstraction to various services (local filesystem, S3, etc)
14
14
  email: