Initial project structure with dry/cli
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
26897dd544
commit
1d7b9c8f0f
22
.rubocop.yml
Normal file
22
.rubocop.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
AllCops:
|
||||||
|
NewCops: enable
|
||||||
|
|
||||||
|
Layout/EmptyLinesAroundClassBody:
|
||||||
|
EnforcedStyle: 'empty_lines_except_namespace'
|
||||||
|
Layout/EmptyLinesAroundModuleBody:
|
||||||
|
EnforcedStyle: 'empty_lines_except_namespace'
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Max: 150
|
||||||
|
Metrics/MethodLength:
|
||||||
|
AllowedMethods:
|
||||||
|
- 'start'
|
||||||
|
Style/ClassVars:
|
||||||
|
Enabled: false
|
||||||
|
Style/GlobalVars:
|
||||||
|
Enabled: false
|
||||||
|
Style/MethodCallWithoutArgsParentheses:
|
||||||
|
Enabled: false
|
||||||
|
Style/MethodCallWithArgsParentheses:
|
||||||
|
Enabled: true
|
||||||
|
Style/RedundantReturn:
|
||||||
|
Enabled: false
|
18
.woodpecker.yml
Normal file
18
.woodpecker.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
pipeline:
|
||||||
|
style:
|
||||||
|
image: ruby:3.0
|
||||||
|
commands:
|
||||||
|
- 'gem install rake'
|
||||||
|
- 'bundle install'
|
||||||
|
- 'rake test:rubocop'
|
||||||
|
|
||||||
|
gitea_release:
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea_api_key
|
||||||
|
base_url: https://git.metaunix.net
|
||||||
|
title: "${CI_COMMIT_TAG}"
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
|
8
Gemfile
Normal file
8
Gemfile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'dry-cli', '1.0.0'
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
# rubocop and extensions for code style
|
||||||
|
gem 'rubocop'
|
||||||
|
end
|
40
Gemfile.lock
Normal file
40
Gemfile.lock
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
ast (2.4.2)
|
||||||
|
dry-cli (1.0.0)
|
||||||
|
json (2.6.3)
|
||||||
|
language_server-protocol (3.17.0.3)
|
||||||
|
parallel (1.23.0)
|
||||||
|
parser (3.2.2.4)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
|
racc (1.7.1)
|
||||||
|
rainbow (3.1.1)
|
||||||
|
regexp_parser (2.8.2)
|
||||||
|
rexml (3.2.6)
|
||||||
|
rubocop (1.57.2)
|
||||||
|
json (~> 2.3)
|
||||||
|
language_server-protocol (>= 3.17.0)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.2.2.4)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
|
rexml (>= 3.2.5, < 4.0)
|
||||||
|
rubocop-ast (>= 1.28.1, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
|
rubocop-ast (1.30.0)
|
||||||
|
parser (>= 3.2.1.0)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
|
unicode-display_width (2.5.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
dry-cli (= 1.0.0)
|
||||||
|
rubocop
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.3.5
|
15
Rakefile
Normal file
15
Rakefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
task :run do
|
||||||
|
system("ruby src/pchwbm.rb")
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :test do
|
||||||
|
task :all do
|
||||||
|
Rake::Task['test:rubocop'].invoke()
|
||||||
|
end
|
||||||
|
|
||||||
|
task :rubocop do
|
||||||
|
system("rubocop src/")
|
||||||
|
end
|
||||||
|
end
|
34
src/pchwbm.rb
Executable file
34
src/pchwbm.rb
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'bundler/setup'
|
||||||
|
require 'dry/cli'
|
||||||
|
|
||||||
|
module PCHWBM
|
||||||
|
module CLI
|
||||||
|
# Commands module for dry-cli
|
||||||
|
module Commands
|
||||||
|
|
||||||
|
extend Dry::CLI::Registry
|
||||||
|
|
||||||
|
# Version subcommand definition
|
||||||
|
class Version < Dry::CLI::Command
|
||||||
|
|
||||||
|
desc 'Print program version.'
|
||||||
|
|
||||||
|
def call(*)
|
||||||
|
puts('PCHWBM tool version 0.1.0.')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Register commands with the CLI
|
||||||
|
register 'version', Version, aliases: ['v', '-v', '--version']
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Run the CLI
|
||||||
|
Dry::CLI.new(PCHWBM::CLI::Commands).call()
|
Loading…
Reference in New Issue
Block a user