boxlet 0.2.3 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac3d01a156de1228f1c8d7fa47663204443a74c4
4
- data.tar.gz: 7f988b9682f10bb78451089a03dc036f70f5f841
3
+ metadata.gz: 30054052af4a54d69ba6580adf2ba09790426b7f
4
+ data.tar.gz: 2d045f5a3b4f252446ee7f9e7965d109b7c5bcda
5
5
  SHA512:
6
- metadata.gz: 69a2f5b627c5a3c4b7df7deafa989a4359591de7c471ec405ceb2f717957cacb653e626a12773e18765d1785c6e6fd0b82eb5fd7304e3cd980aca4cadbe8f993
7
- data.tar.gz: 3aa132fcaae54c8ce28cdfdf71767f6d905a134b9810d9de3ad4df532d82022b9d4485c3eae1838f45650196bd830c899aa00eb21bb20d1f91f8d48a0418bfd4
6
+ metadata.gz: 497d7d5f65687c6c840147b8272d9512dac81fd5296a456d7cc9d230402a5ba52d1f2799ad7e680853d4b56444b351f375f616a7815689d6e9b7e9c711ddf489
7
+ data.tar.gz: ef9b10ae3bc60fbfaca5d9c4c567ab3a36c1cf0c1b3e3deba29c8b29b88d8e43aadfb037b791d3f5f995159752c947531cadb0de5a9fb32660fec3663a8cd324
data/config.yml CHANGED
@@ -20,6 +20,7 @@ server_type: thin
20
20
  daemonize: false
21
21
  pid_file: server.pid
22
22
  log_file: server.log
23
+ public_url: http://localhost:8077
23
24
 
24
25
  #use s3
25
26
  s3:
@@ -77,7 +77,8 @@ module Boxlet
77
77
  {
78
78
  capacity: Boxlet::Util.app_space_capacity,
79
79
  usage: Boxlet::Util.app_space_usage,
80
- free_space: free_space?
80
+ free_space: free_space?,
81
+ base_upload_path: base_upload_path
81
82
  }
82
83
  end
83
84
 
@@ -145,7 +146,7 @@ module Boxlet
145
146
  @format = :json
146
147
 
147
148
  uuid = @params[:uuid]
148
- db.collection('assets').find({uuid: uuid}).to_a
149
+ stats.merge(assets: db.collection('assets').find({uuid: uuid}).to_a)
149
150
  end
150
151
 
151
152
  def file_info
@@ -171,13 +172,13 @@ module Boxlet
171
172
 
172
173
  date = Date.parse(@params[:date])
173
174
  uuid = @params[:uuid]
174
- db.collection('assets').find({
175
+ stats.merge(assets: db.collection('assets').find({
175
176
  uuid: uuid,
176
177
  asset_date: {
177
178
  '$gte' => date.to_time.strftime('%F'),
178
179
  '$lt' => (date + 1).to_time.strftime('%F')
179
180
  }
180
- }).to_a
181
+ }).to_a)
181
182
  end
182
183
 
183
184
 
@@ -215,5 +216,13 @@ module Boxlet
215
216
  def free_space?
216
217
  Boxlet::Util.free_space > 50
217
218
  end
219
+
220
+ def base_upload_path
221
+ if Boxlet.config[:s3][:enabled]
222
+ "https://s3.amazonaws.com/#{Boxlet.config[:s3][:bucket]}/#{@params[:uuid]}"
223
+ else
224
+ "http://#{Boxlet.config[:public_url]}/#{Boxlet.config[:upload_dir]}/#{Digest::MD5.hexdigest(@params[:uuid])}"
225
+ end
226
+ end
218
227
  end
219
228
  end
@@ -1,3 +1,3 @@
1
1
  module Boxlet
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - arktisklada