Module: Prosody
- Defined in:
- lib/diaspora-prosody-config.rb
Constant Summary collapse
- GEMDIR =
Gem::Specification.find_by_name( 'diaspora-prosody-config' ).gem_dir.freeze
- WRAPPERCFG =
"#{GEMDIR}/etc/prosody.cfg.lua".freeze
- DIASPORACFG =
"#{FileUtils.pwd}/config/prosody.cfg.lua".freeze
Class Method Summary collapse
Class Method Details
.start ⇒ Object
29 30 31 |
# File 'lib/diaspora-prosody-config.rb', line 29 def self.start check_sanity && system("#{find_binary} --config #{WRAPPERCFG}") end |
.update_configuration ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/diaspora-prosody-config.rb', line 33 def self.update_configuration # update prosody cfg in diaspora config dir gemcfg = "#{WRAPPERCFG}.tpl" unless File.exist?(DIASPORACFG) FileUtils.cp(gemcfg, DIASPORACFG) end config = File.read(DIASPORACFG) config_params.each do |k, v| begin v = 'MySQL' if v.include?('mysql2') v = 'PostgreSQL' if v.include?('postgresql') v = 'SQLite3' if v.include?('sqlite3') rescue warn("Warning! #{k} is empty") end config.gsub!(/\#\{#{k}\}/, "#{v}") end File.open(WRAPPERCFG, 'w') {|f| f.write(config) } end |