Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: Blanket is a flexible backup framework designed to get the drudgery out of the way and to make automated backups easy.
Homepage: http://jimvanfleet.com/projects/blanket
Clone URL: git://github.com/bigfleet/blanket.git
Search Repo:
Redoing some includes, blanket-cfg now includes source and sink config 
writing
bigfleet (author)
Sat Feb 23 19:13:45 -0800 2008
commit  c220ab4a2be738411b2399b9e47ddb6d806e2300
tree    c6d27b4ff389c2f0c80c045d7b9bef4deaf2712a
parent  2e35a7ee09aad88e2e84f47f2e54c71e38e2cfe1
...
36
37
38
 
 
 
 
 
 
 
 
 
 
 
39
40
41
42
43
44
45
46
47
48
49
50
 
 
51
...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
 
 
 
 
 
 
 
 
51
52
53
0
@@ -36,15 +36,17 @@ $stderr << BAD_ARGS unless OPTIONS[:task] && OPTIONS[:source] && OPTIONS[:sink]
0
 
0
 task = OPTIONS[:task]
0
 source_class = OPTIONS[:source]
0
+@task_dir = FileUtils.pwd + "/" +task
0
+puts "Creating #{@task_dir}"
0
+FileUtils.mkdir_p @task_dir
0
+
0
+def write_config_for(sym)
0
+ file = @task_dir + "/#{sym.to_s}.yml"
0
+ atts = Object.const_get(OPTIONS[sym]).default_attributes
0
+ writer = Writer.new(atts)
0
+ puts "Writing #{sym} configuration #{file}"
0
+ writer.write(file)
0
+end
0
 
0
-task_dir = FileUtils.pwd + "/" +task
0
-puts "Creating #{task_dir}"
0
-FileUtils.mkdir_p task_dir
0
-source_file = task_dir + "/source.yml"
0
-source_atts = Object.const_get(source_class).default_attributes
0
-source_writer = Writer.new(source_atts)
0
-puts "Writing source configuration #{source_file}"
0
-source_writer.write(source_file)
0
-
0
-
0
-
0
+write_config_for(:source)
0
+write_config_for(:sink)
0
\ No newline at end of file
...
3
4
5
6
7
8
9
 
 
 
 
 
 
 
 
 
 
...
3
4
5
 
 
 
6
7
8
9
10
11
12
13
14
15
16
0
@@ -3,6 +3,13 @@ require 'yaml'
0
 require 'net/ssh'
0
 gem 'aws-s3'
0
 
0
-load File.dirname(__FILE__) + "/config/reader.rb"
0
-load File.dirname(__FILE__) + "/config/writer.rb"
0
-load File.dirname(__FILE__) + "/../plugins/sources/confluence.rb"
0
\ No newline at end of file
0
+# God, this is laborious. I need to know how to do this better.
0
+
0
+require File.dirname(__FILE__) + "/utils.rb"
0
+require File.dirname(__FILE__) + "/config/reader.rb"
0
+require File.dirname(__FILE__) + "/config/writer.rb"
0
+require File.dirname(__FILE__) + "/runner.rb"
0
+require File.dirname(__FILE__) + "/sink.rb"
0
+require File.dirname(__FILE__) + "/source.rb"
0
+require File.dirname(__FILE__) + "/../plugins/sources/confluence.rb"
0
+require File.dirname(__FILE__) + "/../plugins/sinks/s3.rb"
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0
@@ -0,0 +1,19 @@
0
+class S3 < Sink
0
+
0
+ def self.attribute_symbols
0
+ [:access_key_id, :secret_access_key, :blanket_type]
0
+ end
0
+
0
+ def self.default_blanket_type
0
+ "S3"
0
+ end
0
+
0
+ def self.default_access_key_id
0
+ "your-id"
0
+ end
0
+
0
+ def self.default_secret_access_key
0
+ "your-secret-ket"
0
+ end
0
+
0
+end
0
\ No newline at end of file
...
1
2
3
4
5
6
7
8
9
10
11
12
 
13
14
15
...
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
0
@@ -1,15 +1,4 @@
0
-class Confluence
0
-
0
- def self.default_attributes
0
- atts = {}
0
- attribute_symbols.each do |sym|
0
- sym_string = "default_"+sym.to_s
0
- default_sym = sym_string.to_sym
0
- val = self.send(default_sym)
0
- atts[sym.to_s] = val
0
- end
0
- atts
0
- end
0
+class Confluence < Source
0
   
0
   def self.attribute_symbols
0
     [:blanket_type, :host, :user, :password, :directory, :bucket]
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-load File.dirname(__FILE__) + "/spec_helper.rb"
0
+require File.dirname(__FILE__) + "/spec_helper.rb"
0
 
0
 describe "The Confluence source" do
0
   
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-load File.dirname(__FILE__) + "/spec_helper.rb"
0
+require File.dirname(__FILE__) + "/spec_helper.rb"
0
 
0
 describe "The YAML config file" do
0
   
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-load File.dirname(__FILE__) + "/spec_helper.rb"
0
+require File.dirname(__FILE__) + "/spec_helper.rb"
0
 
0
 describe "The SSH connection" do
0
   
...
1
2
 
3
4
...
 
 
1
2
3
0
@@ -1,3 +1,2 @@
0
-load File.dirname(__FILE__) + "/../lib/init.rb"
0
-load File.dirname(__FILE__) + "/../lib/runner.rb"
0
+require File.dirname(__FILE__) + "/../lib/init.rb"
0
 gem 'rspec'
0
\ No newline at end of file
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-load File.dirname(__FILE__) + "/spec_helper.rb"
0
+require File.dirname(__FILE__) + "/spec_helper.rb"
0
 
0
 describe "The Blanket config writer" do
0
   

Comments

    No one has commented yet.