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 +4 -4
- data/README.md +1 -0
- data/lib/ruboty/capistrano.rb +1 -0
- data/lib/ruboty/capistrano/actions/deploy.rb +10 -3
- data/lib/ruboty/capistrano/config.rb +1 -0
- data/lib/ruboty/capistrano/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1cb596f87b71458a2783696b4bd0bc340d4705
|
4
|
+
data.tar.gz: c6dd46e793ff38b271dc1fe03e1381c2e1b3bd92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/ruboty/capistrano.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|