stashify 1.0.5 → 2.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: 86e630e47b96968aa141bde2d9d3375c02ca8384a762700e3bbac3bd00ca77c5
4
- data.tar.gz: 85e2e7c64db43516d71934fab8a77f0d7becbc870170a7288979823bb0519a88
3
+ metadata.gz: 697f326f121f3cc9dbf626549584f903654c5d74961715b48514d42654ce0fe1
4
+ data.tar.gz: f635334a6ab5e9238e198e8f6f02694f18e51dcf6d2d294b80d3e3dc2012b144
5
5
  SHA512:
6
- metadata.gz: 8fec69068fb61f01f2bf0050dbafcf8769bda490b3d9fe9e1929c36c622ddba240e790346eff9cb8dc66a5b9aa6d4c4d27c5237776ec5512435691c402140450
7
- data.tar.gz: 6552faa0bb0db1920b5629885f02c0827c96a087bfaeb5e3604c8b875aef6d164925feb185159ad9299d230e3d0a23ad200693e41ec33789e079fe2b7db3af85
6
+ metadata.gz: 39bc5150f32fd837778a14812309ceb9c383c9ddd5391a6aeaa95e32f8a077ab227343024e17d0070941e16ef6ca86fbf8c2118a9b1d15591830dbee0607c0a8
7
+ data.tar.gz: 0ef5f2314cec0a340c6e9913549367ece3109706967e7bd9f13751eaf2e6532f11e2f68288a825166c49db0d0ac0c2049d11f64672f2cb76c88ff0c16a66c7c0
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.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -37,7 +37,7 @@ module Stashify
37
37
  end
38
38
 
39
39
  def file(name)
40
- Stashify::File::Local.new(path_of(name))
40
+ Stashify::File::Local.new(path: path_of(name))
41
41
  end
42
42
 
43
43
  def directory?(name)
@@ -43,8 +43,8 @@ module Stashify
43
43
 
44
44
  private
45
45
 
46
- def path_of(name)
47
- ::File.join(path, name)
46
+ def path_of(*name)
47
+ ::File.join(path, *name)
48
48
  end
49
49
  end
50
50
  end
@@ -5,13 +5,8 @@ require "stashify/file"
5
5
  module Stashify
6
6
  class File
7
7
  class Local < Stashify::File
8
- def initialize(path)
9
- @path = path
10
- super(name: ::File.basename(path), contents: nil)
11
- end
12
-
13
8
  def contents
14
- ::File.read(@path)
9
+ ::File.read(path)
15
10
  end
16
11
  end
17
12
  end
data/lib/stashify/file.rb CHANGED
@@ -4,12 +4,14 @@ require "stashify"
4
4
 
5
5
  module Stashify
6
6
  class File
7
- attr_reader :name, :contents
7
+ attr_reader :name, :path, :contents
8
8
 
9
- def initialize(name:, contents: "")
10
- raise Stashify::InvalidFile, "Name '#{name}' contains a /" if name =~ %r{/}
9
+ def initialize(name: nil, path: nil, contents: "")
10
+ raise StandardError, "name or path must be defined" unless name || path
11
+ raise Stashify::InvalidFile, "Name '#{name}' contains a /" if name && name =~ %r{/}
11
12
 
12
- @name = name
13
+ @path = path
14
+ @name = name || ::File.basename(path)
13
15
  @contents = contents
14
16
  end
15
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stashify
4
- VERSION = "1.0.5"
4
+ VERSION = "2.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: 1.0.5
4
+ version: 2.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-27 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: