contributions.md: Updated sensortemplate script

C/C++ CMakeLists.txt lines are no longer needed - removed.
Converted bash script to a function to add some error checking.
Removed redundant author/copyright entry.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck 2017-04-03 15:03:53 -07:00
parent 048f1ac08e
commit 52879b0b04
7 changed files with 35 additions and 38 deletions

View File

@ -105,27 +105,42 @@ commands below to generate collateral files for your new sensor library.
```shell ```shell
# Set SensorName to your new library name, example: 'MyNewSensor1234' #!/bin/bash
export SensorName=MyNewSensor1234
# Copy/paste the below commands into a bash shell... function make_new_sensor {
# Get a lowercase version of the string SensorName=$1
export sensorname=${SensorName,,} # Make sure this is run from the root UPM directory
# Copy sensortemplate files to ${sensorname} if ! grep -q 'UPM ' README.md; then echo "Please run from the root UPM directory"; return -1; fi
find docs/ examples/ src/ -name '*sensortemplate*' -exec bash -c 'cp -r $0 ${0/sensortemplate/${sensorname}}' {} \;
# Copy SensorTemplate files to ${SensorName} # Copy/paste the below commands into a bash shell...
find examples/ src/ -name '*SensorTemplate*' -exec bash -c 'cp -r $0 ${0/SensorTemplate/${SensorName}}' {} \; # Get a lowercase version of the string
# Rename sernsortemplate src files sensorname=${SensorName,,}
rename "s/sensortemplate/${sensorname}/" src/${sensorname}/* # Copy sensortemplate files to ${sensorname}
# Search/replace the new files, replacing all instances of sensortemplate find docs/ examples/ src/ -name '*sensortemplate*' -exec bash -c 'cp -r $0 ${0/sensortemplate/${sensorname}}' {} \;
perl -p -i -e "s/SensorTemplate/${SensorName}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}* # Copy SensorTemplate files to ${SensorName}
perl -p -i -e "s/sensortemplate/${sensorname}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}* find examples/ src/ -name '*SensorTemplate*' -exec bash -c 'cp -r $0 ${0/SensorTemplate/${SensorName}}' {} \;
# Add mynewmodule example target for c++ # Rename sernsortemplate src files
perl -p -i -e "s/^((.*)sensortemplate(.*))/\1\n\2${sensorname}\3/g" examples/c++/CMakeLists.txt rename "s/sensortemplate/${sensorname}/" src/${sensorname}/*
# Add mynewmodule example target for java # Search/replace the new files, replacing all instances of sensortemplate
perl -p -i -e "s/^((.*)SensorTemplateSample sensortemplate(.*))/\1\n\2${SensorName}Sample ${sensorname}\3/g" examples/java/CMakeLists.txt perl -p -i -e "s/SensorTemplate/${SensorName}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
# Add mynewmodule example mappings for doxygen perl -p -i -e "s/sensortemplate/${sensorname}/g" src/${sensorname}/* examples/*/*${sensorname}* examples/*/*${SensorName}*
perl -p -i -e "s/^(.*SensorTemplateSample.*)$/\1\n${sensorname}.cxx\t${SensorName}Sample.java\t${sensorname}.js\t${sensorname}.py/g" doxy/samples.mapping.txt # Add mynewmodule example target for java
perl -p -i -e "s/^((.*)SensorTemplateSample sensortemplate(.*))/\1\n\2${SensorName}Sample ${sensorname}\3/g" examples/java/CMakeLists.txt
# Add mynewmodule example mappings for doxygen
perl -p -i -e "s/^(.*SensorTemplateSample.*)$/\1\n${sensorname}.cxx\t${SensorName}Sample.java\t${sensorname}.js\t${sensorname}.py/g" doxy/samples.mapping.txt
# Display TODO's
printf "Generation complete for sensor library: ${SensorName}\n"
printf "TODO's:\n"
printf "\t1. Update src/hdr files: src/${sensorname}/${sensorname}.hpp src/${sensorname}/${sensorname}.cxx\n"
printf "\t\tChange the Author\n"
printf "\t\tChange the Copyright\n"
printf "\t\tUpdate all doxygen tags (follow directions for @tags)\n"
printf "\t2. Update examples: examples/*/${sensorname}.* examples/java/*${SensorName}*.java\n"
printf "\t3. Overwrite docs/images/${sensorname}.png with a valid image of your sensor\n"
}
# Call make_new_sensor with your new sensor name, example: 'MyNewSensor1234'
make_new_sensor MyNewSensor1234
``` ```
Once all files have been created, they can be used as a starting-point for your Once all files have been created, they can be used as a starting-point for your

View File

@ -4,9 +4,6 @@
* Author: Your Full Name <your@email.address> * Author: Your Full Name <your@email.address>
* Copyright (c) <year> <copyright holder> * Copyright (c) <year> <copyright holder>
* *
* Author: <contributing author full name - if applicable>
* Copyright (c) <year> <copyright holder>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to

View File

@ -4,9 +4,6 @@
* Author: Your Full Name <your@email.address> * Author: Your Full Name <your@email.address>
* Copyright (c) <year> <copyright holder> * Copyright (c) <year> <copyright holder>
* *
* Author: <contributing author full name - if applicable>
* Copyright (c) <year> <copyright holder>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to

View File

@ -4,9 +4,6 @@
* Author: Your Full Name <your@email.address> * Author: Your Full Name <your@email.address>
* Copyright (c) <year> <copyright holder> * Copyright (c) <year> <copyright holder>
* *
* Author: <contributing author full name - if applicable>
* Copyright (c) <year> <copyright holder>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to

View File

@ -3,9 +3,6 @@
# Author: Your Full Name <your@email.address> # Author: Your Full Name <your@email.address>
# Copyright (c) <year> <copyright holder> # Copyright (c) <year> <copyright holder>
# #
# Author: <contributing author full name - if applicable>
# Copyright (c) <year> <copyright holder>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of # Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in # this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to # the Software without restriction, including without limitation the rights to

View File

@ -4,9 +4,6 @@
* Author: Your Full Name <your@email.address> * Author: Your Full Name <your@email.address>
* Copyright (c) <year> <copyright holder> * Copyright (c) <year> <copyright holder>
* *
* Author: <contributing author full name - if applicable>
* Copyright (c) <year> <copyright holder>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to

View File

@ -4,9 +4,6 @@
* Author: Your Full Name <your@email.address> * Author: Your Full Name <your@email.address>
* Copyright (c) <year> <copyright holder> * Copyright (c) <year> <copyright holder>
* *
* Author: <contributing author full name - if applicable>
* Copyright (c) <year> <copyright holder>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to