Sha256: a72999978505af04d0c6ab71aeda2dabb1eeb0c526c97888f4e688abb343863e

Contents?: true

Size: 994 Bytes

Versions: 2

Compression:

Stored size: 994 Bytes

Contents

require 'canals'
require 'canals/version'
require 'canals/tools/completion'

module Canals
  module Cli
    module Helpers

      def tstop(name)
        Canals.stop(name)
        say "Tunnel #{name.inspect} stopped."
      end

      def tstart(name)
        pid = Canals.start(name)
        tunnel = Canals.repository.get(name)
        say "Created tunnel #{name.inspect} with pid #{pid}. You can access it using '#{tunnel.bind_address}:#{tunnel.local_port}'"
        pid
      end

      def trestart(name)
        tstop(name)
        tstart(name)
      end

      def startup_checks
        check_completion
      end

      def check_completion
        if Canals.config[:completion_version]
          if Canals.config[:completion_version] != Canals::VERSION
            Canals::Tools::Completion.update_completion
            say "bash completion script upgraded, use `source #{Canals::Tools::Completion.cmp_file}` to reload it", :red
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
canals-0.8.3 lib/canals/cli/helpers.rb
canals-0.8.2 lib/canals/cli/helpers.rb