From bfd2c9834421b8e65ba0bf1a320382a979eabf3e Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Sat, 30 Aug 2025 10:05:55 -0400 Subject: [PATCH] Added some initial project structure and supporting tooling --- .rubocop.yml | 24 +++++++++++++++++ .woodpecker.yml | 39 +++++++++++++++++++++++++++ Gemfile | 14 ++++++++++ Gemfile.lock | 66 ++++++++++++++++++++++++++++++++++++++++++++++ Rakefile | 12 +++++++++ src/cmd/network.rb | 12 +++++++++ src/main.rb | 25 ++++++++++++++++++ 7 files changed, 192 insertions(+) create mode 100644 .rubocop.yml create mode 100644 .woodpecker.yml create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile create mode 100644 src/cmd/network.rb create mode 100644 src/main.rb diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..8dcefee --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,24 @@ +plugins: + - rubocop-rspec + +AllCops: + NewCops: enable + +Layout/EmptyLinesAroundClassBody: + EnforcedStyle: 'empty_lines_except_namespace' +Layout/EmptyLinesAroundModuleBody: + EnforcedStyle: 'empty_lines_except_namespace' +Layout/FirstHashElementIndentation: + EnforcedStyle: 'consistent' +Metrics/ClassLength: + Max: 150 +Style/ClassVars: + Enabled: false +Style/GlobalVars: + Enabled: false +Style/MethodCallWithoutArgsParentheses: + Enabled: false +Style/MethodCallWithArgsParentheses: + Enabled: true +Style/RedundantReturn: + Enabled: false diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..e7d0419 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,39 @@ +steps: + setup: + image: ruby:3.4 + env: + RACK_ENV: testing + commands: + - gem install rake + - bundle config set --local path "vendor/bundle" + - bundle install + + test_ruby34: + image: ruby:3.4 + env: + RACK_ENV: testing + commands: + - gem install rake + - bundle config set --local path "vendor/bundle" + - rake test:unit + group: tests + + style: + image: ruby:3.4 + env: + RACK_ENV: testing + commands: + - gem install rake + - bundle config set --local path "vendor/bundle" + - rake test:lint + + 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 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..8781154 --- /dev/null +++ b/Gemfile @@ -0,0 +1,14 @@ +source 'https://rubygems.org' + +gem 'thor', '~> 1.3' + +gem 'logger' + +group :development, :test do + # rubocop and extensions for code style + gem 'rubocop' + gem 'rubocop-rspec' + + # rspec for unit testing + gem 'rspec' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ff31460 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,66 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.3) + diff-lcs (1.6.2) + json (2.13.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + parallel (1.27.0) + parser (3.3.9.0) + ast (~> 2.4.1) + racc + prism (1.4.0) + racc (1.8.1) + rainbow (3.1.1) + regexp_parser (2.11.2) + rspec (3.13.1) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.5) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.5) + rubocop (1.80.1) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.46.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.46.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-rspec (3.6.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + ruby-progressbar (1.13.0) + thor (1.4.0) + unicode-display_width (3.1.5) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + +PLATFORMS + ruby + x86_64-linux-gnu + +DEPENDENCIES + logger + rspec + rubocop + rubocop-rspec + thor (~> 1.3) + +BUNDLED WITH + 2.6.9 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..ad1ff00 --- /dev/null +++ b/Rakefile @@ -0,0 +1,12 @@ +require 'bundler/setup' + +namespace :test do + task :unit do + ENV['RACK_ENV'] = 'testing' + system('rspec') + end + + task :lint do + system('rubocop src/ spec/') + end +end diff --git a/src/cmd/network.rb b/src/cmd/network.rb new file mode 100644 index 0000000..6f0c12d --- /dev/null +++ b/src/cmd/network.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'thor' + +class Network < Thor + + desc 'print', 'Prints the network subcommand.' + def print() + puts 'This is the network subcommand' + end + +end diff --git a/src/main.rb b/src/main.rb new file mode 100644 index 0000000..2a59d22 --- /dev/null +++ b/src/main.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +#!/usr/bin/env ruby +require 'bundler/setup' +require 'thor' + +module PCHWBM + + require_relative 'cmd/network' + + class CLI < Thor + + desc 'version', 'Prints the application version.' + def version() + puts 'PC Hardware Benchmark CLI app v0.1.0.' + end + + desc 'network', 'network SUBCOMMAND for testing networking components.' + subcommand 'network', Network + + end + +end + +PCHWBM::CLI.start(ARGV)