Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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
Showing
18 changed files
with
51 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
lib/imminence/file_verifier.rb → lib/places_manager/file_verifier.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Imminence | ||
module PlacesManager | ||
class FileVerifier | ||
attr_accessor :filename | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |