shuck 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/shuck/cli.rb CHANGED
@@ -9,16 +9,16 @@ module Shuck
9
9
  method_option :root, :type => :string, :aliases => '-r'
10
10
  method_option :port, :type => :numeric, :aliases => '-p', :required => true
11
11
  def server
12
- root = File.expand_path(options[:root])
13
- puts "Loading Shuck with #{root} on port #{options[:port]}"
14
12
  store = nil
15
13
  if options[:root]
16
- store = FileStore.new(options[:root])
14
+ root = File.expand_path(options[:root])
15
+ store = FileStore.new(root)
17
16
  end
18
17
  if store.nil?
19
18
  puts "You must specify a root to use a file store (the current default)"
20
19
  exit(-1)
21
20
  end
21
+ puts "Loading Shuck with #{root} on port #{options[:port]}"
22
22
  server = Shuck::Server.new(options[:port],store)
23
23
  server.serve
24
24
  end
@@ -43,7 +43,10 @@ module Shuck
43
43
 
44
44
  def store_object(bucket,object,request)
45
45
  begin
46
- File.open(File.join(@root,bucket,object),'w') do |f|
46
+ filename = File.join(@root,bucket,object)
47
+ parent_dir = File.dirname(filename)
48
+ FileUtils.mkdir_p(parent_dir)
49
+ File.open(filename,'w') do |f|
47
50
  request.body do |chunk|
48
51
  f << chunk
49
52
  end
data/lib/shuck/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shuck
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -47,6 +47,17 @@ class S3CommandsTest < Test::Unit::TestCase
47
47
  assert_equal buf_len,output.size
48
48
  end
49
49
 
50
+ def test_multi_directory
51
+ bucket = Bucket.create("mybucket")
52
+ S3Object.store("dir/myfile/123.txt","recursive","mybucket")
53
+
54
+ output = ""
55
+ obj = S3Object.stream("dir/myfile/123.txt","mybucket") do |chunk|
56
+ output << chunk
57
+ end
58
+ assert_equal "recursive", output
59
+ end
60
+
50
61
  def test_find_nil_bucket
51
62
  begin
52
63
  bucket = Bucket.find("unknown")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Curtis Spencer