blobs 0.3.3 → 0.3.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/blobs/version.rb +1 -1
  3. data/lib/blobs.rb +31 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 395f297decc49f36421080255f26d85d502ad2ee
4
- data.tar.gz: ba6c2e780cf4296324b8d9e83ba8ab7fa0c851f8
3
+ metadata.gz: 202125725a1b15d0211b93ee75446eb51f513b82
4
+ data.tar.gz: 84a8e7d05035ef1af3900dec3a0d13365e6df7b2
5
5
  SHA512:
6
- metadata.gz: ac576986908480a12adaf1be88434c52d9fd5977d32690529a0cf8c916bc82914054e19b8fcfba987905138df6de308f558baaf7702e0ffeb2a62ac9e073ecde
7
- data.tar.gz: 677e2cf2c062d6f320cfe899e4576f0582818461e605f1e9a1f515d078d03b25041672c08b15d95d6e148c78603d92c6e26dc9f61d91f6d9fa3d0297b468d30f
6
+ metadata.gz: 6fafd18699a63474acee5edeb3c7bb2bfd5ebacdb7bb7a6da606a82f5ea222aff51d4a67ccfcf0d9d53f215989c6f3d223ee95fdf12c0a576ff9601c60b23726
7
+ data.tar.gz: c3ad17b428f4f33463d2da033e60513038501dd9d29934954cc710dd24e7d01a2ae6a52ded5d3db357bd9e6a4cf067fa1c4b986e16c651bb1319acfdd0f6a3d1
data/lib/blobs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Blobs
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/lib/blobs.rb CHANGED
@@ -174,6 +174,37 @@ module Blobs
174
174
  nil
175
175
  end
176
176
 
177
+ def add_dir(base_path, rm = false)
178
+ raise 'No base path given!' unless base_path
179
+ blob_ids = []
180
+ Dir["#{base_path}/**/*.*"].each do |file|
181
+ key = file.split('/')[0...-1].join('/')
182
+ log("Adding file: #{file}")
183
+ log("Key: #{key}")
184
+ if (blob_id = add_file(file, key))
185
+ blob_ids << blob_id
186
+ File.delete(file) if rm
187
+ end
188
+ end
189
+ blob_ids
190
+ end
191
+
192
+ def get_dir(base_path)
193
+ raise 'No base path given!' unless base_path
194
+ files = []
195
+ if (blobs = all(base_path))
196
+ blobs.each do |blob|
197
+ if blob[:file] and blob[:json]
198
+ blob_json = blob[:json]
199
+ log("Decrypting #{blob_json['file_name']} to #{base_path}...")
200
+ files << blob_json['file_name']
201
+ file_from_json(blob_json, base_path)
202
+ end
203
+ end
204
+ end
205
+ files
206
+ end
207
+
177
208
  private
178
209
  def headers(additional_headers = {})
179
210
  additional_headers.merge({
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Kiessler