Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
test:
name: Ruby ${{ matrix.ruby }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- '4.0.6'
- jruby

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run tests
run: bundle exec rake spec

lint:
name: RuboCop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0.6'
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop

security:
name: Bundler Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0.6'
bundler-cache: true

- name: Run bundler-audit
run: bundle exec bundler-audit check --update
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
Gemfile.lock
pkg/*
.rvmrc
.ruby-version
coverage/*
5 changes: 1 addition & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1
NewCops: enable
SuggestExtensions: false

Expand Down Expand Up @@ -54,9 +54,6 @@ Style/FormatStringToken:
Style/MixinUsage:
Enabled: false

Lint/ErbNewArguments:
Enabled: false

Style/DocumentDynamicEvalDefinition:
Enabled: false

Expand Down
88 changes: 46 additions & 42 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,81 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-02-16 16:08:54 -0800 using RuboCop version 0.29.0.
# This configuration was generated by
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
# using RuboCop version 1.88.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
Security/Eval:
Enabled: false

# Offense count: 2
# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Enabled: false
Exclude:
- 'lib/commander/user_interaction.rb'

# Offense count: 5
# Offense count: 6
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 30

# Offense count: 1
# Configuration parameters: CountComments.
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Enabled: false
Max: 250

# Offense count: 4
# Offense count: 5
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 13

# Offense count: 89
# Configuration parameters: AllowURI, URISchemes.
Layout/LineLength:
Max: 242

# Offense count: 7
# Configuration parameters: CountComments.
# Offense count: 8
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 36

# Offense count: 4
# Offense count: 5
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 14

# Offense count: 1
# Offense count: 2
Naming/AccessorMethodName:
Enabled: false

# Offense count: 18
Style/Documentation:
Enabled: false

# Offense count: 12
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Enabled: false
Exclude:
- 'lib/commander/core_ext/object.rb'
- 'lib/commander/help_formatters.rb'

# Offense count: 1
# Configuration parameters: MaxLineLength.
Security/Eval:
Exclude:
- 'lib/commander/delegates.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Enabled: false
Exclude:
- 'lib/commander/runner.rb'
- 'lib/commander/user_interaction.rb'

# Offense count: 1
Style/MultilineBlockChain:
Enabled: false
Exclude:
- 'lib/commander/user_interaction.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/MultilineTernaryOperator:
Enabled: false
Exclude:
- 'lib/commander/user_interaction.rb'

# Offense count: 5
# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Style/RescueModifier:
Enabled: false
Exclude:
- 'lib/commander/runner.rb'
- 'lib/commander/user_interaction.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
Style/TrivialAccessors:
Enabled: false
# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 242
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.6
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@
source 'https://rubygems.org'

gemspec

group :development, :test do
gem 'bundler-audit', '~> 0.9'
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.13'
gem 'rubocop', '~> 1.88'
# 1.x requires Ruby >= 3.2; allow the last 0.x on Ruby 3.1 while newer
# rubies still resolve to 1.x.
gem 'simplecov', '>= 0.22', '< 2'
end
38 changes: 0 additions & 38 deletions Manifest

This file was deleted.

39 changes: 7 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[<img src="https://api.travis-ci.org/commander-rb/commander.svg" alt="Build Status" />](https://travis-ci.org/commander-rb/commander)
[![Inline docs](https://inch-ci.org/github/commander-rb/commander.svg)](https://inch-ci.org/github/commander-rb/commander)
[![CI](https://github.com/commander-rb/commander/actions/workflows/ci.yml/badge.svg)](https://github.com/commander-rb/commander/actions/workflows/ci.yml)

# Commander

Expand All @@ -24,9 +23,12 @@ features, and an elegant API.
* Sexy paging for long bodies of text
* Support for MacOS text-to-speech
* Command aliasing (very powerful, as both switches and arguments can be used)
* Growl notification support for MacOS
* Use the `commander` executable to initialize a commander driven program

## Requirements

Ruby >= 3.1 (tested through Ruby 4.0).

## Installation

$ gem install commander
Expand All @@ -50,7 +52,6 @@ as well as an object, specifying a method to call, so view the RDoc for more inf
### Classic style

```ruby
require 'rubygems'
require 'commander/import'

# :name is optional, otherwise uses the basename of this executable
Expand Down Expand Up @@ -93,7 +94,6 @@ $ foobar bar --suffix '}' --prefix '{'
**NOTE:** Make sure to use `require 'commander'` rather than `require 'commander/import'`, otherwise Commander methods will still be imported into the global namespace.

```ruby
require 'rubygems'
require 'commander'

class MyApplication
Expand Down Expand Up @@ -122,7 +122,6 @@ MyApplication.new.run if $0 == __FILE__
### Block style

```ruby
require 'rubygems'
require 'commander'

Commander.configure do
Expand Down Expand Up @@ -240,30 +239,6 @@ else
end
```

## Growl Notifications

Commander provides methods for displaying Growl notifications. To use these
methods you need to install https://github.com/tj/growl which utilizes
the [growlnotify](https://growl.info/extras.php#growlnotify) executable. Note that
growl is auto-imported by Commander when available, no need to require.

```ruby
# Display a generic Growl notification
notify 'Something happened'

# Display an 'info' status notification
notify_info 'You have #{emails.length} new email(s)'

# Display an 'ok' status notification
notify_ok 'Gems updated'

# Display a 'warning' status notification
notify_warning '1 gem failed installation'

# Display an 'error' status notification
notify_error "Gem #{name} failed"
```

## Commander Goodies

### Option Defaults
Expand Down Expand Up @@ -459,11 +434,11 @@ For feature rich ASCII tables for your terminal app check out the terminal-table

## Running Specifications

$ rake spec
$ bundle exec rake spec

OR

$ spec --color spec
$ bundle exec rspec

## Contrib

Expand Down
11 changes: 3 additions & 8 deletions commander.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ Gem::Specification.new do |s|
'documentation_uri' => "https://www.rubydoc.info/gems/commander/#{s.version}",
'homepage_uri' => s.homepage,
'source_code_uri' => "#{s.homepage}/tree/v#{s.version}",
'rubygems_mfa_required' => 'true',
}
s.required_ruby_version = '>= 3.0'
s.required_ruby_version = '>= 3.1'

s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|spec|features)/}) }
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ['lib']

s.add_runtime_dependency('highline', '~> 3.0.0')

s.add_development_dependency('rake')
s.add_development_dependency('rspec', '~> 3.2')
s.add_development_dependency('rubocop', '~> 1.12.1')
s.add_development_dependency('simplecov')
s.add_dependency('highline', '~> 3.1')
end
Loading
Loading