boxlet 0.1.1 → 0.1.2
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/lib/boxlet/app.rb +8 -8
- data/lib/boxlet/app/controller.rb +10 -0
- data/lib/boxlet/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75fe1e4479b4da80be96e4f6f47457859c1a4bc3
|
4
|
+
data.tar.gz: 7af02a32983212e6b61adf6fda22c5465e556b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10666aa0575c8f84630210ac7fc3a929d862066657e3cc2eba9913c806729c23524412bd3bc7f83b1b2d24c557bfc379554e0830afc0e197f6e662709af70fa5
|
7
|
+
data.tar.gz: 6e272d7d8c1a1f320deaffd2dec1e3a751268890d3af94eeea4f5fac69e740d0e66985e800d3de601c2f46dfd45c4ec80731179b9188ffc17a52ceb4f73b14e5
|
data/lib/boxlet/app.rb
CHANGED
@@ -14,21 +14,24 @@ module Boxlet
|
|
14
14
|
|
15
15
|
def self.routes
|
16
16
|
routes = {
|
17
|
-
["/", :get] => :index,
|
17
|
+
# ["/", :get] => :index,
|
18
18
|
# ["/auth"] => :auth,
|
19
19
|
# ["/register_device", :post] => :register_device,
|
20
20
|
# ["/notifications", :*] => :notifications,
|
21
21
|
["/stats", :post] => :stats,
|
22
22
|
["/push_files", :post] => :push_files,
|
23
23
|
["/file_list"] => :file_list,
|
24
|
-
["/file_info"] => :file_info
|
24
|
+
["/file_info"] => :file_info,
|
25
|
+
["/resync", :get] => :resync
|
25
26
|
}
|
26
27
|
end
|
27
28
|
|
28
29
|
def initialize
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
if Boxlet.debug?
|
31
|
+
usage = Boxlet::App.app_space_usage
|
32
|
+
capacity = Boxlet::App.app_space_capacity
|
33
|
+
puts "Space Utilization: #{usage}MB / #{capacity}MB (#{(usage.to_f / capacity).round(3)}%)"
|
34
|
+
end
|
32
35
|
end
|
33
36
|
|
34
37
|
def bind
|
@@ -37,9 +40,6 @@ module Boxlet
|
|
37
40
|
use Rack::FileUpload, :upload_dir => [Boxlet.config[:upload_dir] || APP_ROOT + "/uploads"]
|
38
41
|
use Rack::Static, :urls => ["/uploads"]
|
39
42
|
|
40
|
-
# map "/uploads" do
|
41
|
-
# run Rack::File.new(Boxlet.config[:upload_dir])
|
42
|
-
# end
|
43
43
|
Boxlet::App.routes.each do |route, action|
|
44
44
|
map route[0] do
|
45
45
|
run Boxlet::Router.new(route[1] || :*, action)
|
@@ -122,6 +122,16 @@ module Boxlet
|
|
122
122
|
file_model.merge db.collection('assets').find({asset_path: asset_path, uuid: uuid}).to_a.first || {}
|
123
123
|
end
|
124
124
|
|
125
|
+
def resync
|
126
|
+
upload_dir = user_upload_dir || './uploads'
|
127
|
+
db.collection('assets').find().each do |a|
|
128
|
+
asset_path = a["uuid"] + "/" + a["filename"]
|
129
|
+
if !File.exists? upload_dir + "/" + asset_path
|
130
|
+
db.collection('assets').remove({"_id" => a["_id"]})
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
125
135
|
|
126
136
|
private
|
127
137
|
|
data/lib/boxlet/version.rb
CHANGED