Class: ARDBCopy::Application

Inherits:
Object
  • Object
show all
Defined in:
bin/ar_dbcopy

Class Method Summary collapse

Class Method Details

.run!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'bin/ar_dbcopy', line 7

def self.run!
  @options = {}

  @opts = OptionParser.new do |opts|
    opts.banner = "Usage: #{$0} [options] database.yml"

    opts.separator "copy data between two databases defined in the given database_yaml"
    opts.separator "uses the databases 'source' and 'target'"

    opts.on "-c", "--with-schema", "also copy the schema to the target database" do |arg|
      @options[:copy_schema] = arg
    end

    opts.on( '-h', '--help', 'Display this screen' ) do
      puts opts
      exit
    end
  end

  @opts.parse!

  unless ARGV[0]
    puts @opts
    exit 1
  end

  ARDBCopy.new(ARGV[0], @options).run!
end