Sha256: 060ba857f258ee1d013d1fc1389614ecf7e1bd683585fa3f3cba7f233de553df

Contents?: true

Size: 1.09 KB

Versions: 72

Compression:

Stored size: 1.09 KB

Contents

# Detects route variable changes
class Jets::Resource::ApiGateway::RestApi::Routes::Change
  class Variable < Base
    def self.changed?
      new.changed?
    end

    def changed?
      changed = false
      deployed_routes.each do |deployed_route|
        parent = collision.variable_parent(deployed_route.path)
        parent_variables = collision.parent_variables(parent, [deployed_route.path])
        new_parent_variables = collision.parent_variables(parent, new_paths)

        changed = parent_variables.size > 0 && new_parent_variables.size > 0 &&
                  parent_variables != new_parent_variables
        break if changed
      end
      changed
    end

    # Only consider paths with variables
    def new_paths
      new_routes.map(&:path).select {|p| p.include?(':')}.uniq
    end

    # Only consider deployed routes with variables
    def deployed_routes
      deployed_routes = super
      deployed_routes.select do |route|
        route.path.include?(':')
      end
    end

    def collision
      @collision ||= Jets::Resource::ApiGateway::RestApi::Routes::Collision.new
    end
  end
end

Version data entries

72 entries across 72 versions & 3 rubygems

Version Path
jets_bb_fork-0.0.4 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.1.1 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.1.0 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.0.6 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.0.5 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.0.4 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.0.3 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.0.1 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-2.0.0 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.32 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.31 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.30 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.29 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.28 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.27 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.26 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.25 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.24 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.23 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb
jets-1.9.22 lib/jets/resource/api_gateway/rest_api/routes/change/variable.rb