Sha256: 57c92c820b0496c5517353a3751d71b04e1b28545c5d9f735db295cafa35d1d2

Contents?: true

Size: 948 Bytes

Versions: 24

Compression:

Stored size: 948 Bytes

Contents

module Shuttle
  class Nodejs < Shuttle::Strategy
    def setup
      if node_installed?
        log "Using Node.js v#{node_version}, Npm v#{npm_version}"
      else
        error "Node.js is not installed."
      end

      super
    end

    def deploy
      setup
      update_code
      checkout_code
      install_dependencies
      link_release
      cleanup_releases
    end

    private

    def node_installed?
      ssh.run("which node").success?
    end

    def node_version
      ssh.run("node -v").output.strip.gsub('v', '')
    end

    def npm_version
      ssh.run("npm -v").output.strip
    end

    def install_dependencies
      if ssh.file_exists?("#{release_path}/package.json")
        log "Installing application dependencies"

        result = ssh.run("cd #{release_path} && npm install")

        if result.failure?
          error "Unable to install dependencies: #{result.output}"
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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