Class: Islo::Redis::Init

Inherits:
Command show all
Defined in:
lib/islo/commands/redis.rb

Overview

Redis initializer

Creates a minimal configuration because redis-server doesn’t accept arguments allowing for paths to be set.

Instance Attribute Summary

Attributes inherited from Command

#args, #command, #title, #wd

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#initialize, #title?

Constructor Details

This class inherits a constructor from Islo::Command

Class Method Details

.nameObject



42
43
44
# File 'lib/islo/commands/redis.rb', line 42

def self.name
  :'redis-init'
end

Instance Method Details

#execObject



46
47
48
49
50
51
52
53
54
# File 'lib/islo/commands/redis.rb', line 46

def exec
  FileUtils.mkdir_p(wd + 'db/redis')

  File.open(wd + 'db/redis/redis.conf', 'w') do |f|
    f << template.gsub('${WORKING_DIR}', wd.to_s)
  end
rescue SystemCallError => e
  raise Command::Error, e.message
end