ruboty-capistrano 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d499dd93f9c06c725aee77f0e1f6ffe92535d0c
4
- data.tar.gz: 6921665950ce222fd64d95df1ec32b3ac4abda44
3
+ metadata.gz: 0f1cb596f87b71458a2783696b4bd0bc340d4705
4
+ data.tar.gz: c6dd46e793ff38b271dc1fe03e1381c2e1b3bd92
5
5
  SHA512:
6
- metadata.gz: f72432f08122159464ea4b10e775fe37e3dfc1073d78c35c8e3bf6fa7b267bbbdf2d0fdd80e2da454e34eea93c80ac874ee7739509723f5d3e101506ff71b7e8
7
- data.tar.gz: ca74161862c3f33903a55ac2c356832bd645ff5dbfc0b3e7b3b7d536aeb275dd35f0119da706932fabd81a5f2df27ae9b93ff4476fbc407d3280eda3a19aa5c2
6
+ metadata.gz: 38213f80b138755ac65944bf312d57360bf23eab9a68280b8b18aea6066638e70d7f2cc95d04dac87f6f7c9b3fae781f0b80173738b32dc0fe8892813ab0a7f3
7
+ data.tar.gz: a1c447e7fa0fd1c13a50a562131ff8a2e7c1c7e6a364f77b658b9e40e0e9b0115f33546c9579124a5edaf7adc0c59f0778624d01dd14b8bc5d12a5c5f30037e5
data/README.md CHANGED
@@ -42,6 +42,7 @@ RUBOTY_ENV - deploy先の環境を指定する
42
42
  DEFAULT_BRANCH - deploy時において、branch指定されていなかった場合に、deployするdefaultのbranch
43
43
  DEPLOY_REPOSITORY_PATH - deploy対象のrepositoryのpath
44
44
  (ex: "sample:/path/to/sample;admin:/path/to/admin")
45
+ DEPLOY_LOG_PATH - deploy時のログを残すpath
45
46
  ```
46
47
 
47
48
  ## License
@@ -1,5 +1,6 @@
1
1
  require 'open3'
2
2
  require 'active_support/all'
3
+ require 'date'
3
4
  require 'ruboty/capistrano/version'
4
5
  require 'ruboty/handlers/capistrano'
5
6
 
@@ -12,6 +12,7 @@ module Ruboty
12
12
  @role = message.match_data[1]
13
13
  @path = Ruboty::Capistrano.config.repository_path[@role]
14
14
  @branch = message.match_data[2] || ENV['DEFAULT_BRANCH']
15
+ @logger = Logger.new(deploy_log_path)
15
16
  end
16
17
 
17
18
  def call
@@ -21,10 +22,9 @@ module Ruboty
21
22
  rescue => e
22
23
  err_message = <<~TEXT
23
24
  :cop:問題が発生しました:cop:
24
- ```
25
- #{e.message}
26
- ```
27
25
  TEXT
26
+
27
+ @logger.error e.message
28
28
  message.reply(err_message)
29
29
  end
30
30
 
@@ -36,8 +36,15 @@ module Ruboty
36
36
 
37
37
  cmd = "cd #{path} && bundle && bundle exec cap #{@env} deploy BRANCH=#{@branch}"
38
38
  out, err, status = Bundler.with_clean_env { Open3.capture3(cmd) }
39
+ @logger.info out
39
40
  raise DeployError.new(err) unless err.empty?
40
41
  end
42
+
43
+ def deploy_log_path
44
+ return STDOUT if Ruboty::Capistrano.config.log_path.to_s.empty?
45
+
46
+ File.join(Ruboty::Capistrano.config.log_path, "#{DateTime.now.strftime('%Y%m%d%H%M')}.log")
47
+ end
41
48
  end
42
49
  end
43
50
  end
@@ -5,6 +5,7 @@ module Ruboty
5
5
 
6
6
  configure do |config|
7
7
  config.env = ENV['RUBOTY_ENV']
8
+ config.log_path = ENV['DEPLOY_LOG_PATH']
8
9
  config.repository_path = ENV['DEPLOY_REPOSITORY_PATH'].split(';').inject({}) do |hash, s|
9
10
  key, value = s.split(":").first, s.split(":").last
10
11
  hash[key] = value
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Capistrano
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morioka Shuhei
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-22 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport