Changeset - 1f5e8e9e79db
[Not reviewed]
0 1 0
Branko Majic (branko) - 20 months ago 2022-08-21 15:58:51
branko@majic.rs
[factorio_development.sh] Include development script in mod directory during initialisation:

- Makes it simpler for people to use the scription without having to
fetch it from external location.
1 file changed with 12 insertions and 2 deletions:
0 comments (0 inline, 0 general)
games/factorio_development.sh
Show inline comments
 
@@ -22,7 +22,7 @@
 
set -u
 

	
 
PROGRAM="factorio_development.sh"
 
VERSION="0.0.4"
 
VERSION="0.0.5"
 

	
 
function usage() {
 
    cat <<EOF
 
@@ -89,6 +89,7 @@ init MOD_DIRECTORY_PATH
 
  The following files are created as part of the process ([src/]
 
  indicates optional placement under separate source directory):
 

	
 
    - build.sh, factorio_development.sh script itself.
 
    - README.md, provides detailed mod description and information.
 
    - LICENSE, contains license information for the mod.
 
    - .gitignore, for ignoring files and paths when working with git.
 
@@ -473,11 +474,15 @@ function get_mod_name() {
 
#   $1 (base_dir)
 
#     Base directory under which the structure should be created.
 
#
 
#   $2 (development_script)
 
#     Path to build/development script to include in the repository.
 
#
 
# Returns:
 
#   0 on success, 1 otherwise.
 
#
 
function command_init() {
 
    local base_dir="$1"
 
    local development_script="$2"
 

	
 
    local mod_name separate_source source_dir
 

	
 
@@ -517,6 +522,9 @@ function command_init() {
 
    [[ ${separate_source,,} == y ]] && source_dir="$base_dir/src" || source_dir="$base_dir"
 
    mkdir -p "$source_dir"
 

	
 
    # Include the development script itself into the repository (for ease of use).
 
    cp "$development_script" "$base_dir/build.sh"
 

	
 
    # Create initial set of files.
 
    cat <<EOF > "$base_dir/README.md"
 
MOD_TITLE
 
@@ -1053,12 +1061,14 @@ if [[ $COMMAND == init ]]; then
 
    MOD_DIRECTORY_PATH="${1-}"
 
    shift
 

	
 
    DEVELOPMENT_SCRIPT_PATH=$(readlink -f "$0")
 

	
 
    if [[ -z $MOD_DIRECTORY_PATH ]]; then
 
        error "Mod directory path must be specified."
 
        exit "$ERROR_ARGUMENTS"
 
    fi
 

	
 
    if ! command_init "$MOD_DIRECTORY_PATH"; then
 
    if ! command_init "$MOD_DIRECTORY_PATH" "$DEVELOPMENT_SCRIPT_PATH"; then
 
        exit "$ERROR_GENERAL"
 
    fi
 

	
0 comments (0 inline, 0 general)