Releases: mbland/go-script-bash
go-script-bash v1.7.0
This is a minor update to add a few test helpers, _GO_PLATFORM
variables and the ./go goinfo
command, several file system processing modules, and a handful of project improvements.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
All of the issues and pull requests for this release are visible in the v1.7.0 milestone.
./go null
The ./go null
command verifies that the framework is installed and functioning properly (#190).
New test helpers
There are a few powerful new test helper functions:
create_forwarding_script
(#192, #195): Used to create a wrapper inBATS_TEST_BINDIR
to make a system program accessible while restrictingPATH
viaPATH="$BATS_TEST_BINDIR"
.restore_programs_in_path
(#196): Allows a single call to remove multiple command stub scripts.run_test_script
(#196): Creates and runs a test script in one step, so that create_bats_test_script and run need not be called separately.run_bats_test_suite
(#196): A specialized version ofrun_test_script
specifically for generating and running Bats test cases.run_bats_test_suite_in_isolation
(#196): An even more specialized version ofrun_bats_test_suite
to ensure thatPATH
is restricted toBATS_TEST_BINDIR
and the Batslibexec/
directory within the suite.lib/bats/background-process
(#197): Helpers for managing and validating background processes.skip_if_none_present_on_system
(#198): Skips a test if none of the specified system programs are available.
_GO_PLATFORM
vars and ./go goinfo
command
The lib/platform
module introduced in #200 provides an interface to detect on which system the script is running. Is parses /etc/os-release if it's available; otherwise uses OSTYPE
, uname -r
, and sw_vers -productVersion
(on macOS).
The ./go goinfo
command introduced in #216 uses the lib/platform
module to print version information about the go-script-bash framework, Bash, and the host operating system:
$ ./go goinfo
_GO_CORE_VERSION: v1.7.0
BASH_VERSION: 4.4.12(1)-release
OSTYPE: darwin16.3.0
_GO_PLATFORM_ID: macos
_GO_PLATFORM_VERSION_ID: 10.13
File system processing modules
Introduced in #201, @go.native_file_path_or_url
from lib/portability
converts a file system path or file://
URL to a platform-native path. This is necessitated by MSYS2, especially Git for Windows, which has system programs which expect Windows-native paths as input, or whose output will reflect Windows-native paths. It's used in several tests, as well as the ./go get
command.
The lib/path
module introduced in #203 and #206 includes functions to canonicalize file system paths, resolve symlinks, and walk directories.
lib/fileutil
from #204 and updated in #207 and #210 contains functions to safely create directories (with extensive error reporting), to collect all the regular files within a directory structure, to safely copy all files into a new directory structure, and to safely mirror directories using tar
.
lib/diff
from #205 contains functions to log or edit differences between files and directory trees.
lib/archive
from #211 contains the @go.create_gzipped_tarball
convenience function to easily and safely create .tar.gz
archive files.
Project improvements
The project now contains a GitHub issue and pull request templates, a GitHub CODEOWNERS
file, and an Appveyor build to ensure Windows compatibility. See:
- https://github.com/blog/2111-issue-and-pull-request-templates
- https://help.github.com/articles/helping-people-contribute-to-your-project/
- https://github.com/blog/2392-introducing-code-owners
- https://help.github.com/articles/about-codeowners/
- https://ci.appveyor.com/project/mbland/go-script-bash
Bug fixes
stub_program_in_path
(#194): Now ensures that new stubs are passed tohash
. Previously, if a command had already been invoked, Bash would remember its path, and ignore the new stub.
Changes since v1.6.0
You can see the details of every change by issuing one or more of the following commands after cloning: https://github.com/mbland/go-script-bash
$ ./go changes v1.6.0 v1.7.0 $ gitk v1.6.0..v1.7.0
go-script-bash v1.6.0
This is a minor update to add the capability to go-template
to download a release tarball from GitHub rather than using git clone
to add the go-script-bash framework to a project working directory.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
All of the issues and pull requests for this release are visible in the v1.6.0 milestone.
Download a go-script-bash release tarball from GitHub in go-template
Thanks to Juan Saavedra, go-template
now has the capability to download and unpack a release tarbal from GitHub in order to add the go-script-bash framework to a project's working directory, rather than relying on git clone
. Now git clone
will be used as a backup in case the system doesn't have the tools to download and unpack the tarball, or the operation fails for some reason.
Bug fixes
None in this release.
Changes since v1.5.0
You can see the details of every change by issuing one or more of the following commands after cloning: https://github.com/mbland/go-script-bash
$ ./go changes v1.5.0 v1.6.0 $ gitk v1.5.0..HEAD
go-script-bash v1.5.0
This is a minor update to add the lib/prompt
and lib/existence
modules that import functionality from the first draft of the mbland/certbot-webroot-setup project.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
All of the issues and pull requests for this release are visible in the v1.5.0 milestone.
lib/prompt
module
The new lib/prompt
module contains several new user input prompt functions. Also, @go.select_option
has been moved from go-core.bash
to the lib/prompt
module. The new ./go demo-core prompt
command demonstrates most of the new user prompt behavior.
lib/existence
module
The new lib/existence
module contains convenience functions for checking whether a file or command exists and is accessible on the system, and provides standard error reporting if not.
@go.trim
added to lib/strings
@go.trim
trims leading and trailing whitespace from strings, and supports the parsing of user input data in functions from the lib/prompt
module.
Bug fixes
Just one this time: ./go new --test
now outputs load environment
correctly for top-level tests within _GO_TEST_DIR
(#171, #172).
Changes since v1.4.0
You can see the details of every change by issuing one or more of the following commands after cloning: https://github.com/mbland/go-script-bash
$ ./go changes v1.4.0 v1.5.0 $ gitk v1.4.0..HEAD
go-script-bash v1.4.0
This release contains some major improvements, including an O(5.3-18x) Bats test performance improvement, the new lib/bats-main
and other testing library updates, the go-template
bootstrap script, _GO_STANDALONE
mode, improved _GO_USE_MODULES
semantics, the new get
and new
commands, npm-like plugin semantics, and more.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
All of the issues and pull requests for this release are visible in the v1.4.0 milestone.
Bats test suite performance improvement
Insight into how Bats captures stack trace information led to several rounds of performance optimizations to remove subshells and other child processes that resulted in a massive improvement. All the times below were measured on a MacBook Pro with a 2.9GHz Intel Core i5 CPU and 8GB 1867MHz DDR3 RAM.
The first round of improvements, to the go-script-bash framework itself, took the existing test suite running under Bash 3.2.57(1)-release from macOS 10.12 from O(7-8m) down to O(3m). As part of this process, the set "$BATS_ASSERTION_DISABLE_SHELL_OPTIONS"
and return_from_bats_assertion
mechanisms previously from lib/bats/assertions
have been generalized as set "$DISABLE_BATS_SHELL_OPTIONS
and restore_bats_shell_options
in the new lib/bats/helper-function
module.
After the first round of optimizations to the Bats framework itself, this time came down to O(1m25s). After the second round of Bats optimizations, the time came down to O(1m19s), for a total approximate speedup between 5.3x and 6x.
On Windows, the improvement is even more dramatic, given forking new processes on Windows is apparently over 50x more expensive than on UNIX. Running under VMWare Fusion (versions 8.5.3 to 8.5.5), the same go-script-bash test suite went from O(50m-60m) down to O(20+m) after the go-script-bash optimizations, down to O(3m40s-6m20s) after the first round of Bats optimizations, and down to O(3m21s-5m25s) after the second round of Bats optimizations, for a total approximate speedup between 9x and 18x. (Possibly more, but I don't want to spend the time getting the old numbers for an exact calculation!)
For more details, see the following artifacts:
- mbland/go-script-bash#79: Consider refactoring Bats to avoid pipelines, subshells #79
- mbland/go-script-bash#156: Extract
lib/bats/function
fromlib/bats/assertions
- The
lib/bats/helper-function
library - The
optimized-20170205
tag comment from mbland/bats - The
optimized-20170317
tag comment from mbland/bats - sstephenson/bats#210: Fix macOS/Bash 3.2 breakage; eliminate subshells from exec-test, preprocess
- mbland's comment on sstephenson/bats#150: Call for Maintainers
lib/bats-main
test script library
To make it easier to write ./go test
commands with the same interface as that of the core library's ./go test
command—including test coverage reports via kcov and Coveralls—the lib/bats-main
library has been extracted from the core library's ./go test
script. It contains many user-overrideable variables, but basic usage is straightforward. See the header comments from lib/bats-main and the implementation of [./go test
][] for details.
Also, Bats is no longer integrated into the repository as a submodule. Instead, @go.bats_main
calls @go.bats_clone
to create a shallow clone of a Bats repository, configured via the _GO_BATS_DIR
, _GO_BATS_URL
, and _GO_BATS_VERSION
variables. (@go.bats_clone
uses the new @go get
command, described below, to create the clone.) By default, these variables are configured to clone the optimized Bats from mbland/bats
.
Testing library enhancements
In addition to the test/Bats optimizations and the new lib/bats-main
library, other new test library features include:
- A completely new lib/testing/stubbing library that uses the new
_GO_INJECT_SCRIPT_PATH
and_GO_INJECT_MODULE_PATH
mechanism to stub core library scripts and modules, rather than the much riskier former implementation. (#118, #121) See the sections below on "Improved command script search and_GO_USE_MODULES
semantics" and "npm-like plugin semantics", as well as./go help commands
and./go modules -h
for further details. - The
@go.test_compgen
helper function from lib/testing/environment makes it easier to generate expected tab completion results, and fails loudly to prevent test setup errors. stub_program_in_path
from lib/bats/helpers now works for testing in-process functions (as opposed to running scripts), andrestore_program_in_path
has been added to help with cleanup and to guard against errors when stubbed program names are mistyped.- See the previous section on test suite optimization for information about the new lib/bats/helper-function library, which contains a mechanism for making Bats test helper functions run as quickly as possible and for pinpointing assertion failures. It works by temporarily disabling function tracing and
DEBUG
traps set by Bats to collect and display stack trace information.
go-template
bootstrap script
The new go-template
file provides the boilerplate for a standard project ./go
script. Basically, copying this script into your project and running it is all you need to do to get started using the go-script-bash framework right away, as it will take care of cloning the go-script-bash
framework into your project without the need to add it as a Git submodule. It contains several configuration variables, and any other project or application logic may be added to it as needed.
See the "How to use this framework" section of the README and the comments from go-template for details.
_GO_STANDALONE
mode
The _GO_STANDALONE
variable, when set, enables "Standalone" mode, whereby a ./go
script acts as an arbitrary application program rather than a project management script. In fact, a standalone application program can have its own project management ./go
script in the same repository.
See the "Standalone mode" section of the README for more
information.
Improved command script search and _GO_USE_MODULES
semantics
The command script search and . "$_GO_USE_MODULES"
library module importation mechanism now implement the following precedence rules:
_GO_INJECT_SEARCH_PATH
and_GO_INJECT_MODULE_PATH
for stubs injected during testing_GO_CORE_DIR/libexec
and_GO_CORE_DIR/lib
for core library command scripts
and modules_GO_SCRIPTS_DIR
and_GO_SCRIPTS_DIR/lib
for command scripts and project-internal modules_GO_ROOTDIR/lib
for publicly-exported modules (if the project is a go-script-bash plugin)_GO_SCRIPTS_DIR/plugins/*/{bin,lib}
for command scripts and library module...
go-script-bash v1.3.0
This is a massive feature update that greatly extends the capabilities of the log
module, improves existing test helpers and adds many new ones, adds several new modules available via _GO_USE_MODULES
, plus much more. (And it goes without saying there are tons of bug fixes and compatibility workarounds!)
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
All of the issues and pull requests for this release are visible in the v1.3.0 milestone. Many of the new features were inspired by the enthusiastic and thoughtful input from John Omernik, based on his experience integrating the framework into his JohnOmernik/zetago project.
lib/log
updates
lib/log
gained a number of powerful new features in this update:
- Timestamp prefixes are available by defining
_GO_LOG_TIMESTAMP_FORMAT
. - Each log level can now emit output to any arbitrary number of file descriptors by applying
@go.log_add_output_file
. _GO_LOG_LEVEL_FILTER
and_GO_LOG_CONSOLE_FILTER
help control the amount of information logged to files or to the console, respectively.- The new lowest-priority
DEBUG
log level isn't emitted by default; use one of the above filters or@go.log_add_output_file
to capture it. - The new
QUIT
log level exits the process likeFATAL
, but without a stack trace. @go.log_command
now captures all command output (even from subprocesses!) and emits it across all file descriptors configured for theRUN
log level.@go.critical_section_begin
now takes an argument to determine whether failing commands run under@go.log_command
will logQUIT
orFATAL
upon error; the default is set by_GO_CRITICAL_SECTION_DEFAULT
, which defaults toFATAL
- The new
demo-core log
builtin subcommand provides an interactive demonstration oflog
module features; see./go help demo-core log
. - Testing assertions and helper functions are publicly available in
lib/testing/log
andlib/testing/stack-trace
.
See ./go modules -h log
for more information.
New lib/file
module for file descriptor-based file I/O
The new lib/file
functions make it easy to open, write to, and close file descriptors in a safe and convenient fashion. While most of these functions support the new lib/log
features, they are general-purpose and available to import via . "$_GO_USE_MODULES" file
. See ./go modules -h file
for more information.
New lib/validation
file to validate caller-supplied data
The functions from lib/validation
help make sure that caller-supplied data and variable names are well-formed and won't execute arbitrary code. The *_or_die
variations will exit with a stack trace if an item violates validation constraints. Useful for examining identifiers before invoking eval
or builtins such as printf -v
that expect an identifier name as an argument. See ./go modules -h validation
for more information.
Expanded and improved lib/bats
module and the new lib/testing
module for testing
It's now easier than ever to compose new assertions from lib/bats/assertions
, thanks to the new set "$BATS_ASSERTION_DISABLE_SHELL_OPTIONS"
and return_from_bats_assertion
convention. New assertions are also easier to test thanks to the new lib/bats/assertion-test-helpers
utilities.
lib/bats/assertions
now contains:
- The
fail_if
assertion negator forlib/bats/assertions
assertions, which makes it easy to write negative conditions with robust output - The new
assert_lines_match
assertion set_bats_output_and_lines_from_file
, which is used to implement the newassert_file_equals
,assert_file_matches
, andassert_file_lines_match
assertions
Goodies now available in lib/bats/helpers
include:
fs_missing_permission_support
andskip_if_cannot_trigger_file_permission_failure
for skipping test cases on platforms that cannot trigger file permission-based conditionstest_join
for joining multiple expected output elements into a single variabletest_printf
and theTEST_DEBUG
variable for producing targeted test debugging outputtest_filter
and theTEST_FILTER
variable for pinpointing specific test cases within a suite and skipping the restsplit_bats_output_into_lines
to ensure blank lines fromoutput
are preserved inlines
; this facilitates usingassert_lines_equal
andassert_lines_match
with output containing blank linesstub_program_in_path
to easily write temporary test stubs for programs inPATH
Also, framework-specific test helpers have been exported to lib/testing
, to help with writing tests that depend on core framework output and behavior, including functions that help validate stack trace and @go.log
output.
All existing and new test helper functions have also been thoroughly tested on multiple platforms to ensure portability, ease-of-use, and a minimum of surprises.
lib/format
updates
The lib/format
module gained two new functions:
@go.array_printf
for transforming an entire array of items at once usingprintf -v
@go.strip_formatting_codes
for removing ASCII formatting codes from a string, used by@go.log
when writing to non-console file descriptors in the absence of_GO_LOG_FORMATTING
Also, @go.pad_items
and @go.zip_items
have updated interfaces that expect the caller to provide the name of the output variable, now that both are defined in terms of @go.array_printf
(which is in turn implemented using the new @go.split
, described below.) See ./go modules -h format
for more information.
New lib/strings
modules
The lib/strings
module provides @go.split
and @go.join
functions that implement behavior common to other programming language libraries. See ./go modules -h strings
for more information.
@go.split
in particular is highly recommend for widespread use to avoid an obscure Bash bug on Travis CI; see the function comments and git show 99ab78 2297b4
for details.
_GO_USE_MODULES
exported for subprocess use
Now any Bash process spawned by the ./go
script has access to the _GO_USE_MODULES
mechanism, most notably Bats test cases and assertions.
New demo-core
framework and lib/subcommands
module
The lib/subcommands
module exports the @go.show_subcommands
function, which may be used to implement commands that are only shells for a number of subcommands. See ./go modules -h subcommands
for more information.
The new demo-core
command demonstrates the use of @go.show_subcommands
, and provides a framework for writing small demonstration programs for module features. As a first step, the demo-core log
subcommand provides a demonstration of various log
module features. See ./go help demo-core
and ./go help demo-core log
for more information.
@go.printf
works independently of fold
@go.printf
no longer opens a pipe to the fold
program, and now folds lines itself. The performance difference was a very minor improvement or degradation across systems, and now output is folded regardless of the presence of fold
on the host system.
Uses [
instead of [[
in all Bats test cases
Turns out there's a gotcha when using [[
in Bats test cases under Bash versions lower than 4.1, such as the stock 3.2.57(1)-release that ships on macOS. See git show fefce2
for details.
Uses ASCII Unit Separator ($'\x1f'
) instead of NUL to export arrays
Previously, $'\0'
was used to export the _GO_CMD_NAME
and _GO_CMD_ARGV
arrays to commands written in other languages. However, it wasn't possible to successfully use NUL to implement the new @go.array_printf
in the lib/format
module, or to pass it as a delimiter to @go.split
from the new lib/strings
module, since Bash can join strings using IFS=$'\0'
, but not split them. (Setting IFS=$'\0'
is equivalent to setting it to the null string, which disables word splitting.) Consequently, the ASCII Unit Separator character seemed a fine substitute for that purpose, and it seemed wise to apply it to _GO_CMD_NAME
and _GO_CMD_ARGV
as well.
Changes since v1.2.1
You can see the details of every change by issuing one or more of the following commands after cloning: https://github.com/mbland/go-script-bash
$ ./go changes v1.2.1 v1.3.0 $ gitk v1.2.1..HEAD
go-script-bash v1.2.1
This release enhances the public stack trace feature and adds it to @go.log FATAL
output.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
Make @go.print_stack_trace
take a numerical skip_callers
argument
Previously @go.print_stack_trace
would only skip the immediate caller if the first argument was not null. Now it enforces that the number be a positive integer, in order to skip over the specified number of callers while printing the stack trace. This was done to support better @go.log FATAL
output, described below.
Normally an API change like this would warrant a major version bump, but since the impact should be minimal, it any potential for impact exists at all, it's included in this patch release.
Include stack trace output on @go.log FATAL
conditions
@go.log FATAL
now prints a stack trace before exiting the process, since such information is generally useful under FATAL
conditions. Every function in the log
module that calls @go.log FATAL
removes itself from the stack trace, so the top of the stack shows the location of the user code that triggered the condition, rather than the location of the log
module function.
Changes since v1.2.0
b2ad688 Mike Bland Merge pull request #28 from mbland/stack-trace 965782d Mike Bland log: Add stack trace to FATAL output a0f4413 Mike Bland stack-trace: Move, add helpers to environment.bash cd57da0 Mike Bland print-stack-trace: Add go-core stack test helper 8424338 Mike Bland print_stack_trace: Make skip_callers arg numerical
go-script-bash v1.2.0
This release adds a stack trace feature to the public API.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
Print stack traces
The @go.print_stack_trace
function is now part of the public API. Its original use case was to provide more helpful error messages from . "$_GO_USE_MODULES"
, but it's generally useful. See the function comments in go-core.bash
and ./go test --edit core/print-stack-trace
for more information.
Changes since v1.1.2
fb6f3ae Mike Bland Merge pull request #27 from mbland/stack-trace 30790c9 Mike Bland use: Show stack trace when an import fails 8563f4d Mike Bland core: Add @go.print_stack_trace to public API
go-script-bash v1.1.2
This is a bugfix release.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
modules: Improved error handling for . "$_GO_USE_MODULES"
Previously, the $_GO_USE_MODULES
script would report an Unknown module:
error in every error case, even if the module existed but failed for another reason (Issue #25). The module's standard error would also get redirected to /dev/null
, which made diagnosis even more difficult.
Now any modules that actually exist but return an error when imported will be identified as such, rather than being reported as unknown, and standard error isn't redirected at all (PR #26).
Changes since v1.1.1
22bace2 Mike Bland Merge pull request #26 from mbland/module-import 8833762 Mike Bland use: Improve module import error message 4bb94e2 Mike Bland use: Nest module file path tests 92bc468 Mike Bland use: Detect module path before sourcing 5ea7820 Mike Bland modules: Fix incorrect help text
go-script-bash v1.1.1
This is a bugfix release.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
log: Replace echo -e
with printf
On at least one macOS 10.12.1 installation, echo -e
under Bash 3.2.57(1)-release in Terminal.app wasn't converting \e
sequences to actual ANSI escape sequences. Using printf
instead resolves the issue.
Changes since v1.1.0
187715e Mike Bland Merge pull request #24 from mbland/printf-esc-seqs 4bc05c8 Mike Bland log: Replace `echo -e` with `printf`
go-script-bash v1.1.0
This release adds some major new features, two new builtin commands, and multiple bug fixes and internal improvements.
The ./go
script: a unified development environment interface
Source: https://github.com/mbland/go-script-bash
A ./go
script aims to abstract away many of the steps needed to develop (and sometimes deploy) a software project. It is a replacement for READMEs and other documents that may become out-of-date, and when maintained properly, should provide a cohesive and discoverable interface for common project tasks.
The ./go
script idea came from Pete Hodgson's blog posts In Praise of the ./go Script: Part I and Part II.
Note: The ./go
script concept is completely unrelated to the Go programming language, though the Go language's go
command encapsulates many common project functions in a similar fashion.
This software is made available as Open Source software under the ISC License. If you'd care to contribute to this project, be it code fixes, documentation updates, or new features, please read the CONTRIBUTING.md
file.
What's new in this release
Modules
You can import optional Bash library code from the core framework, third-party plugins, or your own project's scripts directory by sourcing the _GO_USE_MODULES
script. See the Modules section of the README or run ./go help modules
and ./go modules --help
for more information.
Logging
The core library log
module provides functions for standard logging facilities. For more information, see the Logging section from the README and run ./go modules --help log
.
Bats test assertions and helpers
The assertions and helpers from the test suite have been extracted into the lib/bats/assertions
and lib/bats/helpers
libraries. See the Bats test assertions and helpers section from the README and read the comments from each file for more information.
kcov-ubuntu
module for test coverage on Linux
The kcov-ubuntu
module provides the run_kcov
function that uses kcov to collect test coverage on Ubuntu Linux. See the kcov-ubuntu
module for test coverage on Linux section of the README and run ./go modules --help kcov-ubuntu
for more information.
Exported _GO_*
variables and the vars
builtin command
A number of global variables starting with the prefix _GO_*
are exported as environment variables and are available to command scripts in all languages. See the Command script API section from the README and run ./go help vars
for more information.
Changes since v1.0.0
9411a89 Mike Bland Merge pull request #23 from mbland/version e8ef35b Mike Bland core: Introduce _GO_CORE_VERSION 17a69d2 Mike Bland Add documentation improvements for v1.1.0 release ecd2d81 Mike Bland use: Unset correct variable 006c38b Mike Bland Merge pull request #22 from mbland/remove-stale-files e17c181 Mike Bland Remove old test `./go` scripts f9675e5 Mike Bland Merge pull request #21 from mbland/plugins 33c54b6 Mike Bland plugins: Revert changes from #20 ce20155 Mike Bland Merge pull request #20 from mbland/vars 6b376eb Mike Bland vars: Make test array quotifying more robust 241d2c7 Mike Bland Revamp `_GO_*` var exports, add `vars` builtin 7c1123b Mike Bland Move all _GO_* vars to core and document them 17beb1e Mike Bland Merge pull request #19 from mbland/assert-lines-equal 70d546f Mike Bland assertions: Add assert_lines_equal 32d47fc Mike Bland changes: Don't add `^` to end ref 580f08d Mike Bland core: Tweak COLUMNS test slightly 47b6e63 Mike Bland Merge pull request #18 from mbland/columns 5292839 Mike Bland core: Fix test for OS X on Travis without /dev/tty c7ee892 Mike Bland core: Reproduce and fix `tput cols` error from #17 664a51f Mike Bland Merge pull request #17 from mbland/columns 5bdbd2c Mike Bland core: Update how COLUMNS is set 5fc49a5 Mike Bland log: Skip setup-project test case on MSYS2 0e91281 Mike Bland Merge pull request #16 from mbland/log-setup ecb6b83 Mike Bland log: Fix @go.critical_section_end return bug b7f7699 Mike Bland log: Add @go.setup_project function ed05f2b Mike Bland Merge pull request #15 from mbland/log-command da20203 Mike Bland log: Add log_command tests for @go command cases db79ba1 Mike Bland log: Add @go.log_command, critical section flag 43fae60 Mike Bland Merge pull request #14 from mbland/add-or-update-log-level 949fb32 Mike Bland log: Implement @go.add_or_update_log_level dd712c6 Mike Bland Merge pull request #13 from mbland/log 0a7bc5e Mike Bland lib/log: Add logging module 31a1d30 Mike Bland complete: Fix typo in internal library comment 3cc22b0 Mike Bland Merge pull request #12 from mbland/assertions 0d94845 Mike Bland Revert previous two commits f4a0f85 Mike Bland assertions: Reset return trap when trap exits 7ca3d05 Mike Bland assertions: Introduce bats_assertion_return_trap 40d6218 Mike Bland assertions: Make public return_from_bats_assertion 87bb07c Mike Bland assertions: Reproduce and fix latent functrace bug 52bc541 Mike Bland Merge pull request #11 from mbland/complete 112e046 Mike Bland env/bash: Put single quotes around unset argument e7f02fe Mike Bland complete: Eliminate compgen from internal library 096f0f3 Mike Bland bats/assertions: Change double quotes to single d8e4231 Mike Bland complete: Replace most compgen calls with echo 4d61457 Mike Bland complete: Switch all tests to use ./go complete 54e8e9a Mike Bland Merge pull request #10 from mbland/tput-fix-test-docs e779deb Mike Bland test: Expand comments, refactor slightly b9792bf Mike Bland kcov-ubuntu: Update run_kcov function comment 4c66893 Mike Bland core: Undo tput error redirect 676dd18 Mike Bland Merge pull request #9 from mbland/bats-libs 69fb63b Mike Bland bats/assertions: Reorder functions, add docs d692bb9 Mike Bland bats/assertions: Add optional fail() reason, docs ac8ed3f Mike Bland tests: Extract public bats/assertions module 2707493 Mike Bland tests: Consolidate environment.bash c77932e Mike Bland kcov: Convert to public kcov-ubuntu module 1a47920 Mike Bland cmd-desc: Remove create_test_command_script calls 3deee25 Mike Bland run-cmd: Update _GO_* var tests to run subcommands 4168b58 Mike Bland Extract public bats/helpers module 87ce40a Mike Bland Merge pull request #8 from mbland/cmd-name-argv 202b17c Mike Bland core: Export _GO_CMD_{NAME,ARGV}, add Bash test d674191 Mike Bland Merge pull request #7 from mbland/cmd-desc 9bd1524 Mike Bland core: Default to 80 columns on all tput errors 47d9476 Mike Bland TEMP: Print value of $TERM to debug Travis issue 271c726 Mike Bland core: Check $TERM before setting columns with tput c1ba9c8 Mike Bland cmd_desc: Show full command names in descriptions c2098c4 Mike Bland Merge pull request #6 from mbland/core-updates 2777ca8 Mike Bland core: Export variables for non-Bash script access 1158bc7 Mike Bland core: Escape % when only one @go.printf argument 995daf0 Mike Bland script_helper: Default to bash, allow other langs 6444f51 Mike Bland Merge pull request #5 from mbland/modules-builtin 0a4886a Mike Bland README: ./go modules help => ./go modules --help 78c447a Mike Bland test, modules: Quote $_GO_USE_MODULES, add docs 9bb7a45 Mike Bland Add modules builtin command 766a354 Mike Bland command_descriptions: Trim trailing whitespace e764723 Mike Bland command_descriptions: Return error if read fails 7cd5dd5 Mike Bland kcov: Add note explaining 2>/dev/null redirection 80b7abe Mike Bland test: Use time builtin 4c8f931 Mike Bland complete: Add public module, completion removal 97fd0df Mike Bland test/script_helper: Add TEST_GO_PLUGINS_DIR 2d88f57 Mike Bland format: Add public module, pad and zip functions 8c23dcd Mike Bland Merge...