Sha256: 14a3ee3747b9fe56deffb226db69e5dae5012bb6e3c1ad279e2268d917fef736

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

module Capstrap
  module Hostname

    def self.load_into(configuration)
      configuration.load do

        namespace :hostname do

          desc "Sets the hostname."
          task :set_hostname do
            unless hostname_correct?(host_name)
              cmd = [
                %{echo "#{host_name}" > /etc/hostname},
                %{chown root:root /etc/hostname},
                %{chmod 0644 /etc/hostname},
                %{start hostname}
              ]
              run cmd.join(" && ")
            end
          end
        end
      end
    end
  end
end

if Capistrano::Configuration.instance
  Capstrap::Hostname.load_into(Capistrano::Configuration.instance)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capstrap-0.4.0 lib/capistrano/ext/capstrap/hostname.rb