Sha256: 5419353c18d929d1deeb4f114c7f3e90a48f7a753efc9d8df4fb214036777c22

Contents?: true

Size: 1015 Bytes

Versions: 8

Compression:

Stored size: 1015 Bytes

Contents

module Ec2onrails
  module CapistranoUtils
    def run_local(command)
      result = system command
      raise("error: #{$?}") unless result
    end
    
    def run_init_script(script, arg)
      # since init scripts might have the execute bit unset by the set_roles script we need to check
      sudo "sh -c 'if [ -x /etc/init.d/#{script} ] ; then /etc/init.d/#{script} #{arg}; fi'"
    end
    
    def make_admin_role_for(role)
      newrole = "#{role.to_s}_admin".to_sym
      roles[role].each do |srv_def|
        options = srv_def.options.dup
        options[:user] = "admin"
        options[:port] = srv_def.port
        options[:no_release] = true
        role newrole, srv_def.host, options
      end
    end
    
    # return hostnames for the role named role_sym that has the specified options
    def hostnames_for_role(role_sym, options = {})
      role = roles[role_sym]
      unless role
        return []
      end
      role.select{|s| s.options == options}.collect{|s| s.host}
    end
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
Agiley-ec2onrails-0.9.9 lib/ec2onrails/capistrano_utils.rb
hennk-ec2onrails-0.9.9.1 lib/ec2onrails/capistrano_utils.rb
hennk-hennk-ec2onrails-0.9.9.2 lib/ec2onrails/capistrano_utils.rb
hennk-hennk-ec2onrails-0.9.9.3 lib/ec2onrails/capistrano_utils.rb
ec2onrails-0.9.8.1 lib/ec2onrails/capistrano_utils.rb
ec2onrails-0.9.9.1 lib/ec2onrails/capistrano_utils.rb
ec2onrails-0.9.8 lib/ec2onrails/capistrano_utils.rb
ec2onrails-0.9.9 lib/ec2onrails/capistrano_utils.rb