Module: RedisMonitor

Defined in:
lib/version.rb,
lib/redis_monitor.rb,
lib/command_line_parser.rb

Defined Under Namespace

Classes: CommandLineParser

Constant Summary collapse

VERSION =
'0.3.3'

Class Method Summary collapse

Class Method Details

.base_folderObject



17
18
19
# File 'lib/redis_monitor.rb', line 17

def self.base_folder
  File.dirname(__FILE__)
end

.environmentObject



13
14
15
# File 'lib/redis_monitor.rb', line 13

def self.environment
  'production'
end

.parse_argumentsObject



5
6
7
# File 'lib/redis_monitor.rb', line 5

def self.parse_arguments
  CommandLineParser.parse(ARGV.dup)
end

.rakefile_pathObject



21
22
23
# File 'lib/redis_monitor.rb', line 21

def self.rakefile_path
  "#{base_folder}/engine/Rakefile"
end

.runObject



25
26
27
28
29
30
31
32
# File 'lib/redis_monitor.rb', line 25

def self.run
  args = parse_arguments
  store_arguments(args)

  system("#{base_folder}/engine/bin/rake", '-f', rakefile_path, 'db:migrate', "RAILS_ENV=#{environment}")
  system("#{base_folder}/engine/bin/delayed_job", 'restart', "RAILS_ENV=#{environment}")
  system("#{base_folder}/engine/bin/rails", 's', '-p', args[:http_port].to_s, '-e', environment)
end

.store_arguments(args) ⇒ Object



9
10
11
# File 'lib/redis_monitor.rb', line 9

def self.store_arguments(args)
  ENV['REDIS_MONITOR_OPTS'] = Base64.encode64(Marshal.dump(args))
end