Skip to content
Merged
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## [Unreleased]
## [1.2.0]

### Added
- Added new configuration prompts for `SERVICE_NAME` during initial setup.

### Changed
- **BREAKING (for existing templates):** If you are re-running the generator to update an existing project, the new prompt variables will evaluate to blank. When Thor asks to overwrite your `config/tech-docs.yml`, press `n` to keep your existing configuration.

## 1.1.0

Expand Down
96 changes: 85 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (8.1.3)
activesupport (8.1.3.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
Expand All @@ -17,19 +17,20 @@ GEM
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
base64 (0.3.0)
bigdecimal (4.1.1)
bigdecimal (4.1.2)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.3.7)
concurrent-ruby (1.3.8)
connection_pool (3.0.2)
contracts (0.17.3)
diff-lcs (1.6.2)
dotenv (3.2.0)
drb (2.2.3)
erubi (1.13.1)
execjs (2.10.1)
execjs (2.10.2)
json (>= 2)
fast_blank (1.0.1)
fastimage (2.4.1)
ffi (1.17.4)
Expand Down Expand Up @@ -60,7 +61,7 @@ GEM
rake
webrick
jasmine-core (3.99.0)
json (2.19.9)
json (2.21.2)
kramdown (2.5.2)
rexml (>= 3.4.4)
listen (3.10.0)
Expand Down Expand Up @@ -102,20 +103,20 @@ GEM
toml
uglifier (>= 3, < 5)
webrick
minitest (6.0.4)
minitest (6.0.6)
drb (~> 2.0)
prism (~> 1.5)
padrino-helpers (0.16.1)
i18n (>= 0.6.7, < 2)
padrino-support (= 0.16.1)
tilt (>= 2.1, < 3)
padrino-support (0.16.1)
parallel (2.0.1)
parallel (2.1.0)
parslet (2.0.0)
phantomjs (2.1.1.0)
prism (1.9.0)
public_suffix (7.0.5)
rack (3.2.6)
rack (3.2.7)
rackup (2.3.1)
rack (>= 3)
rake (13.4.2)
Expand All @@ -140,9 +141,9 @@ GEM
ffi (~> 1.9)
securerandom (0.4.1)
servolux (0.13.0)
temple (0.10.4)
temple (0.10.7)
thor (1.5.0)
tilt (2.7.0)
tilt (2.9.0)
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
tzinfo (2.0.6)
Expand Down Expand Up @@ -171,5 +172,78 @@ DEPENDENCIES
rake
rspec

CHECKSUMS
activesupport (8.1.3.1) sha256=85458765f25ea48b9019c46b6bb3fa5683197bf4280d9f06710a6e8d7a831376
addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
coffee-script (2.4.1) sha256=82fe281e11b93c8117b98c5ea8063e71741870f1c4fbb27177d7d6333dd38765
coffee-script-source (1.12.2) sha256=e12b16fd8927fbbf8b87cb2e9a85a6cf457c6881cc7ff8b1af15b31f70da07a4
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
contracts (0.17.3) sha256=e72e626413ea47099becb7b5683beb1c2ea902c69f5bad55c9258fe2b48314d7
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
dotenv (3.2.0) sha256=e375b83121ea7ca4ce20f214740076129ab8514cd81378161f11c03853fe619d
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
execjs (2.10.2) sha256=466cf2b49e50c0cfdff8fdb88a7a983dfab7ac0f6185c317ccb434a75c224c88
fast_blank (1.0.1) sha256=269fc30414fed4e6403bc4a49081e1ea539f8b9226e59276ed1efaefabaa17ea
fastimage (2.4.1) sha256=c64bebd46b6fd8943ab70c1e6e85ff728f970f2e48f92ecd249b6bc3a540ad20
ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95
ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b
ffi (1.17.4-x86-linux-gnu) sha256=38e150df5f4ca555e25beca4090823ae09657bceded154e3c52f8631c1ed72cf
ffi (1.17.4-x86-linux-musl) sha256=fbeec0fc7c795bcf86f623bb18d31ea1820f7bd580e1703a3d3740d527437809
ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
haml (6.4.0) sha256=b2e20652be52ac9a3be328e8ff411ad007e82fc4e78e1a5cdefad537a697cf6a
hamster (3.0.0) sha256=5951e3a3ffd15ba854a976ac36ebae9469966f726034ffed0dccdb6d12d434d8
hashie (5.1.0) sha256=c266471896f323c446ea8207f8ffac985d2718df0a0ba98651a3057096ca3870
i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
jasmine (3.99.0) sha256=f76416a099adbad1055df013735f3e510d121a8ca530680f78fc8dd0463ef755
jasmine-core (3.99.0) sha256=a8290894b4fce6de47fa53f0abc578e6592da65e3de9069de0744d4300451178
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
kramdown (2.5.2) sha256=1ba542204c66b6f9111ff00dcc26075b95b220b07f2905d8261740c82f7f02fa
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
memoist (0.16.2) sha256=a52c53a3f25b5875151670b2f3fd44388633486dc0f09f9a7150ead1e3bf3c45
middleman (4.6.3) sha256=cf6293bf3d7917d495f466358c7d9707843c06347d5db2168e950b24c235704e
middleman-cli (4.6.3) sha256=03deb5b893f748a5adeaf22ccc1452dfede2de25a4583bb451a0162857eb9974
middleman-core (4.6.3) sha256=5cab1e1f16b00d26f541a4ca787427e1e0203c34f2d81471c1fae3bf1e7509a8
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
padrino-helpers (0.16.1) sha256=dd897c7974c34b8642942e503474365b13336574f837b38d6309a8b67e94940b
padrino-support (0.16.1) sha256=fe7fa6e781f978a94299b2e99bebc58ab71f64e9453c81ed21cd74fa15d550a8
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
parslet (2.0.0) sha256=d45130695d39b43d7e6a91f4d2ec66b388a8d822bae38de9b4de9a5fbde1f606
phantomjs (2.1.1.0) sha256=b392cfba33d374285d022c905c714948fc1a69d162cd17cfea39b684fd5a1779
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
rack (3.2.7) sha256=93e13e1c24f93556671d85d2d79fa228c3485815c50d7e2f265b5330c6528fb7
rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
sassc (2.4.0) sha256=4c60a2b0a3b36685c83b80d5789401c2f678c1652e3288315a1551d811d9f83e
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
servolux (0.13.0) sha256=1a33c45458f8061d8a989b19d3ad6e5cfad04881b3fe988508a90850a3961519
temple (0.10.7) sha256=369fe560adb6534674ce232899c2232df614bcb29c5359b05efedff7a57ed9c0
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
tilt (2.9.0) sha256=da5735d0280bba96e9a91041bb14aee435ccad5c17b0fa519249ae543d9aa3a5
toml (0.3.0) sha256=0a91d0f76a9036e84e44f95693b12f58d358c1df3ac8e3b5271f2056ecc6e4b9
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
uglifier (4.2.1) sha256=75d42b81b10bfd21e7a427fabb1d49ff5ea7bda3c4a5039ddb2a78d194c6f5aa
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131

BUNDLED WITH
2.6.9
4.0.19
60 changes: 33 additions & 27 deletions Thorfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,52 @@ module Middleman
directory 'template', '.', exclude_pattern: /\.DS_Store$/
end

def ask_about_paas
def ask_about_documentation_url
return unless @first_time

if option_set?('USE_PAAS')
@use_paas = parse_boolean('USE_PAAS')
if ENV['DOCUMENTATION_URL']
@documentation_url = ENV['DOCUMENTATION_URL']
else
@use_paas = yes?('Will you be deploying this on GOV.UK PaaS?')
say "What will the URL of your documentation be, for example https://example-docs.gov.uk?", :blue
say "You can change this later in config/tech-docs.yml.", :blue
@documentation_url = ask("Documentation URL:")
end
end

return unless @use_paas

@application_name = ENV['APPLICATION_NAME'] || ask(
<<-MESSAGE
What is the name of your application on PaaS?
If your application URL is larry-the-cat.cloudapps.digital, this will be "larry-the-cat".
MESSAGE
)
def ask_about_service_name
return unless @first_time
if ENV['SERVICE_NAME']
@service_name = ENV['SERVICE_NAME']
else
say "What is the name of the service or API your documentation is about, for example Data sharing service?", :yellow
say "You can change this later in config/tech-docs.yml.", :yellow
@service_name = ask("Service Name:")
end
end

def ask_about_canonical_host
def ask_about_service_url
return unless @first_time

@canonical_host = ENV['CANONICAL_HOST'] || ask(
<<-MESSAGE
What is the canonical hostname of your application?
e.g. docs.larry-the-cat.service.gov.uk
MESSAGE
)
if ENV['SERVICE_URL']
@service_url = ENV['SERVICE_URL']
else
say "What is the URL for the service your documentation is about, for example https://new-service.gov.uk?", :green
say "You can change this later in config/tech-docs.yml.", :green
@service_url = ask("Service URL:")
end
end

def configure_paas
# TODO:: once https://github.com/alphagov/tech-docs-gem/issues/516 is complete,
# also set gov.uk branding or generic header/font etc based on this
def ask_about_govuk_logo
return unless @first_time
return unless @use_paas

template 'optional/manifest.yml', 'manifest.yml'
copy_file 'optional/nginx.conf', 'source/nginx.conf'
gsub_file 'source/nginx.conf', '__CANONICAL_HOST__', @canonical_host
directory 'optional/script', 'script'
if option_set?('USE_GOVUK_LOGO')
@use_govuk_logo = parse_boolean('USE_GOVUK_LOGO')
else
@use_govuk_logo = yes?('Will you be using the GOV.UK logo?')
end
end


def configure_tech_docs
return unless @first_time

Expand Down
7 changes: 4 additions & 3 deletions create-test-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ set -xe
# The `middleman init` script can be configured with environment variables
# instead of the interactive prompt.
export FIRST_TIME=true
export USE_PAAS=true
export APPLICATION_NAME=larry-the-cat
export CANONICAL_HOST=larry-the-cat.cloudapps.digital
export USE_GOVUK_LOGO=true
export SERVICE_NAME=example service
export SERVICE_URL=example-service.cloudapps.digital
export DOCUMENTATION_URL=example.docs

bundle exec middleman init tmp/test-run -T file://$(pwd)
cd tmp/test-run
Expand Down
16 changes: 8 additions & 8 deletions optional/config/tech-docs.yml.tt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Host to use for canonical URL generation (without trailing slash)
host: <%= @canonical_host %>
host: <%= @documentation_url %>

# Header-related options
show_govuk_logo: true
service_name: Name of API
service_link: https://www.larry-the-cat.service.gov.uk
show_govuk_logo: <%= @use_govuk_logo %>
service_name: <%= @service_name %>
service_link: <%= @service_url %>
phase: Beta

# Links to show on right-hand-side of header
header_links:
About: https://www.larry-the-cat.service.gov.uk/about
Get Started: https://www.larry-the-cat.service.gov.uk/get-started
Documentation: /
Support: https://www.larry-the-cat.service.gov.uk/support
About: <%= @service_url %>/about
Get Started: <%= @service_url %>/get-started
Documentation: <%= @documentation_url %>
Support: <%= @service_url %>/support

# Enables search functionality. This indexes pages only and is not recommended for single-page sites.
enable_search: false
Expand Down
7 changes: 0 additions & 7 deletions optional/manifest.yml.tt

This file was deleted.

75 changes: 0 additions & 75 deletions optional/nginx.conf

This file was deleted.

Loading