stashify 2.1.1 → 3.1.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: 18e864a43d1dca35961fe21d01c9b93b9b79fc551f62925bb57f9727d92a3202
4
- data.tar.gz: 993f5ac9a60bcc4ab8a80ffa03a75001b57da60d7789a3426c666b61151bd822
3
+ metadata.gz: 15c432cdab53f9a20369203af0e05bb8157413a622655ae28d4c36131f318a8b
4
+ data.tar.gz: 5e2d87b9a660825c36d4140fa1a5c30b1a5e10573edc34df7fb6cbcff7e5f802
5
5
  SHA512:
6
- metadata.gz: e7af61472c816f3120578e46cc6d70cbd3b4e616bfab8c85d664eeb5c77c2dbfab159325330800ab1ad746d7051394456f89276f267ef9811f867412232b38bc
7
- data.tar.gz: 3ca532d8fffcc24d4ac5bdbd2b49b4963a2da12fcb27774340372c9965efbcbfd05209cb877262565ec5b004f92c303c97493adb55b86260ea0e73ebd5414deb
6
+ metadata.gz: 73612ebce48eaf45c396d4277ea4e73a591ffb976589049101dc28c6cd8b4fbbd3ad376852db2a8e5deb0a8864982e10071821da47a2ca19e05b443e0054613a
7
+ data.tar.gz: a897048fb68343a37408a5bdc43bcf93f629621fea1d21235896f32b0800e643ab791feac51d32b17df73ed2fcc3141652e43fd4bc85deac757abd78c1410080
data/.reek.yml CHANGED
@@ -12,6 +12,7 @@ detectors:
12
12
 
13
13
  FeatureEnvy:
14
14
  exclude:
15
+ - Stashify::Directory#write_file
15
16
  - Stashify::Directory::Local#write_file
16
17
  - Stashify::Directory#delete_directory
17
18
 
data/.rubocop.yml CHANGED
@@ -19,6 +19,7 @@ Layout/LineLength:
19
19
  Metrics/BlockLength:
20
20
  AllowedMethods:
21
21
  - describe
22
+ - shared_examples
22
23
 
23
24
  Style/TrailingCommaInArguments:
24
25
  EnforcedStyleForMultiline: consistent_comma
data/Gemfile CHANGED
@@ -17,4 +17,4 @@ gem "guard-rspec"
17
17
  gem "guard-rubocop"
18
18
 
19
19
  gem "byebug"
20
- gem "rantly"
20
+ gem "stashify-contract"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stashify (2.1.1)
4
+ stashify (3.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -70,7 +70,7 @@ GEM
70
70
  rspec-expectations (3.12.2)
71
71
  diff-lcs (>= 1.2.0, < 2.0)
72
72
  rspec-support (~> 3.12.0)
73
- rspec-mocks (3.12.4)
73
+ rspec-mocks (3.12.5)
74
74
  diff-lcs (>= 1.2.0, < 2.0)
75
75
  rspec-support (~> 3.12.0)
76
76
  rspec-support (3.12.0)
@@ -84,10 +84,13 @@ GEM
84
84
  rubocop-ast (>= 1.26.0, < 2.0)
85
85
  ruby-progressbar (~> 1.7)
86
86
  unicode-display_width (>= 2.4.0, < 3.0)
87
- rubocop-ast (1.27.0)
87
+ rubocop-ast (1.28.0)
88
88
  parser (>= 3.2.1.0)
89
89
  ruby-progressbar (1.13.0)
90
90
  shellany (0.0.1)
91
+ stashify-contract (1.0.1)
92
+ rantly (~> 2.0.0)
93
+ rspec (~> 3.0)
91
94
  thor (1.2.1)
92
95
  unicode-display_width (2.4.2)
93
96
 
@@ -101,11 +104,11 @@ DEPENDENCIES
101
104
  guard-rspec
102
105
  guard-rubocop
103
106
  rake (~> 13.0)
104
- rantly
105
107
  reek (~> 6.1.4)
106
108
  rspec (~> 3.0)
107
109
  rubocop (~> 1.21)
108
110
  stashify!
111
+ stashify-contract
109
112
 
110
113
  BUNDLED WITH
111
114
  2.2.33
data/lib/st ADDED
@@ -0,0 +1,9 @@
1
+ require "rantly/rspec_extensions"
2
+
3
+ shared_example "a file" do
4
+ it "has a reasonable name" do
5
+ property_of do
6
+ require "byebug";byebug
7
+ end
8
+ end
9
+ end
@@ -11,8 +11,12 @@ module Stashify
11
11
  super
12
12
  end
13
13
 
14
- def write_file(file)
15
- ::File.write(path_of(file.name), file.contents)
14
+ def parent
15
+ Stashify::Directory::Local.new(path: ::File.dirname(path))
16
+ end
17
+
18
+ def exists?(name)
19
+ ::File.exist?(path_of(name))
16
20
  end
17
21
 
18
22
  def files
@@ -21,12 +25,6 @@ module Stashify
21
25
  end
22
26
  end
23
27
 
24
- private
25
-
26
- def file?(name)
27
- ::File.exist?(path_of(name))
28
- end
29
-
30
28
  def file(name)
31
29
  Stashify::File::Local.new(path: path_of(name))
32
30
  end
@@ -42,10 +40,6 @@ module Stashify
42
40
  def delete_directory(name)
43
41
  FileUtils.rm_r(path_of(name))
44
42
  end
45
-
46
- def delete_file(name)
47
- ::File.delete(path_of(name))
48
- end
49
43
  end
50
44
  end
51
45
  end
@@ -15,7 +15,7 @@ module Stashify
15
15
  def find(name)
16
16
  if directory?(name)
17
17
  directory(name)
18
- elsif file?(name)
18
+ elsif exists?(name)
19
19
  file(name)
20
20
  end
21
21
  end
@@ -33,6 +33,10 @@ 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
+
36
40
  def delete(name)
37
41
  if directory?(name)
38
42
  delete_directory(name)
@@ -46,6 +50,10 @@ module Stashify
46
50
  subdir.files.each { |file| subdir.delete(file.name) }
47
51
  end
48
52
 
53
+ def delete_file(name)
54
+ file(name).delete
55
+ end
56
+
49
57
  def ==(other)
50
58
  files == other.files
51
59
  end
@@ -8,6 +8,18 @@ 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
19
+
20
+ def exists?
21
+ ::File.exist?(path)
22
+ end
11
23
  end
12
24
  end
13
25
  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.1"
4
+ VERSION = "3.1.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.1
4
+ version: 3.1.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-04-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides an abstraction to various services (local filesystem, S3, etc)
14
14
  email:
@@ -29,6 +29,7 @@ files:
29
29
  - Rakefile
30
30
  - bin/console
31
31
  - bin/setup
32
+ - lib/st
32
33
  - lib/stashify.rb
33
34
  - lib/stashify/directory.rb
34
35
  - lib/stashify/directory/local.rb