Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make file and module names consistent in preparation for introducing zeitwerk #661

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module PactBroker
module Api
module Contracts
class PactsForVerificationJSONQuerySchema < BaseContract
class PactsForVerificationJsonQuerySchema < BaseContract
json do
optional(:providerVersionBranch).maybe(:string)
optional(:providerVersionTags).maybe(:array?)
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/api/resources/clean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def allowed_methods
def process_post
if content_type_json?
keep_selectors = (params[:keep] || []).collect do | hash |
PactBroker::Matrix::UnresolvedSelector.new(hash)
PactBroker::DB::Clean::Selector.new(hash)
end

result = PactBroker::DB::Clean.call(Sequel::Model.db, { keep: keep_selectors })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def to_json

def schema
if request.get?
PactBroker::Api::Contracts::PactsForVerificationQueryStringSchema
api_contract_class(:pacts_for_verification_query_string_schema)
elsif request.post?
PactBroker::Api::Contracts::PactsForVerificationJSONQuerySchema
api_contract_class(:pacts_for_verification_json_query_schema)
end
end

Expand Down
1 change: 0 additions & 1 deletion lib/pact_broker/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
require "sucker_punch"
require "pact_broker/api/middleware/configuration"
require "pact_broker/api/middleware/basic_auth"
require "pact_broker/config/basic_auth_configuration"
require "pact_broker/api/authorization/resource_access_policy"
require "pact_broker/api/middleware/http_debug_logs"
require "pact_broker/application_context"
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/config/runtime_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "pact_broker/config/runtime_configuration_database_methods"
require "pact_broker/config/runtime_configuration_coercion_methods"
require "pact_broker/version"
require "pact_broker/config/basic_auth_configuration"
require "pact_broker/config/runtime_configuration_basic_auth_methods"
require "pact_broker/string_refinements"
require "pact_broker/hash_refinements"
require "pact_broker/error"
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion lib/pact_broker/pacts/pact_publication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "pact_broker/domain/pact"
require "pact_broker/pacts/pact_version"
require "pact_broker/integrations/integration"
require "pact_broker/tags/head_pact_tags"
require "pact_broker/tags/head_pact_tag"
require "pact_broker/pacts/pact_publication_dataset_module"
require "pact_broker/pacts/pact_publication_wip_dataset_module"
require "pact_broker/pacts/eager_loaders"
Expand Down
2 changes: 2 additions & 0 deletions lib/pact_broker/tasks/clean_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "rake/tasklib"

module PactBroker
module DB
class CleanTask < ::Rake::TaskLib
Expand Down
4 changes: 2 additions & 2 deletions lib/pact_broker/ui/controllers/can_i_deploy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"
require "pact_broker/ui/view_models/matrix_lines"
require "pact_broker/matrix/unresolved_selector"
require "pact_broker/matrix/parse_query"
Expand All @@ -20,7 +20,7 @@ class CanIDeploy < Base
selectors = [ PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: params[:pacticipant_name], latest: true, tag: params[:tag]) ]
options = { latestby: "cvp", limit: 100, tag: params[:to] }
result = matrix_service.find(selectors, options)
lines = PactBroker::UI::ViewDomain::MatrixLines.new(result, base_url: base_url)
lines = PactBroker::UI::ViewModels::MatrixLines.new(result, base_url: base_url)
locals = {
lines: lines,
selectors: create_selector_objects(selectors),
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/controllers/clusters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize pacticipants, relationships
end

get "/" do
view_model = ViewDomain::IndexItems.new(pacticipant_service.find_index_items, base_url: base_url)
view_model = ViewModel::IndexItems.new(pacticipant_service.find_index_items, base_url: base_url)
haml "clusters/show", locals: { relationships: view_model, base_url: base_url }, escape_html: true
end

Expand Down
4 changes: 2 additions & 2 deletions lib/pact_broker/ui/controllers/dashboard.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"
require "pact_broker/ui/view_models/index_items"
require "haml"

Expand Down Expand Up @@ -44,7 +44,7 @@ class Dashboard < Base
[]
end

view_index_items = ViewDomain::IndexItems.new(index_items, base_url: base_url, view: view)
view_index_items = ViewModel::IndexItems.new(index_items, base_url: base_url, view: view)

page = :'dashboard/show'
locals = {
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/controllers/error_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"
require "pact_broker/logging"
require "pact_broker/error"

Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/controllers/groups.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"
require "pact_broker/ui/view_models/index_items"
require "haml"

Expand Down
4 changes: 2 additions & 2 deletions lib/pact_broker/ui/controllers/index.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"
require "pact_broker/ui/view_models/index_items"
require "pact_broker/string_refinements"
require "haml"
Expand Down Expand Up @@ -33,7 +33,7 @@ class Index < Base
error_messages << "No pacticipants found matching: \"#{search}\""
end

view_index_items = ViewDomain::IndexItems.new(index_items, base_url: base_url)
view_index_items = PactBroker::UI::ViewModels::IndexItems.new(index_items, base_url: base_url)

page = tags ? :'index/show-with-tags' : :'index/show'
locals = {
Expand Down
6 changes: 3 additions & 3 deletions lib/pact_broker/ui/controllers/matrix.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"
require "pact_broker/ui/view_models/matrix_lines"
require "pact_broker/matrix/unresolved_selector"
require "pact_broker/matrix/parse_query"
Expand Down Expand Up @@ -32,7 +32,7 @@ class Matrix < Base
errors = matrix_service.validate_selectors(selectors, options)
if errors.empty?
lines = matrix_service.find(selectors, options)
locals[:lines] = PactBroker::UI::ViewDomain::MatrixLines.new(lines, base_url: base_url)
locals[:lines] = PactBroker::UI::ViewModels::MatrixLines.new(lines, base_url: base_url)
locals[:badge_url] = matrix_badge_url(selectors, lines, base_url)
else
locals[:errors] = errors
Expand All @@ -52,7 +52,7 @@ class Matrix < Base
]
options = { latestby: "cvpv", limit: 100 }
lines = matrix_service.find(selectors, options)
lines = PactBroker::UI::ViewDomain::MatrixLines.new(lines, base_url: base_url)
lines = PactBroker::UI::ViewModels::MatrixLines.new(lines, base_url: base_url)
locals = {
lines: lines,
consumer_name: params[:consumer_name],
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/controllers/pacts.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "pact_broker/ui/controllers/base_controller"
require "pact_broker/ui/controllers/base"

module PactBroker
module UI
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/index_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class IndexItem
extend Forwardable

Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/index_item_branch_head.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class IndexItemBranchHead

include PactBroker::Api::PactBrokerUrls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class IndexItemProviderBranchHead

include PactBroker::Api::PactBrokerUrls
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/index_items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class IndexItems

attr_reader :pagination_record_count
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/matrix_branch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class MatrixBranch

include PactBroker::Api::PactBrokerUrls
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/matrix_deployed_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class MatrixDeployedVersion
include PactBroker::Api::PactBrokerUrls

Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/matrix_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class MatrixLine
include PactBroker::Api::PactBrokerUrls
include PactBroker::Messages
Expand Down
4 changes: 2 additions & 2 deletions lib/pact_broker/ui/view_models/matrix_lines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class MatrixLines < Array

def initialize rows, options = {}
lines = rows.collect do | row |
PactBroker::UI::ViewDomain::MatrixLine.new(row, options)
PactBroker::UI::ViewModels::MatrixLine.new(row, options)
end
super(lines.sort)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/matrix_released_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class MatrixReleasedVersion
include PactBroker::Api::PactBrokerUrls

Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/ui/view_models/matrix_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
class MatrixTag
include PactBroker::Api::PactBrokerUrls

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module PactBroker
module Api
module Contracts
describe PactsForVerificationJSONQuerySchema do
describe PactsForVerificationJsonQuerySchema do
include PactBroker::Test::ApiContractSupport

ALL_PROPERTIES = {
Expand Down Expand Up @@ -51,7 +51,7 @@ module Contracts

it "is valid" do
params = { consumerVersionSelectors: [selector], providerVersionBranch: "main" }
expect(PactsForVerificationJSONQuerySchema.(params).errors).to be_empty
expect(PactsForVerificationJsonQuerySchema.(params).errors).to be_empty
end

extra_keys = ALL_PROPERTIES.keys - valid_key_combination - [:consumer]
Expand All @@ -63,11 +63,11 @@ module Contracts
describe "with #{selector_with_extra_key}" do
if expect_to_be_valid
it "is valid" do
expect(PactsForVerificationJSONQuerySchema.(params).errors).to be_empty
expect(PactsForVerificationJsonQuerySchema.(params).errors).to be_empty
end
else
it "is not valid" do
expect(PactsForVerificationJSONQuerySchema.(params).errors).to_not be_empty
expect(PactsForVerificationJsonQuerySchema.(params).errors).to_not be_empty
end
end
end
Expand All @@ -78,7 +78,7 @@ module Contracts
it "is valid" do
params = { consumerVersionSelectors: [selector_with_consumer], providerVersionBranch: "main" }

expect(PactsForVerificationJSONQuerySchema.(params).errors.empty?).to be true
expect(PactsForVerificationJsonQuerySchema.(params).errors.empty?).to be true
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module PactBroker
module Api
module Contracts
describe PactsForVerificationJSONQuerySchema do
describe PactsForVerificationJsonQuerySchema do
include PactBroker::Test::ApiContractSupport

let(:params) do
Expand All @@ -22,7 +22,7 @@ module Contracts
}]
end

subject { format_errors_the_old_way(PactsForVerificationJSONQuerySchema.(params)) }
subject { format_errors_the_old_way(PactsForVerificationJsonQuerySchema.(params)) }

context "when nothing is specified" do
let(:params) { {} }
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact_broker/ui/view_models/index_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
describe IndexItem do

let(:consumer) { instance_double("PactBroker::Domain::Pacticipant", name: "Consumer Name") }
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact_broker/ui/view_models/index_items_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
describe IndexItems do

let(:relationship_model_4) { double("PactBroker::Domain::IndexItem", consumer_name: "A", provider_name: "X", consumer_version_order: 1) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
describe MatrixDeployedVersion do
before do
allow(subject).to receive(:deployed_version_url).and_return("http://deployed_version")
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact_broker/ui/view_models/matrix_line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module PactBroker
module UI
module ViewDomain
module ViewModels
describe MatrixLine do
let(:line) { instance_spy(PactBroker::Matrix::MatrixRow) }

Expand Down