Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
e13779d0
Unverified
Commit
e13779d0
authored
Dec 18, 2018
by
Jeremy Morrell
Committed by
GitHub
Dec 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new module for storing build metadata (#593)
Add new module for storing build metadata
parent
9911a265
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
build-data.sh
lib/build-data.sh
+22
-0
unit
test/unit
+21
-0
No files found.
lib/build-data.sh
0 → 100644
View file @
e13779d0
# variable shared by this whole module
BUILD_DATA_FILE
=
""
bd_create
()
{
local
cache_dir
=
"
$1
"
BUILD_DATA_FILE
=
"
$cache_dir
/build-data/node"
kv_create
$BUILD_DATA_FILE
}
bd_get
()
{
kv_get
$BUILD_DATA_FILE
"
$1
"
}
bd_set
()
{
kv_set
$BUILD_DATA_FILE
"
$1
"
"
$2
"
}
log_build_data
()
{
# print all values on one line in logfmt format
# https://brandur.org/logfmt
echo
$(
kv_list
$BUILD_DATA_FILE
)
}
test/unit
View file @
e13779d0
...
...
@@ -148,6 +148,26 @@ testKeyValueNoFile() {
assertEquals
"
$(
kv_list
$space
)
"
""
}
testBuildData
()
{
local
cache_dir
=
$(
mktemp
-d
)
bd_create
$cache_dir
bd_set
"test"
"foo"
assertEquals
"test=foo"
"
$(
log_build_data
)
"
bd_set
"test"
"different-foo"
assertEquals
"test=different-foo"
"
$(
log_build_data
)
"
bd_set
"foo"
"value with spaces"
assertEquals
"foo=
\"
value with spaces
\"
test=different-foo"
"
$(
log_build_data
)
"
# values are printed with the keys sorted alphabetically
# this isn't required, and this test serves as documentation
bd_set
"a"
"this should come first"
assertEquals
"a=
\"
this should come first
\"
foo=
\"
value with spaces
\"
test=different-foo"
"
$(
log_build_data
)
"
}
# mocks
source
"
$(
pwd
)
"
/test/mocks/stdlib.sh
...
...
@@ -155,6 +175,7 @@ source "$(pwd)"/test/mocks/stdlib.sh
source
"
$(
pwd
)
"
/lib/monitor.sh
source
"
$(
pwd
)
"
/lib/output.sh
source
"
$(
pwd
)
"
/lib/kvstore.sh
source
"
$(
pwd
)
"
/lib/build-data.sh
# import the testing framework
source
"
$(
pwd
)
"
/test/shunit2
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment