Class: RRSE::Command::InstallDefaultDB
- Inherits:
-
Object
- Object
- RRSE::Command::InstallDefaultDB
- Defined in:
- lib/rrse/install-default-db-command.rb
Class Method Summary collapse
Instance Method Summary collapse
- #find_file(path) ⇒ Object
-
#initialize(dir) ⇒ InstallDefaultDB
constructor
A new instance of InstallDefaultDB.
- #options ⇒ Object
- #run(argv) ⇒ Object
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_description ⇒ Object
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 |
#options ⇒ Object
13 14 15 16 17 |
# File 'lib/rrse/install-default-db-command.rb', line 13 def opts = OptionParser.new opts. = "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) .parse!(argv) FileUtils.cp(find_file("misc/table"), @dir, verbose: true) FileUtils.cp(find_file("misc/index_table"), @dir, verbose: true) end |