baya 0.1.1 → 0.1.2

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.
data/README.rdoc CHANGED
@@ -9,6 +9,12 @@ At the moment, Baya supports archives from the following:
9
9
  * Github accounts
10
10
  * Local and remote machines via rsync
11
11
 
12
+ == Installation
13
+
14
+ Baya is available on Rubygems. You can install it by simply running:
15
+
16
+ gem install baya
17
+
12
18
  == Usage
13
19
 
14
20
  Baya aims at being simple to use. Just typing
@@ -88,8 +94,7 @@ repositories are backed up at the moment.
88
94
 
89
95
  === Rsync adapter
90
96
 
91
- In archive mode, the `rsync` adapter accepts only two parameters. Both are
92
- mandatory:
97
+ In archive mode, the `rsync` adapter requires two mandatory parameters:
93
98
 
94
99
  * `source` specifies where to copy from. You can use any rsync compliant
95
100
  syntax to specify remote folders.
@@ -108,6 +113,11 @@ In backup mode, rsync will be invoked with the following arguments:
108
113
  * A timestamp will be added to the destination folder, in order to create a
109
114
  different snapshot for every run
110
115
 
116
+ The Rsync adapter also accepts the following optional options:
117
+
118
+ * `verbose`: If set to something different than `null` or `false`, this option
119
+ will enable the verbose mode on the `rsync` subprocess.
120
+
111
121
  == License
112
122
 
113
123
  The MIT License
@@ -39,8 +39,19 @@ module Baya
39
39
 
40
40
  def rsync_archive(source, target)
41
41
  check_folder(target, "destination")
42
- Open3.popen3("rsync", "-az", source, target) do |i, o, e, process|
43
- if process.value != 0
42
+ options = "-az"
43
+ options += 'v' if @config['verbose']
44
+ Open3.popen3("rsync", options, source, target) do |i, o, e, process|
45
+ process && process.value
46
+
47
+ o.each_line do |l|
48
+ STDOUT.puts "rsync: #{l}"
49
+ end
50
+ e.each_line do |l|
51
+ STDERR.puts "rsync: #{l}"
52
+ end
53
+
54
+ if process && process.value != 0
44
55
  raise "Non-zero value from `rsync`."
45
56
  end
46
57
  end
@@ -56,9 +67,19 @@ module Baya
56
67
  target
57
68
  ]
58
69
  options << "--link-dest=#{link}" if link
70
+ options << "-v" if @config['verbose']
59
71
 
60
72
  Open3.popen3(*options) do |i, o, e, process|
61
- if process.value != 0
73
+ process && process.value
74
+
75
+ o.each_line do |l|
76
+ STDOUT.puts "rsync: #{l}"
77
+ end
78
+ e.each_line do |l|
79
+ STDERR.puts "rsync: #{l}"
80
+ end
81
+
82
+ if process && process.value != 0
62
83
  raise "Non-zero value from `rsync`."
63
84
  end
64
85
  end
@@ -29,7 +29,11 @@ module Baya
29
29
  @config = Configuration::File.new(@args.config)
30
30
 
31
31
  runner = Runner.new(@config)
32
- runner.run
32
+ begin
33
+ runner.run
34
+ rescue => e
35
+ err.puts "Error: #{e.message}"
36
+ end
33
37
  end
34
38
 
35
39
  def out
data/lib/baya.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Baya
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
 
4
4
  ROOT = File.expand_path('..', __FILE__)
5
5
  require ROOT + "/baya/adapters"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: git