thronglets 0.0.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 +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/exe/thronglets +5 -0
- data/lib/thronglets/cli.rb +16 -0
- data/lib/thronglets/thor_ext.rb +71 -0
- data/lib/thronglets/version.rb +5 -0
- data/lib/thronglets.rb +7 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cdda6c742974526a61c6a4f091b18b6c5c95825c6f21c6e243435bd34faea281
|
4
|
+
data.tar.gz: 283b488716218b7d8f070a23858754267ed12371492cc5511cfc5532f738b0f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 34d1b956a592f8d14c2dd4d19ebcbf12138a3ae39a65d9499ee3161e3176d31e3fdfa22d4d82c494c3c805749b5f0794c404deb49365a7dd0755231104fe5943
|
7
|
+
data.tar.gz: 1fba370c4feabaaa70ed62d0b4a79a888c2f2afe922d286c112ab27cae73e0e94cd296e022bd94d6bd451b5667ad3c0827def5a3b8e2b2adbf178153ed671ad1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Artem Mashchenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# thronglets
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/thronglets)
|
4
|
+
[](https://www.ruby-toolbox.com/projects/thronglets)
|
5
|
+
[](https://github.com/kkdoo/thronglets/actions/workflows/ci.yml)
|
6
|
+
[](https://codeclimate.com/github/kkdoo/thronglets)
|
7
|
+
|
8
|
+
TODO: Description of this gem goes here.
|
9
|
+
|
10
|
+
---
|
11
|
+
|
12
|
+
- [Quick start](#quick-start)
|
13
|
+
- [Support](#support)
|
14
|
+
- [License](#license)
|
15
|
+
- [Code of conduct](#code-of-conduct)
|
16
|
+
- [Contribution guide](#contribution-guide)
|
17
|
+
|
18
|
+
## Quick start
|
19
|
+
|
20
|
+
```
|
21
|
+
gem install thronglets
|
22
|
+
```
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require "thronglets"
|
26
|
+
```
|
27
|
+
|
28
|
+
## Support
|
29
|
+
|
30
|
+
If you want to report a bug, or have ideas, feedback or questions about the gem, [let me know via GitHub issues](https://github.com/kkdoo/thronglets/issues/new) and I will do my best to provide a helpful answer. Happy hacking!
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|
35
|
+
|
36
|
+
## Code of conduct
|
37
|
+
|
38
|
+
Everyone interacting in this project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
|
39
|
+
|
40
|
+
## Contribution guide
|
41
|
+
|
42
|
+
Pull requests are welcome!
|
data/exe/thronglets
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
module Thronglets
|
6
|
+
class CLI < Thor
|
7
|
+
extend ThorExt::Start
|
8
|
+
|
9
|
+
map %w[-v --version] => "version"
|
10
|
+
|
11
|
+
desc "version", "Display thronglets version", hide: true
|
12
|
+
def version
|
13
|
+
say "thronglets/#{VERSION} #{RUBY_DESCRIPTION}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Thronglets
|
4
|
+
module ThorExt
|
5
|
+
# Configures Thor to behave more like a typical CLI, with better help and error handling.
|
6
|
+
#
|
7
|
+
# - Passing -h or --help to a command will show help for that command.
|
8
|
+
# - Unrecognized options will be treated as errors (instead of being silently ignored).
|
9
|
+
# - Error messages will be printed in red to stderr, without stack trace.
|
10
|
+
# - Full stack traces can be enabled by setting the VERBOSE environment variable.
|
11
|
+
# - Errors will cause Thor to exit with a non-zero status.
|
12
|
+
#
|
13
|
+
# To take advantage of this behavior, your CLI should subclass Thor and extend this module.
|
14
|
+
#
|
15
|
+
# class CLI < Thor
|
16
|
+
# extend ThorExt::Start
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# Start your CLI with:
|
20
|
+
#
|
21
|
+
# CLI.start
|
22
|
+
#
|
23
|
+
# In tests, prevent Kernel.exit from being called when an error occurs, like this:
|
24
|
+
#
|
25
|
+
# CLI.start(args, exit_on_failure: false)
|
26
|
+
#
|
27
|
+
module Start
|
28
|
+
def self.extended(base)
|
29
|
+
super
|
30
|
+
base.check_unknown_options!
|
31
|
+
end
|
32
|
+
|
33
|
+
def start(given_args=ARGV, config={})
|
34
|
+
config[:shell] ||= Thor::Base.shell.new
|
35
|
+
handle_help_switches(given_args) do |args|
|
36
|
+
dispatch(nil, args, nil, config)
|
37
|
+
end
|
38
|
+
rescue StandardError => e
|
39
|
+
handle_exception_on_start(e, config)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def handle_help_switches(given_args)
|
45
|
+
yield(given_args.dup)
|
46
|
+
rescue Thor::UnknownArgumentError => e
|
47
|
+
retry_with_args = []
|
48
|
+
|
49
|
+
if given_args.first == "help"
|
50
|
+
retry_with_args = ["help"] if given_args.length > 1
|
51
|
+
elsif e.unknown.intersect?(%w[-h --help])
|
52
|
+
retry_with_args = ["help", (given_args - e.unknown).first]
|
53
|
+
end
|
54
|
+
raise unless retry_with_args.any?
|
55
|
+
|
56
|
+
yield(retry_with_args)
|
57
|
+
end
|
58
|
+
|
59
|
+
def handle_exception_on_start(error, config)
|
60
|
+
return if error.is_a?(Errno::EPIPE)
|
61
|
+
raise if ENV["VERBOSE"] || !config.fetch(:exit_on_failure, true)
|
62
|
+
|
63
|
+
message = error.message.to_s
|
64
|
+
message.prepend("[#{error.class}] ") if message.empty? || !error.is_a?(Thor::Error)
|
65
|
+
|
66
|
+
config[:shell]&.say_error(message, :red)
|
67
|
+
exit(false)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/thronglets.rb
ADDED
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thronglets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Artem Mashchenko
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: thor
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.2'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.2'
|
26
|
+
email:
|
27
|
+
- artem.maschenko@gmail.com
|
28
|
+
executables:
|
29
|
+
- thronglets
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- LICENSE.txt
|
34
|
+
- README.md
|
35
|
+
- exe/thronglets
|
36
|
+
- lib/thronglets.rb
|
37
|
+
- lib/thronglets/cli.rb
|
38
|
+
- lib/thronglets/thor_ext.rb
|
39
|
+
- lib/thronglets/version.rb
|
40
|
+
homepage: https://github.com/kkdoo/thronglets
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata:
|
44
|
+
bug_tracker_uri: https://github.com/kkdoo/thronglets/issues
|
45
|
+
changelog_uri: https://github.com/kkdoo/thronglets/releases
|
46
|
+
source_code_uri: https://github.com/kkdoo/thronglets
|
47
|
+
homepage_uri: https://github.com/kkdoo/thronglets
|
48
|
+
rubygems_mfa_required: 'true'
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.1'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubygems_version: 3.6.7
|
64
|
+
specification_version: 4
|
65
|
+
summary: Microservices with Ruby and Temporal
|
66
|
+
test_files: []
|