|
1 |
| -GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) |
| 1 | +GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) |
| 2 | +USER=`whoami` |
| 3 | +STAGING_URL="https://docs-mongodborg-staging.corp.mongodb.com" |
2 | 4 | PRODUCTION_URL="https://docs.mongodb.com"
|
| 5 | +STAGING_BUCKET=docs-mongodb-org-prd-staging |
3 | 6 | PRODUCTION_BUCKET=docs-mongodb-org-prd
|
| 7 | + |
| 8 | +# "PROJECT" currently exists to support having multiple projects |
| 9 | +# within one bucket. For the manual it is empty. |
| 10 | +PROJECT= |
| 11 | +DOTCOM_STAGING_URL="https://mongodbcom-cdn.website.staging.corp.mongodb.com" |
| 12 | +DOTCOM_STAGING_BUCKET=docs-mongodb-org-dotcomstg |
4 | 13 | DOTCOM_PRODUCTION_URL="https://mongodb.com"
|
5 | 14 | DOTCOM_PRODUCTION_BUCKET=docs-mongodb-org-dotcomprd
|
6 |
| -DOTCOM_PREFIX=docs-qa |
| 15 | +DOTCOM_PREFIX=docs |
| 16 | +DOTCOM_STGPREFIX=docs |
| 17 | +SEARCH_INDEX_BUCKET=docs-search-indexes-test |
| 18 | + |
| 19 | + |
| 20 | +DRIVERS_PATH=source/driver-examples |
7 | 21 |
|
8 |
| -.PHONY: help html deploy deploy-search-index |
| 22 | +BLOCKS_FILE=./build/${GIT_BRANCH}/tests.blocks |
| 23 | +TEST_FILE=./build/${GIT_BRANCH}/tests.js |
| 24 | + |
| 25 | +# Parse our published-branches configuration file to get the name of |
| 26 | +# the current "stable" branch. This is weird and dumb, yes. |
| 27 | +STABLE_BRANCH=`grep 'manual' build/docs-tools/data/manual-published-branches.yaml | cut -d ':' -f 2 | grep -Eo '[0-9a-z.]+'` |
| 28 | + |
| 29 | +.PHONY: help lint html markdown stage deploy deploy-search-index examples redirects changelogs |
9 | 30 |
|
10 | 31 | help: ## Show this help message
|
11 | 32 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
12 | 33 | @echo
|
13 | 34 | @echo 'Variables'
|
14 | 35 | @printf " \033[36m%-18s\033[0m %s\n" 'ARGS' 'Arguments to pass to mut-publish'
|
15 | 36 |
|
16 |
| -html: ## Builds this branch's HTML under build/<branch>/html |
| 37 | +lint: ## Checks URLs in the built corpus underneath build/<branch>/html |
| 38 | + mut-lint --linters=links ./build/master/source/ ${ARGS} |
| 39 | + |
| 40 | +test: html ## Runs test framework over the corpus |
| 41 | + ./build/docs-tools/tools/rst-testing/create-blocks.py ./build/${GIT_BRANCH}/source ${BLOCKS_FILE} |
| 42 | + node ./build/docs-tools/tools/rst-testing/compile-blocks.js ${BLOCKS_FILE} > ${TEST_FILE} |
| 43 | + ./build/docs-tools/tools/rst-testing/rst_tester.py ${TEST_FILE} |
| 44 | + |
| 45 | +html: examples ## Builds this branch's HTML under build/<branch>/html |
17 | 46 | giza make html
|
| 47 | + # TEMP copy of video file. Remove once video infrastructure in place. |
| 48 | + if [ -f source/images/agg-pipeline.mp4 ]; then cp source/images/agg-pipeline.mp4 build/${GIT_BRANCH}/html/_images/; fi |
| 49 | + |
18 | 50 |
|
19 |
| -publish: ## Builds this branch's publishable HTML and other artifacts under build/public |
| 51 | +publish: examples ## Builds this branch's publishable HTML and other artifacts under build/public |
| 52 | + if [ ${GIT_BRANCH} = master ]; then rm -rf build/master build/public; fi |
20 | 53 | giza make publish
|
| 54 | + if [ ${GIT_BRANCH} = master ]; then mut-redirects config/redirects -o build/public/.htaccess; fi |
| 55 | + # TEMP copy of video file. Remove once video infrastructure in place. |
| 56 | + if [ -f source/images/agg-pipeline.mp4 ]; then cp source/images/agg-pipeline.mp4 build/public/${GIT_BRANCH}/_images/; cp source/images/agg-pipeline.mp4 build/${GIT_BRANCH}/html/_images/; cp source/images/agg-pipeline.mp4 build/${GIT_BRANCH}/dirhtml/_images/;fi |
| 57 | + |
| 58 | +# - Enter build/<branch>/html, and recurse over each regular file |
| 59 | +# <basename>/<filename>. |
| 60 | +# * Upload each to the S3 bucket under <project>/<username>/<basename>/<filename> |
| 61 | +stage: ## Host online for review |
| 62 | + mut-publish build/${GIT_BRANCH}/html ${STAGING_BUCKET} --prefix=${PREFIX} --stage ${ARGS} |
| 63 | + @echo "Hosted at ${STAGING_URL}/${USER}/${GIT_BRANCH}/index.html" |
| 64 | + |
| 65 | + |
| 66 | +# - Enter build/public/<branch>, as well as any symbolic links pointing |
| 67 | +# to it, and recurse over each file <basename>/<filename>. |
| 68 | +# * Upload each to the S3 bucket under <project>/<basename>/<filename>. |
| 69 | +# - Upload each *regular file* <filename> underneath build/public |
| 70 | +# underneath <project>/<filename>. |
| 71 | +# - Download the redirect rules from S3 that begin with one of the |
| 72 | +# --redirect-prefix regex rules. |
| 73 | +# - Parse the file build/public/.htaccess, and for each redirect rule: |
| 74 | +# * If rule does not exist in remote set, upload redirect. |
| 75 | +# - Remove previously-matched redirect rules in S3 that do not exist in |
| 76 | +# local redirect set. |
21 | 77 |
|
22 | 78 | # The recursive behavior would CHANGE if --all-subdirectories were
|
23 | 79 | # given: ALL contents of build/public/<branch> would be upload
|
24 | 80 | deploy: build/public ## Deploy to the production bucket
|
25 |
| - mut-publish build/public ${PRODUCTION_BUCKET} --prefix=${PROJECT} --deploy --redirect-prefix='v[0-9]\.[0-9]' --redirect-prefix='manual' --redirect-prefix='master' ${ARGS} |
26 |
| - |
27 |
| - @echo "Hosted at ${PRODUCTION_URL}/index.html" |
28 |
| - |
29 | 81 | mut-publish build/public ${DOTCOM_PRODUCTION_BUCKET} --prefix=${DOTCOM_PREFIX} --deploy --redirect-prefix='v[0-9]\.[0-9]' --redirect-prefix='manual' --redirect-prefix='master' ${ARGS}
|
30 |
| - |
31 | 82 | @echo "Hosted at ${DOTCOM_PRODUCTION_URL}/${DOTCOM_PREFIX}/index.html"
|
32 |
| - |
33 | 83 | $(MAKE) deploy-search-index
|
34 | 84 |
|
35 | 85 | deploy-search-index: ## Update the search index for this branch
|
36 | 86 | @echo "Building search index"
|
37 |
| - mut-index upload build/public/${GIT_BRANCH} -o manual-${GIT_BRANCH}.json -u ${PRODUCTION_URL}/${GIT_BRANCH} -s --exclude build/public/${GIT_BRANCH}/meta |
| 87 | + if [ ${STABLE_BRANCH} = ${GIT_BRANCH} ]; then \ |
| 88 | + mut-index upload build/public/${GIT_BRANCH} -o manual-current.json --aliases manual-${GIT_BRANCH} -u ${PRODUCTION_URL}/manual -b ${SEARCH_INDEX_BUCKET} -p search-indexes/prd -g -s; \ |
| 89 | + else \ |
| 90 | + mut-index upload build/public/${GIT_BRANCH} -o manual-${GIT_BRANCH}.json -u ${PRODUCTION_URL}/${GIT_BRANCH} -b ${SEARCH_INDEX_BUCKET} -p search-indexes/prd -s; \ |
| 91 | + fi |
| 92 | + |
| 93 | +redirects: |
| 94 | + if [ ${GIT_BRANCH} = master ]; then mut-redirects config/redirects -o build/public/.htaccess; fi |
| 95 | + |
| 96 | +examples: |
| 97 | + mkdir -p ${DRIVERS_PATH} |
| 98 | +# python |
| 99 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-python-driver/master/test/test_examples.py -o ${DRIVERS_PATH}/test_examples.py |
| 100 | +# motor |
| 101 | + curl -SfL https://raw.githubusercontent.com/mongodb/motor/master/test/asyncio_tests/test_examples.py -o ${DRIVERS_PATH}/test_examples_motor.py |
| 102 | +# perl |
| 103 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-perl-driver/master/t/examples/driver-examples.t -o ${DRIVERS_PATH}/driver-examples.t |
| 104 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-perl-driver/master/t/examples/transaction.t -o ${DRIVERS_PATH}/perl-transactions-examples.t |
| 105 | +# php |
| 106 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-php-library/master/tests/DocumentationExamplesTest.php -o ${DRIVERS_PATH}/DocumentationExamplesTest.php |
| 107 | +# java crud |
| 108 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-java-driver/master/driver-sync/src/examples/documentation/DocumentationSamples.java -o ${DRIVERS_PATH}/DocumentationSamples.java |
| 109 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-java-driver-reactivestreams/master/examples/documentation/src/DocumentationSamples.java -o ${DRIVERS_PATH}/AsyncDocumentationSamples.java |
| 110 | +# java causal |
| 111 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-java-driver/master/driver-sync/src/examples/documentation/CausalConsistencyExamples.java -o ${DRIVERS_PATH}/CausalConsistencyExamples.java |
| 112 | + |
| 113 | +# node |
| 114 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/change_streams.test.js -o ${DRIVERS_PATH}/node_changestreams.js |
| 115 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/array_filters.test.js -o ${DRIVERS_PATH}/node_array_filters.js |
| 116 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/causal_consistency.test.js -o ${DRIVERS_PATH}/node_causal_consistency.js |
| 117 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/insert.test.js -o ${DRIVERS_PATH}/node_insert.js |
| 118 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/project_fields_from_query_results.test.js -o ${DRIVERS_PATH}/node_project.js |
| 119 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/query.test.js -o ${DRIVERS_PATH}/node_query.js |
| 120 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/query_embedded_documents.test.js -o ${DRIVERS_PATH}/node_query_embedded_documents.js |
| 121 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/query_arrays.test.js -o ${DRIVERS_PATH}/node_query_arrays.js |
| 122 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/query_array_of_documents.test.js -o ${DRIVERS_PATH}/node_query_array_of_documents.js |
| 123 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/query_for_null_fields.test.js -o ${DRIVERS_PATH}/node_query_for_null_fields.js |
| 124 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/remove_documents.test.js -o ${DRIVERS_PATH}/node_remove.js |
| 125 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/transactions.test.js -o ${DRIVERS_PATH}/node_transactions.js |
| 126 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/main/test/integration/node-specific/examples/update_documents.test.js -o ${DRIVERS_PATH}/node_update.js |
| 127 | + curl -SfL https://raw.githubusercontent.com/mongodb/node-mongodb-native/4.0/test/functional/examples/versioned_api.js -o ${DRIVERS_PATH}/node_versioned_api.js |
| 128 | + |
| 129 | +# ruby |
| 130 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-ruby-driver/master/spec/integration/shell_examples_spec.rb -o ${DRIVERS_PATH}/shell_examples_spec.rb |
| 131 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-ruby-driver/master/spec/integration/change_stream_examples_spec.rb -o ${DRIVERS_PATH}/change_stream_examples_spec.rb |
| 132 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-ruby-driver/master/spec/integration/transactions_examples_spec.rb -o ${DRIVERS_PATH}/transactions_examples_spec.rb |
| 133 | + |
| 134 | +# scala |
| 135 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-java-driver/master/driver-scala/src/integration/scala/org/mongodb/scala/documentation/DocumentationExampleSpec.scala -o ${DRIVERS_PATH}/DocumentationExampleSpec.scala |
| 136 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-java-driver/master/driver-scala/src/integration/scala/org/mongodb/scala/documentation/DocumentationTransactionsExampleSpec.scala -o ${DRIVERS_PATH}/DocumentationTransactionsExampleSpec.scala |
| 137 | + |
| 138 | +# csharp |
| 139 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/DocumentationExamples.cs -o ${DRIVERS_PATH}/DocumentationExamples.cs |
| 140 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/ChangeStreamExamples.cs -o ${DRIVERS_PATH}/ChangeStreamExamples.cs |
| 141 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/TransactionExamplesForDocs/RetryExample1.cs -o ${DRIVERS_PATH}/TransactionsRetryExample1.cs |
| 142 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/TransactionExamplesForDocs/RetryExample2.cs -o ${DRIVERS_PATH}/TransactionsRetryExample2.cs |
| 143 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/TransactionExamplesForDocs/RetryExample3.cs -o ${DRIVERS_PATH}/TransactionsRetryExample3.cs |
| 144 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/CausalConsistencyExamples.cs -o ${DRIVERS_PATH}/CausalConsistencyExamples.cs |
| 145 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-csharp-driver/master/tests/MongoDB.Driver.Examples/TransactionExamplesForDocs/WithTransactionExample1.cs -o ${DRIVERS_PATH}/withTxnExample1.cs |
| 146 | + |
| 147 | +# c |
| 148 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-c-driver/master/src/libmongoc/tests/test-mongoc-sample-commands.c -o ${DRIVERS_PATH}/test-mongoc-sample-commands.c |
| 149 | + |
| 150 | +# c++ |
| 151 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-cxx-driver/master/src/mongocxx/test/transactions.cpp -o ${DRIVERS_PATH}/cpp-transactions.cpp |
| 152 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-cxx-driver/master/examples/mongocxx/with_transaction.cpp -o ${DRIVERS_PATH}/cpp-with-transaction.cpp |
| 153 | + |
| 154 | +# go |
| 155 | + curl -SfL https://raw.githubusercontent.com/mongodb/mongo-go-driver/master/examples/documentation_examples/examples.go -o ${DRIVERS_PATH}/go_examples.go |
| 156 | + |
| 157 | +changelogs: |
| 158 | + python changelogs/generatechangelogs.py |
0 commit comments