Class: S3gb::S3fs
Instance Attribute Summary
Attributes inherited from Base
#config
Instance Method Summary
collapse
Methods inherited from Base
#backup, #collect_files, #commit_changes, #initialize
Constructor Details
This class inherits a constructor from S3gb::Base
Instance Method Details
#install ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/s3gb/s3fs.rb', line 10
def install
`sudo apt-get install build-essential libcurl4-openssl-dev libxml2-dev libfuse-dev`
require 'open-uri'
url = "http://code.google.com/p/s3fs"
page = open(url).read
path = page.match(%r{href="(.*?-source\.tar\.gz)"})[1]
url = "http://s3fs.googlecode.com/files/#{path.split('=').last}"
puts "installing from #{url}"
`cd /tmp && wget #{url} && tar -xzf s3fs* && cd s3fs && make && sudo make install`
end
|
#prepare ⇒ Object
5
6
7
8
|
# File 'lib/s3gb/s3fs.rb', line 5
def prepare
`mkdir #{mount_dir}` unless File.exist?(mount_dir)
`/usr/bin/s3fs #{config['bucket']} -o accessKeyId=#{config['accessKeyId']} -o secretAccessKey=#{config['secretAccessKey']} #{mount_dir}`
end
|
#push ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/s3gb/s3fs.rb', line 21
def push
Dir.glob("#{cache_dir}/*", File::FNM_DOTMATCH).each do |sub_path|
sub_path = File.basename(sub_path)
next if ['.','..'].include?(sub_path)
puts "syncing #{sub_path}"
`/usr/bin/rsync -avz --delete #{cache_dir}/#{sub_path} #{mount_dir}`
end
end
|