raxus 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/raxus +1 -1
- data/lib/raxus.rb +4 -3
- data/spec/basic_spec.rb +6 -0
- data/spec/spec_helper.rb +3 -2
- metadata +51 -75
- data/spec/spec.opts +0 -2
data/bin/raxus
CHANGED
@@ -7,7 +7,7 @@ require "rack"
|
|
7
7
|
require "lib/raxus"
|
8
8
|
require "optparse"
|
9
9
|
|
10
|
-
@options = { :port => 5000, :address => "
|
10
|
+
@options = { :port => 5000, :address => "0.0.0.0", :limit => false }
|
11
11
|
|
12
12
|
ARGV.options do |opt|
|
13
13
|
opt.banner = 'Usage: raxus [options] file1 folder1 file2 ...'
|
data/lib/raxus.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
$:.unshift File.dirname(__FILE__)
|
1
|
+
$:.unshift File.dirname(__FILE__) + "/lib/"
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "compress"
|
4
4
|
|
5
5
|
class Raxus
|
6
6
|
|
@@ -30,9 +30,10 @@ class Raxus
|
|
30
30
|
end
|
31
31
|
|
32
32
|
@body = File.read(@options[:newfile])
|
33
|
+
@options[:filename] = File.basename(@options[:newfile])
|
33
34
|
|
34
35
|
@headers["Content-Type"] = "binary/octet-stream"
|
35
|
-
@headers["Content-Disposition"] = "attachment; filename=\"#{@options[:
|
36
|
+
@headers["Content-Disposition"] = "attachment; filename=\"#{@options[:filename]}\""
|
36
37
|
@headers["Content-Length"] = @body.size.to_s
|
37
38
|
end
|
38
39
|
|
data/spec/basic_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
3
|
|
3
4
|
describe Raxus do
|
@@ -12,11 +13,13 @@ describe Raxus do
|
|
12
13
|
it "should be able to share one file" do
|
13
14
|
browser = prepare_browser(:files => ["#{data_path}/avatar.jpg"])
|
14
15
|
browser.last_response.body.should == File.read("#{data_path}/avatar.jpg")
|
16
|
+
browser.last_response.header["Content-Disposition"].should include(%{filename="avatar.jpg"})
|
15
17
|
end
|
16
18
|
|
17
19
|
it "should be able to share one folder" do
|
18
20
|
browser = prepare_browser(:files => ["#{data_path}/GPL"])
|
19
21
|
browser.last_response.body.should == File.read("/tmp/GPL.zip")
|
22
|
+
browser.last_response.header["Content-Disposition"].should include(%{filename="GPL.zip"})
|
20
23
|
end
|
21
24
|
|
22
25
|
it "should be able to share files/folders many times" do
|
@@ -24,16 +27,19 @@ describe Raxus do
|
|
24
27
|
10.times do
|
25
28
|
browser.get '/'
|
26
29
|
browser.last_response.body.should == File.read("/tmp/download.zip")
|
30
|
+
browser.last_response.header["Content-Disposition"].should include(%{filename="download.zip"})
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
30
34
|
it "should be able to set download limit" do
|
31
35
|
browser = prepare_browser(:files => ["#{data_path}/avatar.jpg"], :limit => 5)
|
32
36
|
browser.last_response.body.should == File.read("#{data_path}/avatar.jpg")
|
37
|
+
browser.last_response.header["Content-Disposition"].should include(%{filename="avatar.jpg"})
|
33
38
|
|
34
39
|
4.times do # one get already done in prepare_browser
|
35
40
|
browser.get '/'
|
36
41
|
browser.last_response.body.should == File.read("#{data_path}/avatar.jpg")
|
42
|
+
browser.last_response.header["Content-Disposition"].should include(%{filename="avatar.jpg"})
|
37
43
|
end
|
38
44
|
|
39
45
|
browser.get '/'
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,115 +1,91 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: raxus
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- sebcioz
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rack
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 1
|
30
|
-
- 0
|
16
|
+
requirement: &2164170420 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
31
21
|
version: 1.1.0
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: thin
|
36
23
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
24
|
+
version_requirements: *2164170420
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thin
|
27
|
+
requirement: &2164169300 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
45
32
|
version: 1.2.0
|
46
33
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rubyzip
|
50
34
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
35
|
+
version_requirements: *2164169300
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rubyzip
|
38
|
+
requirement: &2164168820 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
59
43
|
version: 0.9.4
|
60
44
|
type: :runtime
|
61
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2164168820
|
62
47
|
description: Easy file sharing with rack
|
63
48
|
email: sebcioz@gmail.com
|
64
|
-
executables:
|
49
|
+
executables:
|
65
50
|
- raxus
|
66
51
|
extensions: []
|
67
|
-
|
68
52
|
extra_rdoc_files: []
|
69
|
-
|
70
|
-
files:
|
53
|
+
files:
|
71
54
|
- LICENCE
|
72
55
|
- README.markdown
|
73
56
|
- bin/raxus
|
74
57
|
- lib/compress.rb
|
75
58
|
- lib/raxus.rb
|
76
|
-
- spec/
|
59
|
+
- spec/basic_spec.rb
|
77
60
|
- spec/data/avatar.jpg
|
61
|
+
- spec/data/GPL/agplv3-88x31.png
|
78
62
|
- spec/data/GPL/gpl-1.0.txt
|
79
63
|
- spec/data/GPL/gplv3-127x51.png
|
80
|
-
- spec/data/GPL/agplv3-88x31.png
|
81
64
|
- spec/data/rfc2606.txt
|
82
|
-
- spec/
|
83
|
-
- spec/spec.opts
|
84
|
-
has_rdoc: true
|
65
|
+
- spec/spec_helper.rb
|
85
66
|
homepage: http://github.com/sebcioz/raxus
|
86
67
|
licenses: []
|
87
|
-
|
88
68
|
post_install_message:
|
89
69
|
rdoc_options: []
|
90
|
-
|
91
|
-
require_paths:
|
70
|
+
require_paths:
|
92
71
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
|
105
|
-
- 0
|
106
|
-
version: "0"
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
107
84
|
requirements: []
|
108
|
-
|
109
85
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 1.8.10
|
111
87
|
signing_key:
|
112
88
|
specification_version: 3
|
113
89
|
summary: Easy file sharing with rack
|
114
|
-
test_files:
|
90
|
+
test_files:
|
115
91
|
- spec/basic_spec.rb
|
data/spec/spec.opts
DELETED