class MaskSQL::CLI

Public Instance Methods

init() click to toggle source
# File lib/mask_sql/cli.rb, line 36
def init
  puts Initializer.copy_template
end
mask() click to toggle source
# File lib/mask_sql/cli.rb, line 17
def mask
  return unless validate_options

  converter_options = options.dup

  if options[:config]
    converter_options[:config] = File.expand_path(options[:config])
  else
    default_config = File.expand_path('.mask.yml')
    converter_options[:config] = default_config if File.exist?(default_config)
  end

  converter = Converter.new(converter_options)
  converter.mask
  puts "\e[32mDone.\e[0m"
end
version() click to toggle source
# File lib/mask_sql/cli.rb, line 43
def version
  puts "mask_sql #{MaskSQL::VERSION}"
end

Private Instance Methods

validate_options() click to toggle source
# File lib/mask_sql/cli.rb, line 49
def validate_options
  in_file = File.expand_path(options[:in])
  out_file = File.expand_path(options[:out])

  if in_file == out_file
    warn "\e[31mOutput file is the same as input file.\e[0m"
    return false
  end

  true
end