Sha256: 906624d65765114ea2bec2fdb11e74c975d92561b127c09919becfac5e52dcee

Contents?: true

Size: 1.07 KB

Versions: 25

Compression:

Stored size: 1.07 KB

Contents

module Shuttle
  module Support::Thin
    def thin_config
      config.thin || Hashr.new
    end

    def thin_host
      thin_config.host || "127.0.0.1"
    end

    def thin_port
      thin_config.port || "9000"
    end

    def thin_servers
      thin_config.servers || 1
    end

    def thin_env
      environment
    end

    def thin_options
      [
        "-a #{thin_host}",
        "-p #{thin_port}",
        "-e #{thin_env}",
        "-s #{thin_servers}",
        "-l #{shared_path('log/thin.log')}",
        "-P #{shared_path('pids/thin.pid')}",
        "-d"
      ].join(' ')
    end

    def thin_start
      log "Starting thin"

      res = ssh.run("cd #{release_path} && ./bin/thin #{thin_options} start")

      unless res.success?
        error "Unable to start thin: #{res.output}"
      end
    end

    def thin_stop
      log "Stopping thin"

      ssh.run("cd #{release_path} && ./bin/thin #{thin_options} stop")
    end

    def thin_restart
      if ssh.file_exists?(shared_path("pids/thin.#{thin_port}.pid"))
        thin_stop
      end

      thin_start
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
shuttle-deploy-0.4.0 lib/shuttle/support/thin.rb
shuttle-deploy-0.3.3 lib/shuttle/support/thin.rb
shuttle-deploy-0.3.2 lib/shuttle/support/thin.rb
shuttle-deploy-0.3.1 lib/shuttle/support/thin.rb
shuttle-deploy-0.3.0 lib/shuttle/support/thin.rb
shuttle-deploy-0.3.0.beta1 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.3 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.2 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.1 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta16 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta15 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta14 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta13 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta12 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta11 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta10 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta9 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta7 lib/shuttle/support/thin.rb
shuttle-deploy-0.2.0.beta6 lib/shuttle/support/thin.rb