Sha256: cc2030991946a396d137227eefea3230247aa1e4ca8f1f07b1ca2494e89ad5ec

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module Pairzone
  module Api
    module PairzoneConnection
      def connect(identity)
        Logger.info("Connecting to Pairzone...")
        shell(identity).run(%{ssh -i #{identity} -t pairzone@#{ip} "/usr/local/bin/pairzone-tmux.sh"})
      end

      def push_code(identity)
        Logger.debug("pushing local code to pairzone instance")
        shell(identity).remote(ip, "git init #{project_name} &&
          cd #{project_name} &&
          git config receive.denyCurrentBranch ignore")
        shell(identity).git("git push --mirror #{git_location}")
        shell(identity).remote(ip, "cd #{project_name} && git reset --hard")
      end

      def fetch_code(identity)
        shell(identity).git "git fetch #{git_location} master:pairzone"
        Logger.info("Your git code has been placed in a local 'pairzone' branch. To merge this code into your HEAD, run this commmand:\n\ngit merge pairzone")
      end

      def shell(identity)
        @shell ||= Shell.new(identity)
      end

      def git_location
        "pairzone@#{ip}:#{project_name}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pairzone-0.0.1 lib/pairzone/api/pairzone_connection.rb