boxlet 0.2.0 → 0.2.1

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: 2cad509b0ace0721f642bdbfa0a3642762eed408
4
- data.tar.gz: 0f698f040646e23326774e6b71346b336a4d8232
3
+ metadata.gz: e2ec1c5b89c7db9e74e07a6b34f8d9ae898551fd
4
+ data.tar.gz: 235577cc755e9701464c44ac48b4da0b4415f4c2
5
5
  SHA512:
6
- metadata.gz: 9efe8a0f63c60c1c8b82d06784225b5be520d18832aced1060397673adeae075c3a9377ba66408ce1a0b1105c4c656a3d8530424b41f3a67e4e80be84b97e7f0
7
- data.tar.gz: 1b9c03604c0e9fd6b98ae4b70818a804f4c80a55b158d54f41d18ce299a6ccec30c81693caaab91cdca778a70b38776e2eb0252154e9f1504fdef7015da6b27e
6
+ metadata.gz: f16e15fb92292ce0d554fe4896b08486c94391b4305165295886ac1984553abf6bf2e473c35f10fd7a2591ee86429602fcbd37db6c68dfb919357785ccb8b477
7
+ data.tar.gz: aaa795ced180ab9961897faaa64bac91c3b2423fcac6a55a099544fd083dfa28f9b286c5877e42e5e769dd04e0dba8e21a1cbbd2a90ebe2f2fa9ae3af7a486b2
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Boxlet is a server + mobile app system that allows you to take advantage of free space on any cloud server you have ssh access to as a backup/sync for your photos.
4
4
 
5
+ Boxlet is also compatible with storing files on Amazon S3.
6
+
5
7
  From the mobile iOS app, you can specify any server:port where the Boxlet server is running to sync and backup your photos to a remote server.
6
8
 
7
9
 
data/lib/boxlet/app.rb CHANGED
@@ -72,11 +72,13 @@ module Boxlet
72
72
  end
73
73
 
74
74
  # Check for free space
75
- if Boxlet::App.free_space <= 50
76
- raise "Not enough free space"
77
- end
78
- if Boxlet::App.app_space_usage / Boxlet::App.app_space_capacity >= 0.9
79
- puts "App is over 90% full"
75
+ if !Boxlet.config[:s3][:enabled]
76
+ if Boxlet::App.free_space <= 50
77
+ raise "Not enough free space"
78
+ end
79
+ if Boxlet::App.app_space_usage / Boxlet::App.app_space_capacity >= 0.9
80
+ puts "App is over 90% full"
81
+ end
80
82
  end
81
83
 
82
84
  puts "\nBoxlet setup is done!"
@@ -89,10 +91,12 @@ module Boxlet
89
91
  # App disk space functions
90
92
 
91
93
  def self.free_space
94
+ return -1 if Boxlet.config[:s3][:enabled]
92
95
  Boxlet::App.app_space_capacity - Boxlet::App.app_space_usage
93
96
  end
94
97
 
95
98
  def self.app_space_capacity
99
+ return -1 if Boxlet.config[:s3][:enabled]
96
100
  drive_free_space = Boxlet::App.drive_free_space
97
101
  if Boxlet.config[:capacity].is_a? String
98
102
  Boxlet::App.drive_free_space * Boxlet.config[:capacity].to_i / 100
@@ -103,6 +107,7 @@ module Boxlet
103
107
 
104
108
  def self.app_space_usage
105
109
  raise RuntimeError, "#{Boxlet.config[:upload_dir]} is not a directory" unless File.directory?(Boxlet.config[:upload_dir])
110
+ return -1 if Boxlet.config[:s3][:enabled]
106
111
 
107
112
  total_size = 0
108
113
  Dir["#{Boxlet.config[:upload_dir]}/**/*"].each do |f|
@@ -94,11 +94,9 @@ module Boxlet
94
94
 
95
95
  new_thumb_filename = "#{asset_path_params["id"]}-thumb.#{asset_path_params["ext"]}"
96
96
  new_thumb_path = File.join(upload_path, new_thumb_filename)
97
- # FileUtils.cp(new_path, new_thumb_path)
98
97
 
99
98
  if File.exists? new_path
100
99
  file = File.open(new_path, 'r')
101
- # asset_date = Date.parse(@params[:asset_date])
102
100
  asset = {
103
101
  filename: new_filename,
104
102
  size: file.size,
@@ -23,13 +23,13 @@ module Boxlet
23
23
 
24
24
  response = Rack::Response.new
25
25
  controller = Boxlet::Controller.new(request)
26
- if (@method == :* || request.get? && @method == :get) || (request.post? && @method == :post)
26
+ if @method == :* || (request.get? && @method == :get) || (request.post? && @method == :post)
27
27
  puts "Responding: #{@method.upcase} => #{@action}" if Boxlet.debug?
28
28
  action_response = controller.action(@action)
29
29
  response.status = 200
30
30
  else
31
31
  response.status = 404
32
- action_response[:content] = "404 not found"
32
+ action_response = {format: :html, content: "404 not found"}
33
33
  end
34
34
 
35
35
  if action_response[:format] == :json
data/lib/boxlet/config.rb CHANGED
@@ -58,6 +58,9 @@ module Boxlet
58
58
  :log_file => {
59
59
  :short => 'L',
60
60
  :default => Proc.new { Dir.pwd + "/server.log" }
61
+ },
62
+ :s3 => {
63
+ :default => { enabled: false }
61
64
  }
62
65
  }
63
66
 
@@ -1,3 +1,3 @@
1
1
  module Boxlet
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - arktisklada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-08 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack