Last active
December 31, 2015 05:09
-
-
Save rch850/7939266 to your computer and use it in GitHub Desktop.
apidoc でドキュメント作って S3 につっこむコマンド
This file contains hidden or 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
@echo off | |
goto checkaws | |
:: | |
:: apidoc のインストールチェック | |
:: | |
cmd /C apidoc -h >NUL 2>&1 | |
if not errorlevel 1 goto runapidoc | |
:: | |
:: apidoc が入ってないければインストールする | |
:: | |
echo apidoc をインストールします... | |
cmd /C npm install -g apidoc | |
if not errorlevel 1 goto runapidoc | |
echo apidoc のインストールに失敗しました | |
echo - Node.js はインストールされていますか? | |
echo - npm にパスは通っていますか? | |
goto end | |
:runapidoc | |
:: | |
:: apidoc でドキュメントを生成する | |
:: | |
apidoc -i app -f ".*\.java$" -o apidoc | |
:checkaws | |
:: | |
:: AWS CLI のインストールチェック | |
:: | |
cmd /C aws --version >NUL 2>&1 | |
if not errorlevel 1 goto runsync | |
echo aws コマンドの実行に失敗しました | |
echo ブラウザが開くのでそこから AWS CLI をインストールして下さい | |
timeout 5 | |
start http://aws.amazon.com/cli/ | |
goto end | |
:runsync | |
:: | |
:: S3 にアップロード | |
:: aws s3 sync はエラーで使えない https://github.com/aws/aws-cli/issues/424 | |
:: | |
set AWS_DEFAULT_REGION=ap-northeast-1 | |
set AWS_DEFAULT_PROFILE=yourprofilename | |
aws s3 cp --resursive apidoc s3://bucketName/apidoc/%date:~-10,4%-%date:~-5,2%-%date:~-2,2% | |
aws s3 cp --resursive apidoc s3://bucketName/apidoc/latest | |
echo 失敗したら権限を確認して下さい | |
echo %USERPROFILE%\.aws\config の [profile yourprofilename] に設定を書くとか | |
echo 環境変数 AWS_ACCESS_KEY_ID と AWS_SECRET_ACCESS_KEY を設定するとか | |
:end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment