Sha256: aa5801b193ce7700a6c014df24dec93171caac5f54046f15d7e7536b5ae15dcb

Contents?: true

Size: 636 Bytes

Versions: 32

Compression:

Stored size: 636 Bytes

Contents

class Jets::Controller
  class Stage
    def initialize(host, url)
      @host, @url = host, url
    end

    def add
      return @url unless add_stage?

      stage_name = Jets::Resource::ApiGateway::Deployment.stage_name
      "/#{stage_name}#{@url}"
    end

    def add_stage?
      return false if on_cloud9?
      @host.include?("amazonaws.com") && @url.starts_with?('/')
    end

    def on_cloud9?
      self.class.on_cloud9?(@host)
    end

    class << self
      def add(host, url)
        new(host, url).add
      end

      def on_cloud9?(host)
        !!(host =~ /cloud9\..*\.amazonaws\.com/)
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
jets-1.9.13 lib/jets/controller/stage.rb
jets-1.9.12 lib/jets/controller/stage.rb
jets-1.9.11 lib/jets/controller/stage.rb
jets-1.9.10 lib/jets/controller/stage.rb
jets-1.9.9 lib/jets/controller/stage.rb
jets-1.9.8 lib/jets/controller/stage.rb
jets-1.9.7 lib/jets/controller/stage.rb
jets-1.9.6 lib/jets/controller/stage.rb
jets-1.9.5 lib/jets/controller/stage.rb
jets-1.9.4 lib/jets/controller/stage.rb
jets-1.9.3 lib/jets/controller/stage.rb
jets-1.9.2 lib/jets/controller/stage.rb