boxlet 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: a8ccc8e3e2d33bcd02ae4ad95387f2f7b356dcbb
4
- data.tar.gz: baefad60c68d00b903da3a60a17035297d2424ed
3
+ metadata.gz: 75fe1e4479b4da80be96e4f6f47457859c1a4bc3
4
+ data.tar.gz: 7af02a32983212e6b61adf6fda22c5465e556b21
5
5
  SHA512:
6
- metadata.gz: d633624ee6ebcf811baa9e274827949e81f2d6a6c6b038977c8e54be1c44c735715a1037ce3faa845121dbda76b7fff5e63f775caff684cc1b8eed0a892dfe50
7
- data.tar.gz: 442348771e3e1266b458884165e5f6a6ef388ad1e48cb93f073fb6fc1418782496078eb916325748ad6a757e2f2021fe397c0e5a1fa693a2a143d7bc53cb4928
6
+ metadata.gz: 10666aa0575c8f84630210ac7fc3a929d862066657e3cc2eba9913c806729c23524412bd3bc7f83b1b2d24c557bfc379554e0830afc0e197f6e662709af70fa5
7
+ data.tar.gz: 6e272d7d8c1a1f320deaffd2dec1e3a751268890d3af94eeea4f5fac69e740d0e66985e800d3de601c2f46dfd45c4ec80731179b9188ffc17a52ceb4f73b14e5
@@ -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
- usage = Boxlet::App.app_space_usage
30
- capacity = Boxlet::App.app_space_capacity
31
- puts "Space Utilization: #{usage}MB / #{capacity}MB (#{(usage.to_f / capacity).round(3)}%)"
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
 
@@ -1,3 +1,3 @@
1
1
  module Boxlet
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - arktisklada