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 +4 -4
- data/.reek.yml +4 -0
- data/Gemfile.lock +1 -1
- data/lib/stashify/directory/local.rb +6 -21
- data/lib/stashify/directory.rb +20 -3
- data/lib/stashify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86e630e47b96968aa141bde2d9d3375c02ca8384a762700e3bbac3bd00ca77c5
|
4
|
+
data.tar.gz: 85e2e7c64db43516d71934fab8a77f0d7becbc870170a7288979823bb0519a88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fec69068fb61f01f2bf0050dbafcf8769bda490b3d9fe9e1929c36c622ddba240e790346eff9cb8dc66a5b9aa6d4c4d27c5237776ec5512435691c402140450
|
7
|
+
data.tar.gz: 6552faa0bb0db1920b5629885f02c0827c96a087bfaeb5e3604c8b875aef6d164925feb185159ad9299d230e3d0a23ad200693e41ec33789e079fe2b7db3af85
|
data/.reek.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
27
|
-
if ::File.directory?(
|
28
|
-
FileUtils.rm_r(
|
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(
|
23
|
+
::File.delete(name_path)
|
31
24
|
end
|
32
25
|
end
|
33
26
|
|
34
27
|
def files
|
35
|
-
Dir.entries(
|
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
|
data/lib/stashify/directory.rb
CHANGED
@@ -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
|
8
|
-
|
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
|
data/lib/stashify/version.rb
CHANGED
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
|
+
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-
|
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:
|