8219f0 Update render functionality:

Authored and Committed by areguera 14 years ago
    Update render functionality:
    
        - Rename OPTIONNAM and OPTIONVAL varialbe names to ACTIONNAM and
          ACTIONVAL respectively.
    
        - Use the AsErrorLine output message style on error messages.
    
        - Rename render_getIdentityFileslist to render_getFilesFist
          function calls.
    
        - Add positional parameters interpretation using getopt(1) inside
          render_getFilesList function.
    
        - Change `--entry' to `--directory' option definition and
          `--filter' to reduce the amount of files processed inside the
          directory specified by `--directory'.
    
    
        
Scripts/Bash/Functions/Render/Config/Translations/Identity/Brands/render.conf.sh CHANGED
@@ -128,7 +128,7 @@ function render_loadConfig {
128
128
FILE=$(echo $FILE | sed -r 's!^.+/Tpl/!!')
129
129
130
130
# Check output directory existence.
131
- DIRNAME=$(dirname $OPTIONVAL/$BOND/$FILE)
131
+ DIRNAME=$(dirname $ACTIONVAL/$BOND/$FILE)
132
132
if [ ! -d $DIRNAME ]; then
133
133
mkdir -p $DIRNAME
134
134
fi
@@ -139,8 +139,8 @@ function render_loadConfig {
139
139
# This let us reuse translation files using symbolic links
140
140
# and pointing them to translation template (`Tpl') files.
141
141
cli_printMessage $TRANSLATION "AsTranslationLine"
142
- cli_printMessage $OPTIONVAL/$BOND/$FILE "AsLinkToLine"
143
- ln -sf $TRANSLATION $OPTIONVAL/$BOND/$FILE
142
+ cli_printMessage $ACTIONVAL/$BOND/$FILE "AsLinkToLine"
143
+ ln -sf $TRANSLATION $ACTIONVAL/$BOND/$FILE
144
144
145
145
echo '----------------------------------------------------------------------'
146
146
Scripts/Bash/Functions/Render/render.sh CHANGED
@@ -32,7 +32,7 @@ function render {
32
32
33
33
# Re-define root directory used to load pre-rendering
34
34
# configuration scripts based on option value.
35
- local ARTCONF=$(echo "$OPTIONVAL" \
35
+ local ARTCONF=$(echo "$ACTIONVAL" \
36
36
| sed -r -e 's!/(Identity|Translations)!/Scripts/Bash/Functions/Render/Config/\1!' \
37
37
-e "s!Motifs/$(cli_getThemeName)/?!!")
38
38
Scripts/Bash/Functions/Render/render_doIdentity.sh CHANGED
@@ -49,11 +49,11 @@ function render_doIdentity {
49
49
render_getIdentityOutputDir
50
50
51
51
# Re-define parent directory for current workplace.
52
- PARENTDIR=$(basename $OPTIONVAL)
52
+ PARENTDIR=$(basename $ACTIONVAL)
53
53
54
54
# Re-define directory path used as reference to build the list of
55
55
# files that will be rendered.
56
- render_getIdentityFileslist
56
+ render_getFilesList
57
57
58
58
# Define which type of features does centos-art.sh script is able
59
59
# to performs.
Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh CHANGED
@@ -113,7 +113,7 @@ function render_doIdentityGroupByType {
113
113
# last-rendering action. There may be many different files to
114
114
# process here, so we need to build a list with them all
115
115
# (without duplications).
116
- for FILE in $(find $OPTIONVAL -regextype posix-egrep -type f -regex ${PATTERNS[2]} \
116
+ for FILE in $(find $ACTIONVAL -regextype posix-egrep -type f -regex ${PATTERNS[2]} \
117
117
| sed -r 's!\.[[:alpha:]]{1,4}$!!' | sort | uniq \
118
118
| egrep $REGEX);do
119
119
FILES[$COUNT]="$FILE"
Scripts/Bash/Functions/Render/render_doIdentityImageDm.sh CHANGED
@@ -91,7 +91,7 @@ function render_doIdentityImageDm {
91
91
# directories under
92
92
# trunk/Translations/Identity/Themes/Distro/BootUp/ structure,
93
93
# using the centos-art.sh script.
94
- VERSIONS=$(find $OPTIONVAL -regextype posix-egrep \
94
+ VERSIONS=$(find $ACTIONVAL -regextype posix-egrep \
95
95
-maxdepth 1 -type d -regex "^.*/${RELEASE_FORMAT}$" \
96
96
| egrep $REGEX)
97
97
@@ -120,13 +120,13 @@ function render_doIdentityImageDm {
120
120
VERSION=$(basename $VERSION)
121
121
122
122
# Define directory to store release-specific images.
123
- IMG=$OPTIONVAL/$VERSION/Img
123
+ IMG=$ACTIONVAL/$VERSION/Img
124
124
125
125
# Check existence of release-specific image directory.
126
126
cli_checkFiles "$IMG" 'd'
127
127
128
128
# Define directory to store release-specific tar.gz files.
129
- TGZ=$OPTIONVAL/$VERSION/Tgz
129
+ TGZ=$ACTIONVAL/$VERSION/Tgz
130
130
131
131
# Check existence of release-specific tar.gz directory.
132
132
cli_checkFiles "$TGZ" 'd'
Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh CHANGED
@@ -31,7 +31,7 @@ function render_doIdentityImageKsplash {
31
31
local RELDIR=''
32
32
local KSPLASH_TOP=''
33
33
local KSPLASH_PREVIEW=''
34
- local RELDIRS=$(find $OPTIONVAL -regextype posix-egrep -maxdepth 1 \
34
+ local RELDIRS=$(find $ACTIONVAL -regextype posix-egrep -maxdepth 1 \
35
35
-type d -regex "^.*/$RELEASE_FORMAT$" | egrep $REGEX)
36
36
37
37
# Define font file used to render Preview.png bottom text.
@@ -41,8 +41,8 @@ function render_doIdentityImageKsplash {
41
41
# images. Since we are building Preview with active and bottom
42
42
# splash only, there is no need to include inactive bar on
43
43
# checking.
44
- local KSPLASH_ACTIVE_BAR="$OPTIONVAL/splash_active_bar.png"
45
- local KSPLASH_BOTTOM="$OPTIONVAL/splash_bottom.png"
44
+ local KSPLASH_ACTIVE_BAR="$ACTIONVAL/splash_active_bar.png"
45
+ local KSPLASH_BOTTOM="$ACTIONVAL/splash_bottom.png"
46
46
47
47
# Check existence of non-release-specific required image files.
48
48
cli_checkFiles $KSPLASH_ACTIVE_BAR
Scripts/Bash/Functions/Render/render_getActions.sh CHANGED
@@ -28,44 +28,38 @@ function render_getActions {
28
28
29
29
# Evaluate option name and define which actions does centos-art.sh
30
30
# script supports.
31
- case $OPTIONNAM in
31
+ case $ACTIONNAM in
32
32
33
- --entry )
33
+ --directory )
34
34
35
- if [[ $OPTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Identity/.+$' ]];then
35
+ if [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Identity/.+$' ]];then
36
36
37
37
# Define identity rendering support.
38
38
render_getActionsIdentity
39
39
40
- elif [[ $OPTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Translations/.+$' ]];then
40
+ elif [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Translations/.+$' ]];then
41
41
42
42
# Define translation rendering support.
43
43
render_getActionsTranslations
44
44
45
45
else
46
46
47
- cli_printMessage "`gettext "The path provided can't be processed."`"
48
- cli_printMessage "trunk/Scripts/Bash" "AsToKnowMoreLine"
47
+ cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine'
48
+ cli_printMessage "$(caller)" 'AsToKnowMoreLine'
49
49
50
50
fi
51
51
;;
52
52
53
53
* )
54
54
55
- cli_printMessage "`eval_gettext "The option provided is not valid."`"
55
+ cli_printMessage "`eval_gettext "The option provided is not valid."`" 'AsErrorLine'
56
-
57
- if [[ $OPTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Identity/.+$' ]];then
58
-
59
- cli_printMessage "$OPTIONVAL" "AsToKnowMoreLine"
60
-
61
- elif [[ $OPTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Translations/.+$' ]];then
62
-
63
- cli_printMessage "$OPTIONVAL" "AsToKnowMoreLine"
64
56
57
+ if [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Identity/.+$' ]];then
58
+ cli_printMessage "$ACTIONVAL" 'AsToKnowMoreLine'
59
+ elif [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Translations/.+$' ]];then
60
+ cli_printMessage "$ACTIONVAL" 'AsToKnowMoreLine'
65
61
else
66
-
62
+ cli_printMessage "$(caller)" 'AsToKnowMoreLine'
67
- cli_printMessage "$(caller)" "AsToKnowMoreLine"
68
-
69
63
fi
70
64
;;
71
65
Scripts/Bash/Functions/Render/render_getActionsIdentity.sh CHANGED
@@ -50,8 +50,8 @@ function render_getActionsIdentity {
50
50
# directory which currently doesn't exist there is nothing to do
51
51
# here, so leave a message quit script execution.
52
52
if [[ ! -d $ARTCONF ]];then
53
- cli_printMessage "`gettext "The path provided can't be processed."`"
54
- cli_printMessage "$(caller)" "AsToKnowMoreLine"
53
+ cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine'
54
+ cli_printMessage "$(caller)" 'AsToKnowMoreLine'
55
55
fi
56
56
57
57
for FILE in $(find $ARTCONF -name 'render.conf.sh');do
@@ -81,16 +81,16 @@ function render_getActionsIdentity {
81
81
# configuration scripts and make required transformations.
82
82
render_checkConfig
83
83
84
- # Re-define option value (OPTIONVAL) based on pre-rendering
84
+ # Re-define option value (ACTIONVAL) based on pre-rendering
85
85
# configuration script path value. Otherwise massive rendering
86
86
# may fail. Functions like renderImage need to know the exact
87
87
# artwork path (that is, where images will be stored).
88
- OPTIONVAL=$(dirname $(echo $FILE | sed -r \
88
+ ACTIONVAL=$(dirname $(echo $FILE | sed -r \
89
89
-e 's!Scripts/Bash/Functions/Render/Config/Identity/!Identity/!' \
90
90
-e "s!Themes/!Themes/Motifs/$(cli_getThemeName)/!"))
91
91
92
92
# Re-define artwork identification.
93
- ARTCOMP=$(echo $OPTIONVAL | cut -d/ -f6-)
93
+ ARTCOMP=$(echo $ACTIONVAL | cut -d/ -f6-)
94
94
95
95
# Remove motif name from artwork identification in order to reuse
96
96
# motif artwork identification. There is not need to create one
Scripts/Bash/Functions/Render/render_getActionsTranslations.sh CHANGED
@@ -32,7 +32,7 @@ function render_getActionsTranslations {
32
32
# directory. Translation rendering is based on translation
33
33
# templates inside 'Tpl/' directory. If that directory doesn't
34
34
# exist leave a message and quit execution.
35
- if [[ ! -d $OPTIONVAL/Tpl ]];then
35
+ if [[ ! -d $ACTIONVAL/Tpl ]];then
36
36
cli_printMessage "`gettext "Can't find translation templates in the directory provided."`"
37
37
cli_printMessage "$(caller)" "AsToKnowMoreLine"
38
38
fi
@@ -98,7 +98,7 @@ function render_getActionsTranslations {
98
98
# translations directories available in the current location will
99
99
# be affected.
100
100
if [[ $REGEX =~ "^$RELEASE_FORMAT$" ]];then
101
- RELEASES=$OPTIONVAL/$REGEX
101
+ RELEASES=$ACTIONVAL/$REGEX
102
102
103
103
# Re-define releases using regular expression value. If you need
104
104
# to create/update two or more release-specific directories (e.g.,
@@ -113,8 +113,8 @@ function render_getActionsTranslations {
113
113
# By default look for available release-specific directories and
114
114
# use them all.
115
115
else
116
- RELEASES=$(find $OPTIONVAL -regextype posix-egrep \
117
- -regex "^$OPTIONVAL/$RELEASE_FORMAT$" | sort)
116
+ RELEASES=$(find $ACTIONVAL -regextype posix-egrep \
117
+ -regex "^$ACTIONVAL/$RELEASE_FORMAT$" | sort)
118
118
fi
119
119
120
120
# At this point, if there isn't release-specific directories
@@ -157,7 +157,7 @@ function render_getActionsTranslations {
157
157
158
158
# Get translation templates and process them using release
159
159
# information previously defined.
160
- for FILE in $(find $OPTIONVAL/Tpl -name '*.sed');do
160
+ for FILE in $(find $ACTIONVAL/Tpl -name '*.sed');do
161
161
162
162
# Define translation file locale.
163
163
LOCALE=$(echo $FILE | sed -r 's!^/.+/Tpl/([a-z]{2}|[a-z]{2}_[A-Z]{2})/.+$!\1!' )
Scripts/Bash/Functions/Render/render_getFilesList.sh CHANGED
@@ -27,6 +27,31 @@
27
27
28
28
function render_getFilesList {
29
29
30
+ # Define short options we want to support.
31
+ ARGSS=""
32
+
33
+ # Define long options we want to support.
34
+ ARGSL="filter:"
35
+
36
+ # Parse arguments using getopt(1) command parser.
37
+ cli_doParseArguments
38
+
39
+ # Reset positional parameters using output from (getopt) argument
40
+ # parser.
41
+ eval set -- "$ARGUMENTS"
42
+
43
+ # Define action to take for each option passed.
44
+ while true; do
45
+ case "$1" in
46
+ --filter )
47
+ REGEX="$2"
48
+ shift 2
49
+ ;;
50
+ * )
51
+ break
52
+ esac
53
+ done
54
+
30
55
# Define source location to look files for. In order to define
31
56
# source location we evaluate both matching list and translation
32
57
# path information, and based on them, we set which is the source
Scripts/Bash/Functions/Render/render_getIdentityDefs.sh CHANGED
@@ -55,7 +55,7 @@ function render_getIdentityDefs {
55
55
# Define the design template absolute path. This definition is
56
56
# done by interpreting the matching list and translation path
57
57
# information. This defintion needs to be coherent with those
58
- # defined in render_getIdentityFileslist function.
58
+ # defined in render_getFilesList function.
59
59
if [[ "${MATCHINGLIST}" != "" ]] \
60
60
&& [[ "${TRANSLATIONPATH}" == "" ]];then
61
61
@@ -345,7 +345,7 @@ function render_getIdentityDefs {
345
345
# Create the design template instance. When building the instance,
346
346
# take into account the matching list and translation path. It
347
347
# should be coherent with previous definitions above and in
348
- # render_getIdentityFileslist.
348
+ # render_getFilesList.
349
349
if [[ "${MATCHINGLIST}" == "" ]] \
350
350
&& [[ "${TRANSLATIONPATH}" != "" ]];then
351
351
Scripts/Bash/Functions/Render/render_getIdentityOutputDir.sh CHANGED
@@ -28,16 +28,16 @@ function render_getIdentityOutputDir {
28
28
29
29
# By default rendered identity artworks are stored immediatly
30
30
# under identity entry structure.
31
- IMG=$OPTIONVAL
31
+ IMG=$ACTIONVAL
32
32
33
33
# But if Img/ directory exists, use it instead.
34
- if [[ -d $OPTIONVAL/Img ]]; then
35
- IMG=$OPTIONVAL/Img
34
+ if [[ -d $ACTIONVAL/Img ]]; then
35
+ IMG=$ACTIONVAL/Img
36
36
fi
37
37
38
38
# But if Txt/ directory exists, use it instead.
39
- if [[ -d $OPTIONVAL/Txt ]]; then
40
- IMG=$OPTIONVAL/Txt
39
+ if [[ -d $ACTIONVAL/Txt ]]; then
40
+ IMG=$ACTIONVAL/Txt
41
41
fi
42
42
43
43
}
Scripts/Bash/Functions/Render/render_getIdentityTemplateDir.sh CHANGED
@@ -28,7 +28,7 @@ function render_getIdentityTemplateDir {
28
28
29
29
# By default design templates are stored in the artworks identity
30
30
# entry, under Tpl/ directory.
31
- SVG=$OPTIONVAL/Tpl
31
+ SVG=$ACTIONVAL/Tpl
32
32
33
33
# If you are rendering theme motifs, design templates are not
34
34
# stored inside Tpl directory. Instead, we use one common theme
@@ -37,7 +37,7 @@ function render_getIdentityTemplateDir {
37
37
# to use before rendering artistic motifs.
38
38
if [[ ! -d $SVG ]] \
39
39
&& [[ $SVG =~ "trunk/Identity/Themes/Motifs/$(cli_getThemeName)/" ]]; then
40
- SVG=$(echo "$OPTIONVAL" | sed "s!Motifs/$(cli_getThemeName)!Models/$THEMEMODEL!")
40
+ SVG=$(echo "$ACTIONVAL" | sed "s!Motifs/$(cli_getThemeName)!Models/$THEMEMODEL!")
41
41
fi
42
42
43
43
}