Skip to content

Commit

Permalink
added parsing of "architecture" field from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
heartsucker committed Mar 21, 2017
1 parent 6057354 commit 7c4e5d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

#### unreleased
- Added
- Parsing of `node_deb.architecture` field in `package.json`

#### 0.7.0 2017-03-15
- Fixed
- More minor `bash` errors.
Expand Down
21 changes: 18 additions & 3 deletions node-deb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ log_warn() {
}

# All the variables that are injected into templates
architecture=
package_name=
package_version=
executable_name=
Expand All @@ -77,7 +78,6 @@ no_rebuild=0

# Other variables
no_delete_temp=0
architecture='all'

usage() {
# Local var because of grep
Expand Down Expand Up @@ -131,7 +131,13 @@ while [ -n "$1" ]; do

# HELPDOC: Package options:
--arch)
# HELPDOC: Set the architecture of the Debian package (default 'all')
log_warn 'The --arch option is deprecated. Please use --architecture. This will be removed in a future released.'
zero_check "$value" "$param"
architecture="$value"
shift
;;
-a | --architecture)
# HELPDOC: Set the architecture of the Debian package (default: 'node_deb.architecture' from package.json then 'all')
zero_check "$value" "$param"
architecture="$value"
shift
Expand Down Expand Up @@ -319,7 +325,7 @@ while [ -n "$1" ]; do
'to ensure future compatibility.'
;;
--show-changelog)
# HELPDOC: Display the changelog then exit
# HELPDOC: Display the CHANGELOG then exit
show_file "$node_deb_dir/CHANGELOG.md"
exit 0
;;
Expand Down Expand Up @@ -417,6 +423,15 @@ if [ -z "$package_dependencies" ]; then
fi
log_debug "The package dependencies has been set to: $package_dependencies"

# Set the package architecture
if [ -z "$architecture" ]; then
architecture=$(jq -r '.node_deb.architecture' package.json)
if [[ "$architecture" == 'null' ]]; then
architecture="all"
fi
fi
: ${architecture:='all'}
log_debug "The package architecture has been set to: $architecture"

# Set executable name
if [ -z "$executable_name" ]; then
Expand Down

0 comments on commit 7c4e5d7

Please sign in to comment.