outback 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/outback/cli.rb +30 -6
  3. data/lib/outback.rb +1 -6
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/lib/outback/cli.rb CHANGED
@@ -9,12 +9,21 @@ module Outback
9
9
  options = {}
10
10
  option_parser = OptionParser.new do |p|
11
11
  p.banner = "Usage: outback [configfile]"
12
- p.on('-v', '--verbose [VERBOSE]', 'be talky') do
12
+ p.on('-c', '--config NAME', 'execute only the backup identified by NAME') do |name|
13
+ options[:config] = name.to_s
14
+ end
15
+ p.on('-v', '--verbose', 'be talky') do
13
16
  Outback.verbose = true
14
17
  end
15
- p.on('-s', '--silent [SILENT]', 'be silent') do
18
+ p.on('-s', '--silent', 'be silent') do
16
19
  Outback.silent = true
17
20
  end
21
+ p.on('-l', '--list', 'list configurations, then exit') do
22
+ options[:list] = true
23
+ end
24
+ p.on('-t', '--test', 'test configurations, then exit') do
25
+ options[:test] = true
26
+ end
18
27
  p.on_tail("-h", "--help", "Show this message") do
19
28
  puts p
20
29
  exit
@@ -25,9 +34,8 @@ module Outback
25
34
  end
26
35
  end
27
36
  option_parser.parse!
28
- options[:configuration] = ARGV.first unless ARGV.first.blank?
29
37
  Outback::Configuration.reset
30
- config_file = options[:configuration] or begin
38
+ config_file = ARGV.first or begin
31
39
  unless File.exists?(DEFAULT_CONFIGURATION_FILE)
32
40
  Outback.error 'no configuration found'
33
41
  exit(1)
@@ -52,9 +60,25 @@ module Outback
52
60
  Outback.error "configuration #{configuration.name}: #{configuration.errors}"
53
61
  end
54
62
  exit(1) unless invalid_configs.empty?
55
- Outback::Configuration.loaded.each do |configuration|
56
- Outback::Backup.new(configuration).run!
63
+ if options[:test]
64
+ Outback.info 'configurations OK'
65
+ exit(0)
66
+ end
67
+ if options[:list]
68
+ Outback.info "available configurations:"
69
+ Outback::Configuration.loaded.each { |c| puts c.name }
70
+ exit(0)
71
+ end
72
+ configurations = if options[:config]
73
+ unless config = Outback::Configuration[options[:config]]
74
+ Outback.error "configuration '#{options[:config]}' not found"
75
+ exit(1)
76
+ end
77
+ [config]
78
+ else
79
+ Outback::Configuration.loaded
57
80
  end
81
+ configurations.each { |configuration| Outback::Backup.new(configuration).run! }
58
82
  end
59
83
 
60
84
  end
data/lib/outback.rb CHANGED
@@ -3,12 +3,7 @@ require 'fileutils'
3
3
  require 'tempfile'
4
4
  require 'tmpdir'
5
5
 
6
- require 'active_support/core_ext/object/blank'
7
- require 'active_support/core_ext/module'
8
- require 'active_support/core_ext/class/inheritable_attributes'
9
- require 'active_support/core_ext/time/conversions'
10
- require 'active_support/core_ext/string/inflections'
11
- require 'active_support/core_ext/numeric/time'
6
+ require 'active_support/core_ext'
12
7
 
13
8
  require 'aws/s3'
14
9
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outback
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthias Grosser