Class: Mysqlknife::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/mysqlknife/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



3
4
5
# File 'lib/mysqlknife/cli.rb', line 3

def initialize(*args)
  super
end

Instance Method Details

#checksumObject



40
41
42
43
44
45
# File 'lib/mysqlknife/cli.rb', line 40

def checksum
  unless Mysqlknife::Checksum.new(options).equal?
    puts "-- Table '#{options[:table]}' is not equal data."
    exit 1
  end
end

#killObject



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/mysqlknife/cli.rb', line 70

def kill
  kill = Mysqlknife::Kill.new(options)

  if kill.check_privileges
    if options[:kill]
      kill.clear
    else
      puts kill.show
    end
  else
    puts 'User does not have process privileges.'
  end
end

#skipObject



104
105
106
107
# File 'lib/mysqlknife/cli.rb', line 104

def skip
  rep = Mysqlknife::Replica.new(options)
  rep.skip
end

#swapObject



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/mysqlknife/cli.rb', line 131

def swap
  if options[:databases].split(',').count == 2
    swap = Mysqlknife::Swap.new(options).all

    if swap
      swap.each do |sql|
        puts sql
      end
    end
  end
end