j24capeの日記

Born in Hikone City (Shiga), dropped out of university, and now seems like a programmer.

スーパーpre記法(シンタックス・ハイライト)は、シェルスクリプト(sh)未対応らしい

というわけで、いつ対応してくれるだろうか。わくわく。

#!/bin/sh

HOST=localhost
ENV=development
CATALYST_DEBUG=1
PORT_MIN=1024
PORT_MAX=65535
PORT=$1
PRJ_DIR=$2
if [ -z $PORT ]
then
  $PORT=5000
elif [ $PORT -lt $PORT_MIN -o $PORT -gt $PORT_MAX ]
then
  echo "[ERROR]TCP port number must be ${PORT_MIN}-${PORT_MAX}"
  exit 1
fi
if [ -z $PRJ_DIR ]
then
  PRJ_DIR=`pwd`
fi
export CATALYST_DEBUG
PSGI_FILENAME=`ls $PRJ_DIR | grep '\.psgi'`
PSGI_PATH="${PRJ_DIR}/${PSGI_FILENAME}"
echo "project directory: ${PRJ_DIR}"
echo "target PSGI script: ${PSGI_PATH}"
plackup \
  --host $HOST --port $PORT \
  --env $ENV --reload --Reload $PRJ_DIR/root -I $PRJ_DIR/lib \
  $PSGI_PATH &

テスト2

ソースコードは貼れるようになっているかしら。

#!/bin/sh

HOST=localhost
ENV=development
CATALYST_DEBUG=1
PORT_MIN=1024
PORT_MAX=65535
PORT=$1
PRJ_DIR=$2
if [ -z $PORT ]
then
  $PORT=5000
elif [ $PORT -lt $PORT_MIN -o $PORT -gt $PORT_MAX ]
then
  echo "[ERROR]TCP port number must be ${PORT_MIN}-${PORT_MAX}"
  exit 1
fi
if [ -z $PRJ_DIR ]
then
  PRJ_DIR=`pwd`
fi
export CATALYST_DEBUG
PSGI_FILENAME=`ls $PRJ_DIR | grep '\.psgi'`
PSGI_PATH="${PRJ_DIR}/${PSGI_FILENAME}"
echo "project directory: ${PRJ_DIR}"
echo "target PSGI script: ${PSGI_PATH}"
plackup \
  --host $HOST --port $PORT \
  --env $ENV --reload --Reload $PRJ_DIR/root -I $PRJ_DIR/lib \
  $PSGI_PATH &

あれ?シェルスクリプトはシンタックスハイライトされないんだっけ?

package Hello;
use Moose;
use namespace::autoclean;
use Catalyst::Runtime 5.80;

# Set flags and add plugins for the application.
#
# Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
# therefore you almost certainly want to keep ConfigLoader at the head of the
# list if you're using it.
#
#         -Debug: activates the debug mode for very useful log messages
#   ConfigLoader: will load the configuration from a Config::General file in the
#                 application's home directory
# Static::Simple: will serve static files from the application's root
#                 directory

use Catalyst qw/ 
    -Debug
    ConfigLoader
    Static::Simple
/;

extends 'Catalyst';

our $VERSION = '0.01';

__PACKAGE__->config(
    name => 'Hello',
    disable_component_resolution_regex_fallback => 1,
);
__PACKAGE__->setup();

1;

Perlスクリプトは問題なさそう。