changeset 6:f6d65d2a806f

Split const definitions into config/definition.sh
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Thu, 30 Jan 2014 22:08:04 +0900
parents ba844bcb8b5e
children e0c4a349c94f
files build.sh config/definition.sh new_slide.sh
diffstat 3 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Thu Jan 30 22:00:36 2014 +0900
+++ b/build.sh	Thu Jan 30 22:08:04 2014 +0900
@@ -1,27 +1,23 @@
 #/bin/sh
 
-# definition
-
-command="slideshow"
-template_option="-t s6syntax"
-target_filename="*.md"
-
+# source definitions
+. `dirname $0`/config/definition.sh
 
 # functions
 
 command_check() {
-    if !(which ${command} >& /dev/null;) then
-        echo ${command} not found
+    if !(which ${build_command} >& /dev/null;) then
+        echo ${build_command} not found
         exit
     fi
 }
 
 build() {
-    ${command} build $1 -o `dirname $1` ${template_option}
+    ${build_command} build $1 -o `dirname $1` ${build_template_option}
 }
 
 build_slides() {
-    target_list=`find $(dirname $0) -name "${target_filename}"`
+    target_list=`find $(dirname $0) -name "${build_target_filename}"`
     for target in ${target_list}; do
         build $target
     done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/definition.sh	Thu Jan 30 22:08:04 2014 +0900
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# build definitions
+
+build_command="slideshow"
+build_template_option="-t s6syntax"
+build_target_filename="*.md"
+
+# new slide definitions
+
+slide_root_dirname="slides"
+slide_date_format="%Y%m%d"
+slide_name="slide.md"
--- a/new_slide.sh	Thu Jan 30 22:00:36 2014 +0900
+++ b/new_slide.sh	Thu Jan 30 22:08:04 2014 +0900
@@ -1,8 +1,7 @@
 #!/bin/sh
 
-slide_root_dirname="slides"
-date_format="%Y%m%d"
-slide_name="slide.md"
+# import definitions
+. `dirname $0`/config/definition.sh
 
 # function
 
@@ -26,7 +25,7 @@
         command="date"
     fi
 
-    ${command} --date="${week_of_day}" +"${date_format}"
+    ${command} --date="${week_of_day}" +"${slide_date_format}"
 }
 
 # main