Sha256: 0c867a153868397aa781880cd43a972105d0b7f8ed9f50bfced3056654839982

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

module Cluster
  
  module Base
    include GoldenBrindle::Command::Base
    
    def configure 
      options [ 
        ["-c", "--conf_path PATH", "Path to golden_brindle configuration files", :@cwd, "."],
        ["-V", "", "Verbose output", :@verbose, false]
      ]
    end
    
    def run
      command = self.class.to_s.downcase.split('::')[1]
      Dir.chdir @cwd do
        confs =  Dir.glob("*.yml")
        confs += Dir.glob("*.conf")
        confs.each do |conf|
          cmd = "golden_brindle #{command} -C #{conf}"
          cmd += " -d" if command == "start" #daemonize only when start
          puts cmd if @verbose 
          output = `#{cmd}`
          puts output if @verbose
          puts "golden_brindle #{command} returned an error." unless $?.success?     
        end
      end
    end
    
  end
  
  class Start < GemPlugin::Plugin "/commands"
    include Cluster::Base
    
  end
  
  class Stop < GemPlugin::Plugin "/commands"
    include Cluster::Base
  end
  
  class Restart < GemPlugin::Plugin "/commands"
    include Cluster::Base
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
golden_brindle-0.0.3 lib/golden_brindle/cluster.rb
golden_brindle-0.0.2 lib/golden_brindle/cluster.rb
golden_brindle-0.0.1 lib/golden_brindle/cluster.rb