Skip to content

Commit

Permalink
Add github actions testing (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowe2010 authored Jun 25, 2023
1 parent 09ac4be commit 953f42f
Show file tree
Hide file tree
Showing 38 changed files with 400 additions and 299 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish Gem

on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Release Gem
if: contains(github.ref, 'refs/tags/v')
uses: cadwallion/publish-rubygems-action@master
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
RELEASE_COMMAND: rake release
28 changes: 28 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Ruby

on:
push:
branches:
- master

pull_request:

jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.1.2'

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

- name: Run the default task
run: bundle exec rake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,5 @@ build-iPhoneSimulator/

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

.idea/
7 changes: 0 additions & 7 deletions .idea/.rakeTasks

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/ThorsAutocomplete.iml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

22 changes: 21 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
inherit_from: .rubocop_todo.yml

Layout/EndOfLine:
EnforcedStyle: lf
Metrics/LineLength:
Max: 100
Max: 100

AllCops:
TargetRubyVersion: 2.6

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

Layout/LineLength:
Max: 120

require:
- rubocop-rake
- rubocop-minitest
60 changes: 60 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-02-19 19:37:36 UTC using RuboCop version 1.45.1.
# 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: 1
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'fylla.gemspec'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 182

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 24

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 310

# Offense count: 23
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 168

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Metrics/ParameterLists:
Max: 6

# Offense count: 5
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/fylla/completion_extension.rb'
- 'lib/fylla/parsed_command.rb'
- 'lib/fylla/parsed_option.rb'
- 'lib/fylla/parsed_subcommand.rb'
- 'lib/fylla/thor/extensions/comma_array_extension.rb'

# Offense count: 25
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.1.2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.5.2

Fix deprecation warnings in ERB
Switch deploy to GitHub Actions

# 0.5.1

* Fix completions for string enums, only complete a single arg, rather than multiple
Expand Down
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
source 'https://rubygems.org'
# frozen_string_literal: true

# Specify your gem's dependencies in Fylla.gemspec
source "https://rubygems.org"

# Specify your gem's dependencies in foodie.gemspec
gemspec
18 changes: 12 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
require 'bundler/gem_tasks'
require 'rake/testtask'
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['test/**/*_test.rb']
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end

task default: :test
require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[test rubocop]
6 changes: 3 additions & 3 deletions bin/console
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby

require 'bundler/setup'
require 'fylla'
require "bundler/setup"
require "fylla"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -10,5 +10,5 @@ require 'fylla'
# require "pry"
# Pry.start

require 'irb'
require "irb"
IRB.start(__FILE__)
2 changes: 1 addition & 1 deletion exe/fylla
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby

require 'fylla'
require "fylla"
45 changes: 23 additions & 22 deletions fylla.gemspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
lib = File.expand_path('lib', __dir__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fylla/version'
require "fylla/version"

# rubocop:disable BlockLength
Gem::Specification.new do |spec|
spec.name = 'fylla'
spec.name = "fylla"
spec.version = Fylla::VERSION
spec.authors = ['Tyler Thrailkill']
spec.email = ['[email protected]']
spec.authors = ["Tyler Thrailkill"]
spec.email = ["[email protected]"]

spec.summary = 'Adds functions for generating autocomplete scripts for Thor applications'
spec.description = 'Fylla generates zsh and bash autocomplete scripts for Thor CLI applications.'
spec.homepage = 'https://github.com/snowe2010/fylla'
spec.license = 'MIT'
spec.summary = "Adds functions for generating autocomplete scripts for Thor applications"
spec.description = "Fylla generates zsh and bash autocomplete scripts for Thor CLI applications."
spec.homepage = "https://github.com/snowe2010/fylla"
spec.license = "MIT"

spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
spec.metadata['changelog_uri'] = 'https://github.com/snowe2010/fylla/blob/master/CHANGELOG.md'
spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
spec.metadata["changelog_uri"] = "https://github.com/snowe2010/fylla/blob/master/CHANGELOG.md"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand All @@ -25,15 +24,17 @@ Gem::Specification.new do |spec|
end
end

spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f)}
spec.require_paths = ['lib']
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'codecov', '~> 0.1.14'
spec.add_development_dependency 'minitest', '~> 5.0'
spec.add_development_dependency 'minitest-hooks', '~> 1.5.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_dependency 'thor', '>= 0.19.0'
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "codecov", "~> 0.1.14"
spec.add_development_dependency "minitest", "~> 5.0"
spec.add_development_dependency "minitest-hooks", "~> 1.5.0"
spec.add_development_dependency "rake", "~> 13"
spec.add_development_dependency "rubocop", "~> 1.21"
spec.add_development_dependency "rubocop-minitest", "~> 0.27.0"
spec.add_development_dependency "rubocop-rake", "~> 0.6.0"
spec.add_dependency "thor", ">= 0.19.0"
end
# rubocop:enable BlockLength
14 changes: 7 additions & 7 deletions lib/fylla.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'fylla/version'
require 'fylla/completion_generator'
require 'fylla/parsed_command'
require 'fylla/parsed_subcommand'
require 'fylla/completion_extension'
require 'fylla/thor/extensions/comma_array_extension'
require 'thor'
require "fylla/version"
require "fylla/completion_generator"
require "fylla/parsed_command"
require "fylla/parsed_subcommand"
require "fylla/completion_extension"
require "fylla/thor/extensions/comma_array_extension"
require "thor"

# We _must prepend before thor loads_ Ideally this is at require time...
::Thor::Option.prepend Fylla::Thor::Option
Expand Down
3 changes: 2 additions & 1 deletion lib/fylla/completion_extension.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'thor'
require "thor"

# add more options to Thor::Option
#
Expand All @@ -8,6 +8,7 @@ module Fylla
module Thor
module Option
attr_accessor :completion, :filter

def initialize(name, options = {})
@completion = options[:fylla]&.[](:completion)
@filter = options[:fylla]&.[](:filter)
Expand Down
Loading

0 comments on commit 953f42f

Please sign in to comment.