Created
September 17, 2012 13:14
-
-
Save akiroom/3737202 to your computer and use it in GitHub Desktop.
Rails3+(haml, less, coffeescript)のアプリケーションを新規作成するためのシェルスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# カレントディレクトに引数で指定したアプリケーション名のディレクトリをつくって、 | |
# Rails3のアプリケーションにします。オレオレテンプレなので使わない方がいいかも | |
if [ $# -ne 1 ]; then | |
echo "指定された引数は$#個です。" 1>&2 | |
echo "実行するには1個の引数(アプリケーション名)が必要です。" 1>&2 | |
exit 1 | |
fi | |
if [ -e ./$1 ]; then | |
echo "指定されたアプリケーション名は既に存在しています。" | |
exit 1 | |
fi | |
# アプリケーションのディレクトリを作成して移動 | |
mkdir ./$1 | |
cd $1 | |
# RailsをインストールするためのGemfileを準備 | |
echo 'source "http://rubygems.org"\ngem "rails"' > ./Gemfile | |
# Railsをインストール | |
bundle install --path vendor/bundler | |
# Railsアプリを新規作成(bundle installは実行しない) | |
bundle exec rails new . --skip-bundle --force | |
# Gemfileを編集して、hamlとsassに対応させる | |
sed --in-place "s/gem 'sass-rails'.*$/gem 'less-rails'/" ./Gemfile | |
sed --in-place "s/# gem 'therubyracer'/ gem 'therubyracer'/" ./Gemfile | |
echo 'gem "haml-rails"' >> ./Gemfile | |
# bundle installを実行して必要なファイルを追加 | |
bundle install --path vendor/bundler | |
echo "完了" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment