niky81-s3rbackup 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/s3query.rb +11 -3
- data/bin/s3rbackup.rb +10 -4
- data/lib/s3dbsync.rb +6 -2
- metadata +2 -2
data/bin/s3query.rb
CHANGED
@@ -3,9 +3,13 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'optparse'
|
5
5
|
|
6
|
+
development_lib = File.join(File.dirname(__FILE__), '..', 'lib')
|
7
|
+
if File.exists? development_lib + '/s3dbsync.rb'
|
8
|
+
$LOAD_PATH.unshift(development_lib).uniq!
|
9
|
+
end
|
6
10
|
# always look "here" for include files (thanks aktxyz)
|
7
|
-
|
8
|
-
require '
|
11
|
+
#$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
|
12
|
+
require 's3dbsync'
|
9
13
|
|
10
14
|
|
11
15
|
class OptS3rquery
|
@@ -81,6 +85,10 @@ class OptS3rquery
|
|
81
85
|
opts.on("--bucket-log", String, "Bucket log NAME") do |name|
|
82
86
|
options[:bucket_log] = name
|
83
87
|
end
|
88
|
+
|
89
|
+
opts.on("-u", "--config-number NUM", Integer, "Number of config to use if nil use first") do |name|
|
90
|
+
options[:config_num] = name
|
91
|
+
end
|
84
92
|
|
85
93
|
opts.on_tail("-h", "--help", "Show this message") do
|
86
94
|
puts opts
|
@@ -106,7 +114,7 @@ end
|
|
106
114
|
|
107
115
|
options = OptS3rquery.parse(ARGV)
|
108
116
|
|
109
|
-
config = Configure.new(options[:file_cfg])
|
117
|
+
config = Configure.new(options[:file_cfg], options[:config_num])
|
110
118
|
config.current["bucket"] = options[:bucket] if options[:bucket]
|
111
119
|
|
112
120
|
s3db = S3SyncDb.new(config.current)
|
data/bin/s3rbackup.rb
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'optparse'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
development_lib = File.join(File.dirname(__FILE__), '..', 'lib')
|
7
|
+
if File.exists? development_lib + '/s3dbsync.rb'
|
8
|
+
$LOAD_PATH.unshift(development_lib).uniq!
|
9
|
+
end
|
10
|
+
require 's3dbsync'
|
9
11
|
|
10
12
|
|
11
13
|
class OptS3rbackup
|
@@ -46,6 +48,10 @@ class OptS3rbackup
|
|
46
48
|
options[:bucket_log] = name
|
47
49
|
end
|
48
50
|
|
51
|
+
opts.on("-u", "--config-number NUM", Integer, "Number of config to use if nil use first") do |name|
|
52
|
+
options[:config_num] = name
|
53
|
+
end
|
54
|
+
|
49
55
|
opts.on_tail("-h", "--help", "Show this message") do
|
50
56
|
puts opts
|
51
57
|
exit
|
@@ -61,7 +67,7 @@ options = OptS3rbackup.parse(ARGV)
|
|
61
67
|
#in argv rimane tutto il resto
|
62
68
|
#p ARGV
|
63
69
|
|
64
|
-
config = Configure.new(options[:file_cfg])
|
70
|
+
config = Configure.new(options[:file_cfg], options[:config_num])
|
65
71
|
config.current["bucket"] = options[:bucket] if options[:bucket]
|
66
72
|
config.current["log"] = options[:log] if options[:log] != nil
|
67
73
|
config.current["bucket_log"] = options[:bucket_log] if options[:bucket_log]
|
data/lib/s3dbsync.rb
CHANGED
@@ -12,7 +12,7 @@ class S3SyncDb
|
|
12
12
|
:secret_access_key => config["secret_access_key"])
|
13
13
|
|
14
14
|
@config = config
|
15
|
-
@db_file = config[
|
15
|
+
@db_file = "#{ENV['HOME']}/.s3rbackup/#{config['db_file']}"
|
16
16
|
@db_file = "#{ENV['HOME']}/.s3rbackup/s3db.yml" if !@db_file
|
17
17
|
@db_file_ver = "#{@db_file}.ver"
|
18
18
|
#apro il db
|
@@ -312,8 +312,12 @@ end
|
|
312
312
|
|
313
313
|
class Configure
|
314
314
|
attr_reader :current
|
315
|
-
def initialize(file_name = "#{ENV['HOME']}/.s3rbackup/config.yml")
|
315
|
+
def initialize(file_name = "#{ENV['HOME']}/.s3rbackup/config.yml", config_num = nil)
|
316
|
+
config_num = 0 if config_num == nil
|
316
317
|
file_name = "#{ENV['HOME']}/.s3rbackup/config.yml" if !file_name
|
317
318
|
@current = YAML::load(File.open(file_name))
|
319
|
+
if @current.class.to_s == "Array"
|
320
|
+
@current = @current[config_num]
|
321
|
+
end
|
318
322
|
end
|
319
323
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: niky81-s3rbackup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicola Sacchi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|