diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..336c880 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,117 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +# +# Created: 15th August 2026 +# Updated: 15th August 2026 +# + +name: Ruby + +on: + push: + branches: + - boilerplate + - dev + - idiomatic + - master + - rc1 + - rc2 + - rc3 + pull_request: + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + test: + + strategy: + fail-fast: false + + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + ruby-version: + # - head + - '3.4' + - '3.3' + - '3.2' + - '3.1' + - '3.0' + - '2.7' + - '2.6' + + include: + - os: ubuntu-latest + ruby-version: '2.5' + - os: ubuntu-latest + ruby-version: '2.4' + - os: ubuntu-latest + ruby-version: '2.0' + - os: windows-latest + ruby-version: mingw + + runs-on: ${{ matrix.os }} + + steps: + - name: Checking out code + uses: actions/checkout@v4 + + - name: Remove Gemfile.lock + run: rm -f Gemfile.lock + + - name: Set up Ruby v${{ matrix.ruby-version }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Show Ruby version + run: ruby -v + + - name: Run tests + run: bundle exec rake test + + - name: Gem build and install smoke + shell: bash + run: | + gem build woad.gemspec + gem install --local woad-*.gem + ruby -e "require 'woad'; abort('VERSION missing') unless defined?(Woad::VERSION); puts Woad::VERSION" + + warnings: + + name: Warnings + + runs-on: ubuntu-latest + + steps: + - name: Checking out code + uses: actions/checkout@v4 + + - name: Remove Gemfile.lock + run: rm -f Gemfile.lock + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + + - name: Show Ruby version + run: ruby -v + + - name: Require library with warnings + run: ruby -w -Ilib -e "require 'woad'" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5d0ba7d --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +# directories (by name) + +/.bzr/ +/.bundle/ +/.config/ +/.svn/ +/.yardoc/ + +/_yardoc/ + +/InstalledFiles/ +/build/ +/coverage/ +/doc/ +/lib/bundler/man/ +/old-gems/ +/pkg/ +/rdoc/ +/scratch/ +/spec/reports/ +/test/tmp/ +/test/version_tmp/ +/tmp/ +/vendor/bundle/ + + +# directories (by pattern) + + +# files (by name) + +.DS_Store +.repl_history +.ruby-version +.rvmrc + +/spec/examples.txt + + +# files (by pattern) + +*~ +*.*~ +.dat* +*.b64 +*.bridgesupport +*.gem +*.rbc +*.scc +*.suo +*.swp +*.tmp +*.zip diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..98f87ff --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,21 @@ +# woad.Ruby - Authors + + +## Major Contributors + +| Name | GitHub | +| ----------- | --------------------------------- | +| Matt Wilson | [mwsis](https://github.com/mwsis) | + + +## Defect reports, fixes and suggestions (for which we are very grateful) + +| Name | GitHub | +| ------- | ------ | +| \ | | + + +Contributions are welcomed. + + + diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..53c4cff --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,10 @@ +# woad.Ruby - Changes + + +## 0.0.0 - 15th August 2026 + +* initial project scaffolding; +* **Ruby** **2.0+** compatibility; + + + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..29f6d2e --- /dev/null +++ b/Gemfile @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec + +# rake 13 requires Ruby >= 2.3 +if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3") + + gem "rake", '~> 13.0' +else + + gem "rake", '~> 12.3' +end + +gem "test-unit", '~> 3.0' diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..02c3ce1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +woad.Ruby - BSD 3-Clause License + +Copyright (c) 2026, Matthew Wilson and Synesis Information Systems +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index b931477..ef049c9 100644 --- a/README.md +++ b/README.md @@ -1 +1,91 @@ -# woad.Ruby \ No newline at end of file +# woad.Ruby + +Minimal ANSI terminal colour codes, for Ruby + +![Language](https://img.shields.io/badge/Ruby-CC342D?style=flat&logo=ruby&logoColor=white) +[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) +[![Gem Version](https://badge.fury.io/rb/woad.svg)](https://badge.fury.io/rb/woad) +[![GitHub release](https://img.shields.io/github/v/release/synesissoftware/woad.Ruby.svg)](https://github.com/synesissoftware/woad.Ruby/releases/latest) +[![Last Commit](https://img.shields.io/github/last-commit/synesissoftware/woad.Ruby)](https://github.com/synesissoftware/woad.Ruby/commits/master) +[![Ruby](https://github.com/synesissoftware/woad.Ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/synesissoftware/woad.Ruby/actions/workflows/ruby.yml) + + +## Table of Contents + +- [Introduction](#introduction) +- [Installation](#installation) +- [Components](#components) +- [Project Information](#project-information) + - [Where to get help](#where-to-get-help) + - [Contribution guidelines](#contribution-guidelines) + - [Dependencies](#dependencies) + - [Development Dependencies](#development-dependencies) + - [Related projects](#related-projects) + - [License](#license) + + +## Introduction + +**woad** provides the smallest useful set of fixed ANSI SGR colour sequences for library authors. It is not a console or TUI framework. + +**woad.Ruby** is the **Ruby** implementation. It supports **Ruby 2.0** through **3.x**. + + +## Installation + +Install via **gem** as in: + +``` +gem install woad +``` + +or add it to your `Gemfile`. + +Use via **require**, as in: + +```Ruby +require 'woad' +``` + + +## Components + +**woad.Ruby** currently ships the **`Woad`** root module and version metadata (`require 'woad'`). Colour codes, TTY/stream gating, and Windows virtual-terminal opt-in are not implemented in this 0.0.0 skeleton. + + +## Project Information + + +### Where to get help + +[GitHub Page](https://github.com/synesissoftware/woad.Ruby "GitHub Page") + + +### Contribution guidelines + +Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/woad.Ruby. + + +### Dependencies + +* \ + + +#### Development Dependencies + +* [**rake**](https://github.com/ruby/rake) +* [**test-unit**](https://github.com/test-unit/test-unit) + + +### Related projects + +* [**woad.Python**](https://github.com/synesissoftware/woad.Python/) +* [**woad.Rust**](https://github.com/synesissoftware/woad.Rust/) + + +### License + +**woad.Ruby** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details. + + + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..3a8ae1c --- /dev/null +++ b/Rakefile @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Rakefile for woad.Ruby + +require 'rake/testtask' + + +Rake::TestTask.new do |tt| + + tt.libs << 'lib' + tt.libs << 'test' + tt.name = 'test' + tt.test_files = FileList['test/**/tc_*.rb'] + tt.verbose = true +end + + +task :default => :test + + +# ############################## end of file ############################# # diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..fd66ada --- /dev/null +++ b/TODO.md @@ -0,0 +1,21 @@ +# woad.Ruby - TODO + + +## Functional improvements + +* [ ] SGR colour and reset codes; +* [ ] TTY-conditional colour codes (process and per-stream); +* [ ] Windows virtual-terminal gating (OS build + `GetConsoleMode`); + + +## Performance improvements + +* \ + + +## Packaging improvements + +* \ + + + diff --git a/build_gem.sh b/build_gem.sh new file mode 100755 index 0000000..1b1ba31 --- /dev/null +++ b/build_gem.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +############################################################################# +# File: build_gem.sh +# +# Purpose: Builds the gem +# +# Created: 15th August 2026 +# Updated: 15th August 2026 +# +############################################################################# + +gem build *.gemspec $* diff --git a/lib/woad.rb b/lib/woad.rb new file mode 100644 index 0000000..be06ee1 --- /dev/null +++ b/lib/woad.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# ######################################################################## # +# File: woad.rb +# +# Purpose: Primary require for woad.Ruby library +# +# Created: 15th August 2026 +# Updated: 15th August 2026 +# +# Home: http://github.com/synesissoftware/woad.Ruby +# +# Author: Matthew Wilson +# +# Copyright (c) 2026, Matthew Wilson and Synesis Information Systems +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ######################################################################## # + + +=begin +=end + +## Root module for *woad* +module Woad + +end # module Woad + + +require 'woad/version' + + +# ############################## end of file ############################# # diff --git a/lib/woad/version.rb b/lib/woad/version.rb new file mode 100644 index 0000000..b33d353 --- /dev/null +++ b/lib/woad/version.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true +# ######################################################################## # +# File: woad/version.rb +# +# Purpose: Version for woad.Ruby library +# +# Created: 15th August 2026 +# Updated: 15th August 2026 +# +# Home: http://github.com/synesissoftware/woad.Ruby +# +# Author: Matthew Wilson +# +# Copyright (c) 2026, Matthew Wilson and Synesis Information Systems +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# ######################################################################## # + + +=begin +=end + +module Woad + + # Current version of the woad.Ruby library + VERSION = '0.0.0' + + private + # @!visibility private + VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc: + public + # Major version of the woad.Ruby library + VERSION_MAJOR = VERSION_PARTS_[0] # :nodoc: + # Minor version of the woad.Ruby library + VERSION_MINOR = VERSION_PARTS_[1] # :nodoc: + # Revision version of the woad.Ruby library + VERSION_REVISION = VERSION_PARTS_[2] # :nodoc: +end # module Woad + + +# ############################## end of file ############################# # diff --git a/test/unit/tc_version.rb b/test/unit/tc_version.rb new file mode 100644 index 0000000..546a943 --- /dev/null +++ b/test/unit/tc_version.rb @@ -0,0 +1,37 @@ +#! /usr/bin/env ruby + +$:.unshift File.join(File.dirname(__FILE__), '../../lib') + + +require 'woad/version' + +require 'test/unit' + + +class Test_version < Test::Unit::TestCase + + def test_has_VERSION + + assert defined? Woad::VERSION + end + + def test_has_VERSION_MAJOR + + assert defined? Woad::VERSION_MAJOR + end + + def test_has_VERSION_MINOR + + assert defined? Woad::VERSION_MINOR + end + + def test_has_VERSION_REVISION + + assert defined? Woad::VERSION_REVISION + end + + def test_VERSION_has_consistent_format + + assert_equal Woad::VERSION.split('.')[0..2].join('.'), "#{Woad::VERSION_MAJOR}.#{Woad::VERSION_MINOR}.#{Woad::VERSION_REVISION}" + end +end diff --git a/woad.gemspec b/woad.gemspec new file mode 100644 index 0000000..eb09897 --- /dev/null +++ b/woad.gemspec @@ -0,0 +1,54 @@ +# ######################################################################### # +# File: woad.gemspec +# +# Purpose: Gemspec for woad.Ruby library +# +# Created: 15th August 2026 +# Updated: 15th August 2026 +# +# ######################################################################### # + + +$:.unshift File.join(File.dirname(__FILE__), 'lib') + +require 'woad/version' + + +Gem::Specification.new do |spec| + + spec.name = 'woad' + spec.version = Woad::VERSION + spec.summary = 'woad.Ruby' + spec.description = <= 2.0', '< 5' ] + + spec.require_paths = [ + 'lib', + ] + + spec.metadata = { + 'bug_tracker_uri' => 'https://github.com/synesissoftware/woad.Ruby/issues', + 'changelog_uri' => 'https://github.com/synesissoftware/woad.Ruby/blob/master/CHANGES.md', + 'homepage_uri' => 'https://github.com/synesissoftware/woad.Ruby', + 'source_code_uri' => 'https://github.com/synesissoftware/woad.Ruby', + } + + spec.files = Dir[ 'Rakefile', '{bin,examples,lib,man,spec,test}/**/*', 'AUTHORS.md', 'CHANGES.md', 'LICENSE*', 'README*', 'TODO.md' ] +end + + +# ############################## end of file ############################# #