Class: Rprov
- Inherits:
-
Object
- Object
- Rprov
- Defined in:
- lib/rprov.rb,
lib/rprov/config.rb,
lib/rprov/decorator.rb
Defined Under Namespace
Constant Summary collapse
- Conflict =
Class.new(StandardError)
- Missing =
Class.new(StandardError)
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#memory ⇒ Object
Returns the value of attribute memory.
-
#paranoid ⇒ Object
Returns the value of attribute paranoid.
Instance Method Summary collapse
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
16 17 18 |
# File 'lib/rprov.rb', line 16 def host @host end |
#memory ⇒ Object
Returns the value of attribute memory.
16 17 18 |
# File 'lib/rprov.rb', line 16 def memory @memory end |
#paranoid ⇒ Object
Returns the value of attribute paranoid.
16 17 18 |
# File 'lib/rprov.rb', line 16 def paranoid @paranoid end |
Instance Method Details
#info(path) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/rprov.rb', line 46 def info(path) conf = Config.new(key(path)) puts "\nREDIS_URL:\n #{conf.url}" puts "\nRun `rprov start #{path}` to start this instance" end |
#setup(path) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rprov.rb', line 28 def setup(path) raise Conflict if redis_conf(path) FileUtils.mkdir_p(path) if not File.exist?(path) conf = Config.generate conf.path = path conf.memory = memory if memory conf.host = host if host conf.paranoid = paranoid if paranoid where = File.(File.join(path, "redis.%s.conf" % conf.key)) File.open(where, "w") do |file| file.write conf.redis_conf end end |
#start(path) ⇒ Object
18 19 20 |
# File 'lib/rprov.rb', line 18 def start(path) exec("redis-server #{redis_conf!(path)}") end |