stashify 2.1.0 → 2.1.1

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: 697f326f121f3cc9dbf626549584f903654c5d74961715b48514d42654ce0fe1
4
- data.tar.gz: f635334a6ab5e9238e198e8f6f02694f18e51dcf6d2d294b80d3e3dc2012b144
3
+ metadata.gz: 18e864a43d1dca35961fe21d01c9b93b9b79fc551f62925bb57f9727d92a3202
4
+ data.tar.gz: 993f5ac9a60bcc4ab8a80ffa03a75001b57da60d7789a3426c666b61151bd822
5
5
  SHA512:
6
- metadata.gz: 39bc5150f32fd837778a14812309ceb9c383c9ddd5391a6aeaa95e32f8a077ab227343024e17d0070941e16ef6ca86fbf8c2118a9b1d15591830dbee0607c0a8
7
- data.tar.gz: 0ef5f2314cec0a340c6e9913549367ece3109706967e7bd9f13751eaf2e6532f11e2f68288a825166c49db0d0ac0c2049d11f64672f2cb76c88ff0c16a66c7c0
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 (2.1.0)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stashify
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stashify
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lambda Null