s3b 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (7) hide show
  1. data/README.md +40 -0
  2. data/README.rdoc +1 -1
  3. data/VERSION +1 -1
  4. data/s3b.gemspec +7 -3
  5. data/simple.rb +45 -0
  6. data/uri.rb +34 -0
  7. metadata +8 -4
@@ -0,0 +1,40 @@
1
+ This file `README.md` hides the original (jewler generated) README.rdoc
2
+
3
+ ## Gemcutter
4
+
5
+ rake -T
6
+ rake gemcutter:release
7
+
8
+ ## Requirements
9
+ We chose to implement over the (fog)[http://fog.io/1.0.0/storage/] api to allow us to
10
+ move easiliy to other providers later.
11
+
12
+ We want a simple utility to:
13
+
14
+ * make a mongodump of a database -> .tgz
15
+ * push/store to amazon s3
16
+ * fetch from amazon s3
17
+ * restore a database from .tgz
18
+
19
+ Usage
20
+
21
+ # Local operations
22
+ s3b dump mongodb://localhost/<dbname> <dump.tgz>
23
+ s3b restore <dump.tgz> mongo:<dbname>
24
+
25
+ # Simple S3 operations
26
+ s3b store <filename> s3://<bucketname>/<key>
27
+ s3b fetch s3://<bucketname>/<key> <filename>
28
+
29
+ ## Simple example
30
+ Following the docs at (fog.io)[http://fog.io/1.0.0/storage/].
31
+ Look at `simple.rb`
32
+
33
+ ## URI's
34
+ Look at uri.rb
35
+
36
+ ## Install fog
37
+ This is to test s3 storage with fog gem
38
+
39
+ sudo gem install fog
40
+
@@ -9,7 +9,7 @@ jeweler s3b
9
9
  bundle install
10
10
  bundle show
11
11
 
12
- rake version:write MAJOR=0 MINOR=1 PATCH=0
12
+ rake version:write MAJOR=0 MINOR=2 PATCH=0
13
13
  rake gemspec
14
14
 
15
15
  rake install
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -5,17 +5,18 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{s3b}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Lauzon"]
12
- s.date = %q{2011-09-15}
12
+ s.date = %q{2011-09-30}
13
13
  s.default_executable = %q{s3b}
14
14
  s.description = %q{Flexible s3 upload management for backup lifecycle}
15
15
  s.email = %q{daniel.lauzon@gmail.com}
16
16
  s.executables = ["s3b"]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
19
+ "README.md",
19
20
  "README.rdoc"
20
21
  ]
21
22
  s.files = [
@@ -23,14 +24,17 @@ Gem::Specification.new do |s|
23
24
  "Gemfile",
24
25
  "Gemfile.lock",
25
26
  "LICENSE.txt",
27
+ "README.md",
26
28
  "README.rdoc",
27
29
  "Rakefile",
28
30
  "VERSION",
29
31
  "bin/s3b",
30
32
  "lib/s3b.rb",
31
33
  "s3b.gemspec",
34
+ "simple.rb",
32
35
  "test/helper.rb",
33
- "test/test_s3b.rb"
36
+ "test/test_s3b.rb",
37
+ "uri.rb"
34
38
  ]
35
39
  s.homepage = %q{http://github.com/daneroo/s3b}
36
40
  s.licenses = ["MIT"]
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'fog'
3
+
4
+ # create a connection
5
+ connection = Fog::Storage.new({
6
+ :provider => 'AWS',
7
+ :aws_secret_access_key => 'EAFn9pcQzYMQ3dow8epruhx8NCw6pI8IEwtE8pBO',
8
+ :aws_access_key_id => 'AKIAJ7ANZ5QOSX6KLQ6Q'
9
+ })
10
+
11
+ # First, a place to contain the glorious details
12
+ directory = connection.directories.create(
13
+ #:key => "fog-demo-#{Time.now.to_i}", # globally unique name
14
+ :key => "fog-demo-simple", # globally unique name
15
+ :public => true
16
+ )
17
+
18
+ # list directories
19
+ #p connection.directories
20
+ connection.directories.each do |dir|
21
+ puts "directory (bucket): #{dir.key} location:#{dir.creation_date}"
22
+ end
23
+ puts ""
24
+
25
+ # upload that resume
26
+ file = directory.files.create(
27
+ :key => 'README.md',
28
+ :body => File.open("./README.md"),
29
+ :public => true
30
+ )
31
+ puts "uploaded #{file.key}: etag(md5):#{file.etag}"
32
+ puts ""
33
+
34
+ directory.files.each do |file|
35
+ puts "listing #{file.key}: etag(md5):#{file.etag}"
36
+ end
37
+
38
+
39
+ puts ""
40
+ puts 'axial-mongo listing'
41
+ axmongo=connection.directories.get('axial-mongo')
42
+ axmongo.files.each do |file|
43
+ puts "ax-mg #{file.key}: etag(md5):#{file.etag}"
44
+ end
45
+ puts ""
data/uri.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'rubygems'
2
+ require 'uri'
3
+
4
+ uris = %w{
5
+ http://hostname.tld/
6
+ file://hostname.tld/path
7
+ s3://bucketnmae/key.tgz
8
+ mongodb://localhost/dbname
9
+ mongodb:dbname
10
+ justaname
11
+ file:justname
12
+ }
13
+
14
+ parts = %w{ scheme userinfo host port registry path opaque query fragment }
15
+ #p parts
16
+
17
+ def removenil(uri)
18
+ uri.each do |k,v|
19
+ puts "#{k} : #{v}"
20
+ end
21
+
22
+ end
23
+ uris.each do |urlstr|
24
+ puts ""
25
+ puts "uri: #{urlstr}"
26
+ z = parts.zip(URI.split(urlstr))
27
+ uri={};
28
+ z.each do |kv|
29
+ uri[kv[0]]=kv[1]
30
+ end
31
+ uri.delete_if {|key, value| value == nil }
32
+ p uri
33
+ end
34
+ puts ""
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3b
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Lauzon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-15 00:00:00 -04:00
18
+ date: 2011-09-30 00:00:00 -04:00
19
19
  default_executable: s3b
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -114,20 +114,24 @@ extensions: []
114
114
 
115
115
  extra_rdoc_files:
116
116
  - LICENSE.txt
117
+ - README.md
117
118
  - README.rdoc
118
119
  files:
119
120
  - .document
120
121
  - Gemfile
121
122
  - Gemfile.lock
122
123
  - LICENSE.txt
124
+ - README.md
123
125
  - README.rdoc
124
126
  - Rakefile
125
127
  - VERSION
126
128
  - bin/s3b
127
129
  - lib/s3b.rb
128
130
  - s3b.gemspec
131
+ - simple.rb
129
132
  - test/helper.rb
130
133
  - test/test_s3b.rb
134
+ - uri.rb
131
135
  has_rdoc: true
132
136
  homepage: http://github.com/daneroo/s3b
133
137
  licenses: