capistrano-nextjs 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/LICENSE.txt +2 -49
- data/README.md +26 -1
- data/lib/capistrano/nextjs/logs.rb +17 -0
- data/lib/capistrano/nextjs/version.rb +1 -1
- data/lib/capistrano/nextjs.rb +2 -1
- data/lib/capistrano/tasks/logs.rake +93 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22ee2925f3caeb5d40843bc2bca9ed369e8fa588e34cbb30ecf9a1ebc1eca9cc
|
|
4
|
+
data.tar.gz: 3c7bb94eef93b4d352eb45a94667c603b7108f149e9b443565a522131df1d997
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6368a9500adebe293b1458c3b2460cda83b2d4f6ed2ea09a43fe1a054ed9f60bbbcdb5f56fea1f44ad2d7fa8ea786fb51901acbcb78d984a486d2e3ce7f04d9
|
|
7
|
+
data.tar.gz: 7337e5b37dc0c7b278790ac840ef2185758c7bfd5db02722648eb0b3e781837895e1564ce23a9cec073914d0730d83f657d543b8c0b890ca23d8ee0165cd45c2
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.1] - 2026-03-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `logs:info` task – streams `shared/log/nextjs.log` in green
|
|
13
|
+
- `logs:error` task – streams `shared/log/nextjs-error.log` in red
|
|
14
|
+
- `logs:all` task – streams both logs simultaneously, color-coded by source
|
|
15
|
+
- Custom SSHKit formatter (`ColoredLogFormatter`) for clean ANSI-colored output without SSHKit prefix noise
|
|
16
|
+
- GitHub Actions release workflow for automatic publishing to RubyGems.org
|
|
17
|
+
- `scripts/bump_version.rb` for version management
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- License changed from LGPL-3.0 to MIT
|
|
22
|
+
- Updated README with logs task documentation, configuration options and color reference table
|
|
23
|
+
|
|
8
24
|
## [1.0.0] - 2025-07-07
|
|
9
25
|
|
|
10
26
|
### Added
|
data/LICENSE.txt
CHANGED
|
@@ -1,53 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Version 3, 29 June 2007
|
|
1
|
+
MIT License
|
|
3
2
|
|
|
4
|
-
Copyright (
|
|
5
|
-
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
-
of this license document, but changing it is not allowed.
|
|
7
|
-
|
|
8
|
-
This version of the GNU Lesser General Public License incorporates
|
|
9
|
-
the terms and conditions of version 3 of the GNU General Public
|
|
10
|
-
License, supplemented by the additional permissions listed below.
|
|
11
|
-
|
|
12
|
-
0. Additional Definitions.
|
|
13
|
-
|
|
14
|
-
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
15
|
-
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
16
|
-
General Public License.
|
|
17
|
-
|
|
18
|
-
"The Library" refers to a covered work governed by this License,
|
|
19
|
-
other than an Application or a Combined Work as defined below.
|
|
20
|
-
|
|
21
|
-
An "Application" is any work that makes use of an interface provided
|
|
22
|
-
by the Library, but which is not otherwise based on the Library.
|
|
23
|
-
Defining a subclass of a class defined by the Library is deemed a mode
|
|
24
|
-
of using an interface provided by the Library.
|
|
25
|
-
|
|
26
|
-
A "Combined Work" is a work produced by combining or linking an
|
|
27
|
-
Application with the Library. The particular version of the Library
|
|
28
|
-
with which the Combined Work was made is also called the "Linked
|
|
29
|
-
Version".
|
|
30
|
-
|
|
31
|
-
The "Minimal Corresponding Source" for a Combined Work means the
|
|
32
|
-
Corresponding Source for the Combined Work, excluding any source code
|
|
33
|
-
for portions of the Combined Work that, considered in isolation, are
|
|
34
|
-
based on the Application, and not on the Linked Version.
|
|
35
|
-
|
|
36
|
-
The "Corresponding Application Code" for a Combined Work means the
|
|
37
|
-
object code and/or source code for the Application, including any data
|
|
38
|
-
and utility programs needed for reproducing the Combined Work from the
|
|
39
|
-
Application, but excluding the System Libraries of the Combined Work.
|
|
40
|
-
|
|
41
|
-
1. Exception to Section 3 of the GNU GPL.
|
|
42
|
-
|
|
43
|
-
You may convey a covered work under sections 3 and 4 of this License
|
|
44
|
-
without being bound by section 3 of the GNU GPL.
|
|
45
|
-
|
|
46
|
-
2. Conveying this Library.
|
|
47
|
-
|
|
48
|
-
You may convey a copy of the Library under this License. However, if you
|
|
49
|
-
modify the Library, you may not distribute your modifications without
|
|
50
|
-
accompanying the distribution with complete Corresponding Source code.
|
|
3
|
+
Copyright (c) 2026 zauberware
|
|
51
4
|
|
|
52
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
53
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -37,6 +37,8 @@ set :nextjs_env, fetch(:stage)
|
|
|
37
37
|
|
|
38
38
|
## Available Tasks
|
|
39
39
|
|
|
40
|
+
### Deployment
|
|
41
|
+
|
|
40
42
|
- `cap nextjs:start` - Start Next.js application
|
|
41
43
|
- `cap nextjs:stop` - Stop Next.js application
|
|
42
44
|
- `cap nextjs:restart` - Restart Next.js application
|
|
@@ -46,6 +48,29 @@ set :nextjs_env, fetch(:stage)
|
|
|
46
48
|
- `cap nextjs:build` - Build Next.js application
|
|
47
49
|
- `cap nextjs:check` - Check Next.js application (lint)
|
|
48
50
|
|
|
51
|
+
### Logs
|
|
52
|
+
|
|
53
|
+
- `cap logs:info` - Stream the Next.js application log (green output)
|
|
54
|
+
- `cap logs:error` - Stream the Next.js error log (red output)
|
|
55
|
+
- `cap logs:all` - Stream both logs simultaneously, color-coded by source
|
|
56
|
+
|
|
57
|
+
Press `Ctrl+C` to stop streaming.
|
|
58
|
+
|
|
59
|
+
The log tasks use a custom SSHKit formatter to colorize output directly in your terminal:
|
|
60
|
+
|
|
61
|
+
| Task | File | Color |
|
|
62
|
+
| ------------ | ----------------------------- | ----------- |
|
|
63
|
+
| `logs:info` | `shared/log/nextjs.log` | Green |
|
|
64
|
+
| `logs:error` | `shared/log/nextjs-error.log` | Red |
|
|
65
|
+
| `logs:all` | both | Green / Red |
|
|
66
|
+
|
|
67
|
+
#### Configuration
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
set :logs_tail_lines, 100 # number of lines to show on connect (default: 100)
|
|
71
|
+
set :rake_roles, :app # roles to stream logs from
|
|
72
|
+
```
|
|
73
|
+
|
|
49
74
|
## Configuration
|
|
50
75
|
|
|
51
76
|
The gem automatically integrates with your deployment process:
|
|
@@ -62,4 +87,4 @@ The gem automatically integrates with your deployment process:
|
|
|
62
87
|
|
|
63
88
|
## License
|
|
64
89
|
|
|
65
|
-
The gem is available as open source under the terms of the [
|
|
90
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Capistrano
|
|
4
|
+
module Nextjs
|
|
5
|
+
class Logs < Capistrano::Plugin
|
|
6
|
+
include NextjsCommon
|
|
7
|
+
|
|
8
|
+
def define_tasks
|
|
9
|
+
eval_rakefile File.expand_path('../tasks/logs.rake', __dir__)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def set_defaults
|
|
13
|
+
set_if_empty :logs_tail_lines, 100
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/capistrano/nextjs.rb
CHANGED
|
@@ -100,9 +100,10 @@ module Capistrano
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
require_relative 'nextjs/systemd'
|
|
103
|
-
|
|
103
|
+
require_relative 'nextjs/logs'
|
|
104
104
|
# Create top-level aliases for easier plugin installation
|
|
105
105
|
module Capistrano
|
|
106
106
|
NextjsPlugin = Nextjs::Plugin
|
|
107
107
|
NextjsSystemd = Nextjs::Systemd
|
|
108
|
+
NextjsLogs = Nextjs::Logs
|
|
108
109
|
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Capistrano
|
|
4
|
+
module NextJS
|
|
5
|
+
class ColoredLogFormatter < SSHKit::Formatter::Abstract
|
|
6
|
+
def initialize(stdout_color, stderr_color = nil)
|
|
7
|
+
super($stdout)
|
|
8
|
+
@stdout_color = stdout_color
|
|
9
|
+
@stderr_color = stderr_color || stdout_color
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def log_command_start(_cmd); end
|
|
13
|
+
def log_command_exit(_cmd); end
|
|
14
|
+
|
|
15
|
+
def log_command_data(_cmd, stream_type, data)
|
|
16
|
+
color = stream_type == :stderr ? @stderr_color : @stdout_color
|
|
17
|
+
$stdout.print "#{color}#{data}\e[0m"
|
|
18
|
+
$stdout.flush
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
namespace :logs do
|
|
25
|
+
desc 'show logs'
|
|
26
|
+
task :info do
|
|
27
|
+
orig_output = SSHKit.config.output
|
|
28
|
+
SSHKit.config.output = Capistrano::NextJS::ColoredLogFormatter.new("\e[32m")
|
|
29
|
+
on roles fetch(:rake_roles, :app) do
|
|
30
|
+
trap('INT') do
|
|
31
|
+
print "\rDisconnecting... Done.\n"
|
|
32
|
+
exit 0
|
|
33
|
+
end
|
|
34
|
+
execute "tail -n #{fetch(:logs_tail_lines)} -f #{shared_path}/log/nextjs.log"
|
|
35
|
+
end
|
|
36
|
+
ensure
|
|
37
|
+
SSHKit.config.output = orig_output
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
desc 'show error logs'
|
|
41
|
+
task :error do
|
|
42
|
+
orig_output = SSHKit.config.output
|
|
43
|
+
SSHKit.config.output = Capistrano::NextJS::ColoredLogFormatter.new("\e[31m")
|
|
44
|
+
on roles fetch(:rake_roles, :app) do
|
|
45
|
+
trap('INT') do
|
|
46
|
+
print "\rDisconnecting... Done.\n"
|
|
47
|
+
exit 0
|
|
48
|
+
end
|
|
49
|
+
execute "tail -n #{fetch(:logs_tail_lines)} -f #{shared_path}/log/nextjs-error.log"
|
|
50
|
+
end
|
|
51
|
+
ensure
|
|
52
|
+
SSHKit.config.output = orig_output
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
desc 'show all logs (info and error)'
|
|
56
|
+
task :all do
|
|
57
|
+
orig_output = SSHKit.config.output
|
|
58
|
+
|
|
59
|
+
# For :all we need a formatter that switches color based on tail's "==> filename <==" headers
|
|
60
|
+
formatter = Class.new(SSHKit::Formatter::Abstract) do
|
|
61
|
+
def initialize
|
|
62
|
+
super($stdout)
|
|
63
|
+
@current_color = "\e[32m" # green default
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def log_command_start(_cmd); end
|
|
67
|
+
def log_command_exit(_cmd); end
|
|
68
|
+
|
|
69
|
+
def log_command_data(_cmd, _stream_type, data)
|
|
70
|
+
data.each_line do |line|
|
|
71
|
+
if line.include?('nextjs-error.log')
|
|
72
|
+
@current_color = "\e[31m"
|
|
73
|
+
elsif line.include?('nextjs.log')
|
|
74
|
+
@current_color = "\e[32m"
|
|
75
|
+
end
|
|
76
|
+
$stdout.print "#{@current_color}#{line}\e[0m"
|
|
77
|
+
end
|
|
78
|
+
$stdout.flush
|
|
79
|
+
end
|
|
80
|
+
end.new
|
|
81
|
+
|
|
82
|
+
SSHKit.config.output = formatter
|
|
83
|
+
on roles fetch(:rake_roles, :app) do
|
|
84
|
+
trap('INT') do
|
|
85
|
+
print "\rDisconnecting... Done.\n"
|
|
86
|
+
exit 0
|
|
87
|
+
end
|
|
88
|
+
execute "tail -n #{fetch(:logs_tail_lines)} -f #{shared_path}/log/nextjs.log #{shared_path}/log/nextjs-error.log"
|
|
89
|
+
end
|
|
90
|
+
ensure
|
|
91
|
+
SSHKit.config.output = orig_output
|
|
92
|
+
end
|
|
93
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-nextjs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Crusius
|
|
@@ -70,14 +70,16 @@ files:
|
|
|
70
70
|
- LICENSE.txt
|
|
71
71
|
- README.md
|
|
72
72
|
- lib/capistrano/nextjs.rb
|
|
73
|
+
- lib/capistrano/nextjs/logs.rb
|
|
73
74
|
- lib/capistrano/nextjs/systemd.rb
|
|
74
75
|
- lib/capistrano/nextjs/version.rb
|
|
76
|
+
- lib/capistrano/tasks/logs.rake
|
|
75
77
|
- lib/capistrano/tasks/nextjs.rake
|
|
76
78
|
- lib/capistrano/tasks/systemd.rake
|
|
77
79
|
- lib/capistrano/templates/nextjs.service.capistrano.erb
|
|
78
80
|
homepage: https://github.com/zauberware/capistrano-nextjs
|
|
79
81
|
licenses:
|
|
80
|
-
-
|
|
82
|
+
- MIT
|
|
81
83
|
metadata:
|
|
82
84
|
rubygems_mfa_required: 'true'
|
|
83
85
|
post_install_message:
|