stashify 2.1.0 → 3.0.0

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: 697f326f121f3cc9dbf626549584f903654c5d74961715b48514d42654ce0fe1
4
- data.tar.gz: f635334a6ab5e9238e198e8f6f02694f18e51dcf6d2d294b80d3e3dc2012b144
3
+ metadata.gz: d58d66a14fbcb4c923eadefaf83b0df6a163c2a1fd78a204445e051d90609c8f
4
+ data.tar.gz: d677085f1b105082435520617d3e545d2d206c3e040b4fa21585d7b29ffe0c0f
5
5
  SHA512:
6
- metadata.gz: 39bc5150f32fd837778a14812309ceb9c383c9ddd5391a6aeaa95e32f8a077ab227343024e17d0070941e16ef6ca86fbf8c2118a9b1d15591830dbee0607c0a8
7
- data.tar.gz: 0ef5f2314cec0a340c6e9913549367ece3109706967e7bd9f13751eaf2e6532f11e2f68288a825166c49db0d0ac0c2049d11f64672f2cb76c88ff0c16a66c7c0
6
+ metadata.gz: 374b7a1aacdaca2f0ea4a889670bccec77fbebeb7113bf396f16cdd9bb799606b0bfd4acecb809f73721399c4e32ee7b6a15b03610f30bc8bb0337131858ec93
7
+ data.tar.gz: cacebe50a69383c925921dea17cfaabec77b2ad7dc020a3c5b5922dbf43c8ca2bd7c63eb33aa200430e80992a65966fd8a9b8e597bff8d7e48693d9f6bcb9da5
data/.reek.yml CHANGED
@@ -12,7 +12,9 @@ detectors:
12
12
 
13
13
  FeatureEnvy:
14
14
  exclude:
15
- - Stashify::Directory::Local#write
15
+ - Stashify::Directory#write_file
16
+ - Stashify::Directory::Local#write_file
17
+ - Stashify::Directory#delete_directory
16
18
 
17
19
  ControlParameter:
18
20
  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 (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,19 +11,6 @@ module Stashify
11
11
  super
12
12
  end
13
13
 
14
- def write_file(file)
15
- ::File.write(path_of(file.name), file.contents)
16
- end
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
14
  def files
28
15
  Dir.entries(path).grep_v(/^[.][.]?$/).map do |file_name|
29
16
  find(::File.basename(file_name))
@@ -47,6 +34,10 @@ module Stashify
47
34
  def directory(name)
48
35
  Stashify::Directory::Local.new(path: path_of(name))
49
36
  end
37
+
38
+ def delete_directory(name)
39
+ FileUtils.rm_r(path_of(name))
40
+ end
50
41
  end
51
42
  end
52
43
  end
@@ -33,6 +33,27 @@ module Stashify
33
33
  directory.files.each { |file| subdir.write(file) }
34
34
  end
35
35
 
36
+ def write_file(file)
37
+ file(file.name).write(file.contents)
38
+ end
39
+
40
+ def delete(name)
41
+ if directory?(name)
42
+ delete_directory(name)
43
+ else
44
+ delete_file(name)
45
+ end
46
+ end
47
+
48
+ def delete_directory(name)
49
+ subdir = directory(name)
50
+ subdir.files.each { |file| subdir.delete(file.name) }
51
+ end
52
+
53
+ def delete_file(name)
54
+ file(name).delete
55
+ end
56
+
36
57
  def ==(other)
37
58
  files == other.files
38
59
  end
@@ -8,6 +8,14 @@ module Stashify
8
8
  def contents
9
9
  ::File.read(path)
10
10
  end
11
+
12
+ def write(contents)
13
+ ::File.write(path, contents)
14
+ end
15
+
16
+ def delete
17
+ ::File.delete(path)
18
+ end
11
19
  end
12
20
  end
13
21
  end
data/lib/stashify/file.rb CHANGED
@@ -15,6 +15,14 @@ module Stashify
15
15
  @contents = contents
16
16
  end
17
17
 
18
+ def write(contents)
19
+ @contents = contents
20
+ end
21
+
22
+ def delete
23
+ @contents = nil
24
+ end
25
+
18
26
  def ==(other)
19
27
  name == other.name && contents == other.contents
20
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stashify
4
- VERSION = "2.1.0"
4
+ VERSION = "3.0.0"
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.1.0
4
+ version: 3.0.0
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-29 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides an abstraction to various services (local filesystem, S3, etc)
14
14
  email: