tomo 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/tomo/cli.rb +1 -1
- data/lib/tomo/configuration/dsl/error_formatter.rb +19 -18
- data/lib/tomo/configuration.rb +1 -1
- data/lib/tomo/plugin/puma/tasks.rb +8 -3
- data/lib/tomo/testing/cli_tester.rb +5 -1
- data/lib/tomo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92b79ae23f462d987b150fe0537a743f087e150b6947780baa77ea4046e7d9b9
|
4
|
+
data.tar.gz: 77f301ef039cc4b8e8ed65f4009f0f1e0f3b0edaba7420f7b9994797b78bd53f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312cc7f96ebe0fa19c369fe1bb3ad3c8ea654abfbc8f6d35ec8253f03f8694f4300d6b113d9c17a20ab0473d649b1c0404611f746ffbf563a0c15b8eb35b29e4
|
7
|
+
data.tar.gz: 737e7aa7cbffe6a048164a6798fc63847ec32478ea81fe63b78fe62b95970f602c6c888b5087a7c03ffe281807182284e1d46ce8e25eff189bc48591a7c598b4
|
data/README.md
CHANGED
@@ -199,6 +199,20 @@ By default, tomo uses the ["accept-new"](https://www.openssh.com/txt/release-7.6
|
|
199
199
|
set ssh_strict_host_key_checking: true # or false
|
200
200
|
```
|
201
201
|
|
202
|
+
#### Why does my deploy hang after starting puma?
|
203
|
+
|
204
|
+
Puma 4.1.0 [has a bug](https://github.com/puma/puma/issues/1906) where its output isn't properly detached prior to daemonzing. This causes tomo to hang waiting for output. You may see something like this prior to the deploy freezing:
|
205
|
+
|
206
|
+
```
|
207
|
+
Puma starting in single mode...
|
208
|
+
* Version 4.1.0 (ruby 2.6.4-p104), codename: Fourth and One
|
209
|
+
* Min threads: 5, max threads: 5
|
210
|
+
* Environment: production
|
211
|
+
* Daemonizing...
|
212
|
+
```
|
213
|
+
|
214
|
+
To fix, upgrade to puma 4.1.1 or newer.
|
215
|
+
|
202
216
|
## Support
|
203
217
|
|
204
218
|
This project is a labor of love and I can only spend a few hours a week maintaining it, at most. If you'd like to help by submitting a pull request, or if you've discovered a bug that needs my attention, please let me know. Check out [CONTRIBUTING.md](https://github.com/mattbrictson/tomo/blob/master/CONTRIBUTING.md) to get started. Happy hacking! —Matt
|
data/lib/tomo/cli.rb
CHANGED
@@ -2,20 +2,31 @@ module Tomo
|
|
2
2
|
class Configuration
|
3
3
|
module DSL
|
4
4
|
module ErrorFormatter
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
class << self
|
6
|
+
def decorate(error, path, lines)
|
7
|
+
line_no = find_line_no(path, error.message, *error.backtrace[0..1])
|
8
|
+
return error if line_no.nil?
|
9
|
+
|
10
|
+
error.extend(self)
|
11
|
+
error.dsl_lines = lines || []
|
12
|
+
error.dsl_path = path
|
13
|
+
error.error_line_no = line_no
|
14
|
+
error
|
8
15
|
end
|
9
16
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
17
|
+
private
|
18
|
+
|
19
|
+
def find_line_no(path, *lines)
|
20
|
+
lines.find do |line|
|
21
|
+
line_no = line[/^#{Regexp.quote(path)}:(\d+):/, 1]
|
22
|
+
break line_no.to_i if line_no
|
23
|
+
end
|
24
|
+
end
|
14
25
|
end
|
15
26
|
|
16
27
|
include Colors
|
17
28
|
|
18
|
-
attr_accessor :dsl_lines, :dsl_path
|
29
|
+
attr_accessor :dsl_lines, :dsl_path, :error_line_no
|
19
30
|
|
20
31
|
def to_console
|
21
32
|
<<~ERROR
|
@@ -39,16 +50,6 @@ module Tomo
|
|
39
50
|
HINT
|
40
51
|
end
|
41
52
|
|
42
|
-
def error_line_no
|
43
|
-
@_error_line_no ||= begin
|
44
|
-
pattern = /^#{Regexp.quote(dsl_path)}:(\d+):/
|
45
|
-
backtrace.each do |entry|
|
46
|
-
match = pattern.match(entry)
|
47
|
-
break match[1].to_i if match
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
53
|
# rubocop:disable Metrics/AbcSize
|
53
54
|
# rubocop:disable Metrics/MethodLength
|
54
55
|
def highlighted_lines
|
data/lib/tomo/configuration.rb
CHANGED
@@ -23,7 +23,7 @@ module Tomo
|
|
23
23
|
config.working_dir = File.dirname(path)
|
24
24
|
DSL::ConfigFile.new(config).instance_eval(config_rb, path.to_s, 1)
|
25
25
|
end
|
26
|
-
rescue StandardError => e
|
26
|
+
rescue StandardError, SyntaxError => e
|
27
27
|
raise DSL::ErrorFormatter.decorate(e, path, config_rb&.lines)
|
28
28
|
end
|
29
29
|
|
@@ -31,9 +31,7 @@ module Tomo::Plugin::Puma
|
|
31
31
|
|
32
32
|
remote.chdir(paths.current) do
|
33
33
|
remote.bundle(
|
34
|
-
"exec", "puma", "--daemon", *control_options,
|
35
|
-
raw(">"), paths.puma_stdout,
|
36
|
-
raw("2>"), paths.puma_stderr
|
34
|
+
"exec", "puma", "--daemon", *control_options, *output_options
|
37
35
|
)
|
38
36
|
end
|
39
37
|
end
|
@@ -51,5 +49,12 @@ module Tomo::Plugin::Puma
|
|
51
49
|
"--control-token", settings[:puma_control_token]
|
52
50
|
]
|
53
51
|
end
|
52
|
+
|
53
|
+
def output_options
|
54
|
+
options = []
|
55
|
+
options << ["--redirect-stdout", paths.puma_stdout] if paths.puma_stdout
|
56
|
+
options << ["--redirect-stderr", paths.puma_stderr] if paths.puma_stderr
|
57
|
+
options.flatten
|
58
|
+
end
|
54
59
|
end
|
55
60
|
end
|
@@ -10,8 +10,12 @@ module Tomo
|
|
10
10
|
@token = SecureRandom.hex(8)
|
11
11
|
end
|
12
12
|
|
13
|
+
def in_temp_dir(&block)
|
14
|
+
super(token, &block)
|
15
|
+
end
|
16
|
+
|
13
17
|
def run(*args, raise_on_error: true)
|
14
|
-
in_temp_dir
|
18
|
+
in_temp_dir do
|
15
19
|
restoring_defaults do
|
16
20
|
capturing_logger_output do
|
17
21
|
handling_exit(raise_on_error) do
|
data/lib/tomo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|