Skip to content

Commit

Permalink
Rename to Places Manager
Browse files Browse the repository at this point in the history
- in this commit, only changes that do not affect
  external services (assume URL is the same,
  assume repo is the same, etc.)
- only URL to be updated is the one in the docs.
  • Loading branch information
KludgeKML committed Apr 17, 2024
1 parent ff083d4 commit d93adc9
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 48 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,6 +1,6 @@
# Imminence
# Places Manager (formerly Imminence)

Imminence manages sets of (somewhat) structured data for use elsewhere on GOV.UK. It's primarily used for geographical data such as lists of registry offices, test centres, and the like.
Places Manager manages sets of structured data for use elsewhere on GOV.UK. It's primarily used for geographical data such as lists of registry offices, test centres, and the like.

The data is structured as a set of Services which represent a distinct type of location. A Service can then have many Data Sets which are in turn collections of Places. Only one Data Set will be "active" at any given time.

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/data_sets_controller.rb
@@ -1,5 +1,5 @@
require "csv"
require "imminence/file_verifier"
require "places_manager/file_verifier"

class Admin::DataSetsController < InheritedResources::Base
include Admin::Defaults
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/services_controller.rb
@@ -1,4 +1,4 @@
require "imminence/file_verifier"
require "places_manager/file_verifier"
require "csv"

class Admin::ServicesController < InheritedResources::Base
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/admin/file_upload.rb
Expand Up @@ -25,7 +25,7 @@ def prohibit_non_csv_uploads
raise MissingFileError unless params[param_key][:data_file]

file = get_file_from_param(params[param_key][:data_file])
fv = Imminence::FileVerifier.new(file)
fv = PlacesManager::FileVerifier.new(file)
unless fv.csv?
message = "Rejecting file with content type: #{fv.mime_type}"
Rails.logger.info(message)
Expand Down
2 changes: 1 addition & 1 deletion app/services/govuk_site_lookup_service.rb
Expand Up @@ -12,7 +12,7 @@ def page_title(slug)
end

def public_url_info
Rails.cache.fetch("imminence_public_url_info", expires_in: 5.minutes) do
Rails.cache.fetch("places_manager_public_url_info", expires_in: 5.minutes) do
content_store_api = GdsApi.content_store
place_pages = GdsApi.search.search({ filter_format: "place", count: 200, fields: "title,link" })

Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Expand Up @@ -8,11 +8,11 @@
<%= render "govuk_publishing_components/components/layout_for_admin", {
environment:,
product_name: "Imminence",
product_name: t("product_name"),
browser_title: (yield :page_title),
} do %>
<%= render "govuk_publishing_components/components/layout_header", {
product_name: "Imminence",
product_name: t("product_name"),
environment:,
navigation_items: [
{
Expand Down
2 changes: 1 addition & 1 deletion config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
run Imminence::Application
run PlacesManager::Application
2 changes: 1 addition & 1 deletion config/application.rb
Expand Up @@ -13,7 +13,7 @@
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Imminence
module PlacesManager
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Expand Up @@ -52,7 +52,7 @@

# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "imminence_production"
# config.active_job.queue_name_prefix = "places_manager_production"

config.action_mailer.perform_caching = false

Expand Down
2 changes: 1 addition & 1 deletion config/initializers/session_store.rb
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.

Rails.application.config.session_store :cookie_store,
key: "_imminence_session",
key: "_places_manager_session",
secure: Rails.env.production?,
http_only: true
4 changes: 2 additions & 2 deletions config/initializers/statsd.rb
@@ -1,8 +1,8 @@
require "imminence/stats_collector"
require "places_manager/stats_collector"

ActiveSupport::Notifications.subscribe(/process_action.action_controller/) do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
Imminence::StatsCollector.timing(
PlacesManager::StatsCollector.timing(
event.duration, event.payload[:controller].underscore, event.payload[:action]
)
end
1 change: 1 addition & 0 deletions config/locales/en.yml
Expand Up @@ -30,6 +30,7 @@
# available at https://guides.rubyonrails.org/i18n.html.

en:
product_name: Places Manager
presenters:
data_set:
status:
Expand Down
10 changes: 5 additions & 5 deletions docs/adding-a-new-service.md
@@ -1,20 +1,20 @@
# Adding a new service

Adding a new service in Imminence is fairly straightforward and comprises of
Adding a new service in Places Manager is fairly straightforward and comprises of
two main parts:

1) The **service** which is [created in Imminence]. We need to provide the slug
1) The **service** which is [created in Places Manager]. We need to provide the slug
(this isn't the slug for the live www.gov.uk URL, rather the endpoint the
service landing page will use internally to fetch the relevant locations), name
and a CSV containing all the locations that provide the new service. Guidance
around the CSV data can be found on the service creation page.

2) The **service landing page** (Artefact) which is [created in Publisher]. The
Publisher format type for a new service is 'Place'. To link the Artefact
created in Publisher to the service in Imminence, the field "This is the 'slug'
assigned in the imminence app" needs to be populated with the internal slug
created in Publisher to the service in Places Manager, the field "This is the 'slug'
assigned in the places manager app" needs to be populated with the internal slug
created in step 1. Once the Artefact is published, the service should be up and
running.

[created in Imminence]: https://imminence.integration.publishing.service.gov.uk/admin/services/new
[created in Places Manager]: https://places-manager.integration.publishing.service.gov.uk/admin/services/new
[created in Publisher]: https://publisher.integration.publishing.service.gov.uk/artefacts/new
18 changes: 0 additions & 18 deletions lib/imminence/stats_collector.rb

This file was deleted.

@@ -1,4 +1,4 @@
module Imminence
module PlacesManager
class FileVerifier
attr_accessor :filename

Expand Down
20 changes: 20 additions & 0 deletions lib/places_manager/stats_collector.rb
@@ -0,0 +1,20 @@
module PlacesManager
class StatsCollector
def self.statsd
@statsd ||= Statsd.new("localhost").tap do |c|
c.namespace = ENV["GOVUK_STATSD_PREFIX"].to_s
end
end

def self.prefix_controller(name)
return name.gsub("admin/", "admin.") if name.start_with?("admin/")

"api.#{name}"
end

def self.timing(time, controller, action)
prefixed_controller = prefix_controller(controller)
statsd.timing("response_time.#{prefixed_controller}.#{action}", time)
end
end
end
10 changes: 5 additions & 5 deletions test/unit/file_verifier_test.rb
@@ -1,24 +1,24 @@
require "test_helper"
require "imminence/file_verifier"
require "places_manager/file_verifier"

class FileVerifierTest < ActiveSupport::TestCase
test "it can be handed a file object" do
f = File.open(Rails.root.join("features/support/data/register-offices.csv"))
assert_equal true, Imminence::FileVerifier.new(f).csv?
assert_equal true, PlacesManager::FileVerifier.new(f).csv?
end

test "it can be handed a path" do
f = Rails.root.join("features/support/data/register-offices.csv")
assert_equal true, Imminence::FileVerifier.new(f).csv?
assert_equal true, PlacesManager::FileVerifier.new(f).csv?
end

test "it can provide just the main type of a file" do
f = Rails.root.join("features/support/data/rails.csv")
assert_equal "image", Imminence::FileVerifier.new(f).type
assert_equal "image", PlacesManager::FileVerifier.new(f).type
end

test "it can provide just the sub-type of a file" do
f = Rails.root.join("features/support/data/rails.csv")
assert_equal "png", Imminence::FileVerifier.new(f).sub_type
assert_equal "png", PlacesManager::FileVerifier.new(f).sub_type
end
end
10 changes: 5 additions & 5 deletions test/unit/stats_collector_test.rb
@@ -1,21 +1,21 @@
require "test_helper"
require "imminence/stats_collector"
require "places_manager/stats_collector"

class StatsCollectorTest < ActiveSupport::TestCase
test "prefixes admin requests with .admin" do
result = Imminence::StatsCollector.prefix_controller("admin/foo")
result = PlacesManager::StatsCollector.prefix_controller("admin/foo")
assert_equal "admin.foo", result
end

test "prefixes non admin requests with .api" do
result = Imminence::StatsCollector.prefix_controller("foo")
result = PlacesManager::StatsCollector.prefix_controller("foo")
assert_equal "api.foo", result
end

test "sends the correct message to statsd" do
statsd = stub
statsd.expects(:timing).with("response_time.api.foo.show", 3)
Imminence::StatsCollector.stubs(:statsd).returns(statsd)
Imminence::StatsCollector.timing(3, "foo", "show")
PlacesManager::StatsCollector.stubs(:statsd).returns(statsd)
PlacesManager::StatsCollector.timing(3, "foo", "show")
end
end

0 comments on commit d93adc9

Please sign in to comment.