Class: RRSE::Command::InstallDefaultDB

Inherits:
Object
  • Object
show all
Defined in:
lib/rrse/install-default-db-command.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ InstallDefaultDB

Returns a new instance of InstallDefaultDB.



9
10
11
# File 'lib/rrse/install-default-db-command.rb', line 9

def initialize(dir)
  @dir = dir
end

Class Method Details

.short_descriptionObject



5
6
7
# File 'lib/rrse/install-default-db-command.rb', line 5

def self.short_description
  "install default db"
end

Instance Method Details

#find_file(path) ⇒ Object



26
27
28
# File 'lib/rrse/install-default-db-command.rb', line 26

def find_file(path)
  `gem contents rrse`.split(/\n/).grep(/#{Regexp.quote(path)}\Z/).first
end

#optionsObject



13
14
15
16
17
# File 'lib/rrse/install-default-db-command.rb', line 13

def options
  opts = OptionParser.new
  opts.banner = "Usage: rrse [global-options] install-default-db"
  opts
end

#run(argv) ⇒ Object



19
20
21
22
23
24
# File 'lib/rrse/install-default-db-command.rb', line 19

def run(argv)
  options.parse!(argv)

  FileUtils.cp(find_file("misc/table"), @dir, verbose: true)
  FileUtils.cp(find_file("misc/index_table"), @dir, verbose: true)
end