LoginSignup
23
21

More than 5 years have passed since last update.

Capistrano3でローカルリポジトリをdeployする

Posted at

やりたいこと

Capistrano3で開発中のブランチを検証環境に気軽にぶん投げれる用にしたい。

プロトタイプみたいなのを検証環境に上げたいときに、リモートブランチにpushしてからdeployするのはめんどくさかったりするので好きじゃない。
Capistrano2だと scm :copy使えたけど Capistrano3からなくなったのが悪い。
近いようなことができるGemがみつかったのでこれを使うことにした。
https://github.com/xuwupeng2000/capsitrano-scm-gitcopy)

手順

Gemfile
+ capistrano-scm-gitcopy
deploy/local.rb
+ set :rails_env, :staging
+ set :repo_url, ->{ "file://" + Dir::pwd + "/.git" }
+ set :scm, :gitcopy
+ ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

他の設定は基本的なCapistrano3と同じなので省略。

使い方

cap local deploy でリモートブランチからデプロイするのと同じように更新がかけられる。

れっつカジュアルdeploy

23
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
21