canto 0.1.5 → 0.1.7
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/canto.gemspec +1 -6
- data/lib/canto/cli.rb +19 -16
- data/lib/canto/version.rb +1 -1
- metadata +1 -8
- data/.circleci/config.yml +0 -39
- data/.gitignore +0 -9
- data/.ruby-version +0 -1
- data/.standard.yml +0 -22
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -21
- data/Rakefile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b22df70bad61c5ef02d4686deb6f156dc9da82a81708776feefeb3937b18a57d
|
4
|
+
data.tar.gz: 3301bcce470c49c9518fb2dee686f226a9ea242be44a34560906c5792e2082af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982d66bfce451a5a9336d2c1b2c3287e983463fb1208f7415a3280feecd056cbd48bcf2a2c0a3bbaf258b67098fbf45dcc4f80b223670e11c0d5a52400cd5a37
|
7
|
+
data.tar.gz: 3dbb6bac4b6063196d9a6a5b3ae836648ebc57b08d0e558f06d824dbaae77c4c2062ba8e24a4f5576da9ad438d977ba0cb4120c3af76e480b8c1bccb79a25c16
|
data/canto.gemspec
CHANGED
@@ -15,13 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
16
16
|
spec.metadata['source_code_uri'] = 'https://github.com/merqloveu/canto'
|
17
17
|
|
18
|
-
|
19
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
-
end
|
18
|
+
spec.files = %w[canto.gemspec README.md CODE_OF_CONDUCT.md LICENSE.txt] + `git ls-files | grep -E '^(bin|lib)'`.split("\n")
|
23
19
|
|
24
|
-
spec.bindir = 'bin'
|
25
20
|
spec.executables = ['canto']
|
26
21
|
spec.require_paths = ['lib']
|
27
22
|
end
|
data/lib/canto/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'singleton'
|
2
2
|
require 'optparse'
|
3
3
|
require 'fileutils'
|
4
|
+
require 'logger'
|
4
5
|
|
5
6
|
$stdout.sync = true
|
6
7
|
|
@@ -20,7 +21,7 @@ module Canto
|
|
20
21
|
validate!
|
21
22
|
end
|
22
23
|
|
23
|
-
def run(
|
24
|
+
def run(boot_app: true)
|
24
25
|
boot_application if boot_app
|
25
26
|
|
26
27
|
self_read, self_write = IO.pipe
|
@@ -43,8 +44,8 @@ module Canto
|
|
43
44
|
handle_signal(signal)
|
44
45
|
end
|
45
46
|
rescue Interrupt
|
46
|
-
|
47
|
-
|
47
|
+
CLI.logger.info 'Shutting down'
|
48
|
+
CLI.logger.info 'Bye!'
|
48
49
|
|
49
50
|
# Explicitly exit so busy Processor threads won't block process shutdown.
|
50
51
|
#
|
@@ -62,24 +63,24 @@ module Canto
|
|
62
63
|
# Heroku sends TERM and then waits 30 seconds for process to exit.
|
63
64
|
'TERM' => ->(_) { raise Interrupt },
|
64
65
|
'TSTP' => ->(_) {
|
65
|
-
|
66
|
+
CLI.logger.info 'Received TSTP, no longer accepting new work'
|
66
67
|
},
|
67
68
|
'TTIN' => ->(_) {
|
68
69
|
Thread.list.each do |thread|
|
69
|
-
|
70
|
+
CLI.logger.warn "Thread TID-#{(thread.object_id ^ ::Process.pid).to_s(36)} #{thread.name}"
|
70
71
|
if thread.backtrace
|
71
|
-
|
72
|
+
CLI.logger.warn thread.backtrace.join("\n")
|
72
73
|
else
|
73
|
-
|
74
|
+
CLI.logger.warn '<no backtrace available>'
|
74
75
|
end
|
75
76
|
end
|
76
77
|
}
|
77
78
|
}
|
78
|
-
UNHANDLED_SIGNAL_HANDLER = ->(_) {
|
79
|
+
UNHANDLED_SIGNAL_HANDLER = ->(_) { CLI.logger.info 'No signal handler registered, ignoring' }
|
79
80
|
SIGNAL_HANDLERS.default = UNHANDLED_SIGNAL_HANDLER
|
80
81
|
|
81
82
|
def handle_signal(sig)
|
82
|
-
|
83
|
+
CLI.logger.debug "Got #{sig} signal"
|
83
84
|
SIGNAL_HANDLERS[sig].call(self)
|
84
85
|
end
|
85
86
|
|
@@ -99,12 +100,14 @@ module Canto
|
|
99
100
|
opts
|
100
101
|
end
|
101
102
|
|
103
|
+
alias_method :die, :exit
|
104
|
+
|
102
105
|
def set_environment(cli_env)
|
103
106
|
@environment = cli_env || ENV['APP_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
104
107
|
end
|
105
108
|
|
106
109
|
def initialize_logger
|
107
|
-
|
110
|
+
CLI.logger = Logger.new($stdout, level: Logger::INFO)
|
108
111
|
end
|
109
112
|
|
110
113
|
def boot_application
|
@@ -116,11 +119,11 @@ module Canto
|
|
116
119
|
def validate!
|
117
120
|
if !File.exist?(options[:require]) ||
|
118
121
|
(File.directory?(options[:require]) && !File.exist?("#{options[:require]}/config/application.rb"))
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
122
|
+
CLI.logger.info '=================================================================='
|
123
|
+
CLI.logger.info ' Please point Canto to Ruby file '
|
124
|
+
CLI.logger.info ' to load your classes with -r [FILE].'
|
125
|
+
CLI.logger.info '=================================================================='
|
126
|
+
CLI.logger.info @parser
|
124
127
|
die(1)
|
125
128
|
end
|
126
129
|
end
|
@@ -143,7 +146,7 @@ module Canto
|
|
143
146
|
|
144
147
|
parser.banner = 'canto [options]'
|
145
148
|
parser.on_tail '-h', '--help', 'Show help' do
|
146
|
-
|
149
|
+
CLI.logger.info parser
|
147
150
|
die 1
|
148
151
|
end
|
149
152
|
|
data/lib/canto/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Merkulov
|
@@ -19,16 +19,9 @@ executables:
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
-
- ".circleci/config.yml"
|
23
|
-
- ".gitignore"
|
24
|
-
- ".ruby-version"
|
25
|
-
- ".standard.yml"
|
26
22
|
- CODE_OF_CONDUCT.md
|
27
|
-
- Gemfile
|
28
|
-
- Gemfile.lock
|
29
23
|
- LICENSE.txt
|
30
24
|
- README.md
|
31
|
-
- Rakefile
|
32
25
|
- bin/canto
|
33
26
|
- canto.gemspec
|
34
27
|
- lib/canto.rb
|
data/.circleci/config.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
orbs:
|
3
|
-
ruby: circleci/ruby@1.0.0
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
docker:
|
8
|
-
- image: circleci/ruby:2.7.2
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- checkout
|
12
|
-
- ruby/install-deps
|
13
|
-
|
14
|
-
minitest:
|
15
|
-
docker:
|
16
|
-
- image: circleci/ruby:2.7.2
|
17
|
-
environment:
|
18
|
-
BUNDLE_JOBS: 3
|
19
|
-
BUNDLE_RETRY: 3
|
20
|
-
BUNDLE_PATH: vendor/bundle
|
21
|
-
|
22
|
-
steps:
|
23
|
-
- checkout
|
24
|
-
- ruby/install-deps
|
25
|
-
|
26
|
-
- run:
|
27
|
-
name: Stale code fix
|
28
|
-
command: git fetch && git reset --hard origin/${CIRCLE_BRANCH}
|
29
|
-
- run:
|
30
|
-
name: Minitest
|
31
|
-
command: bundle exec rake test
|
32
|
-
|
33
|
-
workflows:
|
34
|
-
tests:
|
35
|
-
jobs:
|
36
|
-
- build
|
37
|
-
- minitest:
|
38
|
-
requires:
|
39
|
-
- build
|
data/.gitignore
DELETED
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.7.2
|
data/.standard.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#fix: true # default: false
|
2
|
-
parallel: true # default: false
|
3
|
-
#format: progress # default: Standard::Formatter
|
4
|
-
#ruby_version: 2.3.3 # default: RUBY_VERSION
|
5
|
-
#default_ignores: false # default: true
|
6
|
-
#
|
7
|
-
ignore:
|
8
|
-
- './**/*':
|
9
|
-
- Style/RescueModifier
|
10
|
-
- Style/StringLiterals
|
11
|
-
- Style/StringLiteralsInInterpolation
|
12
|
-
- Lint/AssignmentInCondition
|
13
|
-
- Security/YAMLLoad
|
14
|
-
- Layout/SpaceInsideHashLiteralBraces
|
15
|
-
- Layout/ArgumentAlignment
|
16
|
-
- Standard/SemanticBlocks
|
17
|
-
# - 'db/schema.rb'
|
18
|
-
# - 'vendor/**/*'
|
19
|
-
- 'config/**/*'
|
20
|
-
- 'spec/**/*':
|
21
|
-
- Layout/EmptyLinesAroundBlockBody
|
22
|
-
# - Layout/AlignHash
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
canto (0.1.5)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
minitest (5.14.3)
|
10
|
-
rake (12.3.3)
|
11
|
-
|
12
|
-
PLATFORMS
|
13
|
-
ruby
|
14
|
-
|
15
|
-
DEPENDENCIES
|
16
|
-
canto!
|
17
|
-
minitest (~> 5.0)
|
18
|
-
rake (~> 12.0)
|
19
|
-
|
20
|
-
BUNDLED WITH
|
21
|
-
2.1.4
|