Skip to content

Commit

Permalink
add rubocop, apply fixes, push with bundler, prep for new release
Browse files Browse the repository at this point in the history
  • Loading branch information
matthutchinson committed Dec 29, 2024
1 parent 3bdf303 commit 44e95a3
Show file tree
Hide file tree
Showing 17 changed files with 130 additions and 136 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/build.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI
permissions:
contents: read

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
rubocop:
name: RuboCop
runs-on: ubuntu-latest
env:
BUNDLE_ONLY: rubocop
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
bundler-cache: true
- name: Run Rubocop
run: bundle exec rubocop --parallel
test:
name: ${{ format('Unit tests (Ruby {0})', matrix.ruby-version) }}
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version:
- "3.1"
- "3.2"
- "3.3"
- "3.4"
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Configure Git
run: |
git config --global user.name $NAME
git config --global user.email $EMAIL
env:
NAME: "George Costanza"
EMAIL: "[email protected]"
- name: Run tests
run: bundle exec rake test
25 changes: 0 additions & 25 deletions .github/workflows/push_gem.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .quickhook/pre-commit/ruby-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
set -e
grep -E "\.rb$|Rakefile|Gemfile" | xargs ./bin/rubocop --config .rubocop.yml --force-exclusion
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inherit_gem:
rubocop-rails-omakase: rubocop.yml
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ project adheres to [Semantic Versioning][Semver].

- Your contribution here!

## [0.5.1] - 2024-12-29
### Changed
- Push gems with bundler (not GitHub actions)
- Updated documentation links

## [0.5.0] - 2024-09-24
### Removed
- Support for Ruby < 3.1 (older rubies no longer supported)
Expand Down Expand Up @@ -68,7 +73,8 @@ project adheres to [Semantic Versioning][Semver].
### Changed
- Initial release

[Unreleased]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.5.0...HEAD
[Unreleased]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.5.1...HEAD
[0.5.1]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.2.0...v0.3.0
Expand All @@ -82,4 +88,3 @@ project adheres to [Semantic Versioning][Semver].
[0.0.2]: https://github.com/lolcommits/lolcommits-term_output/compare/v0.0.1...v0.0.2
[0.0.1]: https://github.com/lolcommits/lolcommits-term_output/compare/0251ee8...v0.0.1
[KeepAChangelog]: http://keepachangelog.com/en/1.0.0/
[Semver]: http://semver.org/spec/v2.0.0.html
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
source 'https://rubygems.org'
source "https://rubygems.org"
gemspec

group :rubocop do
gem "rubocop-rails-omakase", require: false
end
16 changes: 0 additions & 16 deletions PULL_REQUEST_TEMPLATE.md

This file was deleted.

42 changes: 19 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Lolcommits Term Output

[![Build](https://img.shields.io/github/actions/workflow/status/lolcommits/lolcommits-term_output/build.yml?branch=main&style=flat)](https://github.com/lolcommits/lolcommits-term_output/actions/workflows/build.yml)
[![CI](https://img.shields.io/github/actions/workflow/status/lolcommits/lolcommits-term_output/ci.yml?branch=main&style=flat&label=CI)](https://github.com/lolcommits/lolcommits-term_output/actions/workflows/ci.yml)
[![Gem](https://img.shields.io/gem/v/lolcommits-term_output.svg?style=flat)](http://rubygems.org/gems/lolcommits-term_output)
[![Depfu](https://img.shields.io/depfu/lolcommits/lolcommits-term_output.svg?style=flat)](https://depfu.com/github/lolcommits/lolcommits-term_output)

[lolcommits](https://lolcommits.github.io/) takes a snapshot with your
webcam every time you git commit code, and archives a lolcat style image
with it. Git blame has never been so much fun!
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your webcam
every time you git commit code, and archives a lolcat style image with it. Git
blame has never been so much fun!

This plugin uses the [inline
image](http://iterm2.com/documentation-images.html) feature available in
[iTerm2](http://iterm2.com/index.html) to display each lolcommit (images
only) in your terminal (after committing). For example:
This plugin uses the [inline image](http://iterm2.com/documentation-images.html)
feature available in [iTerm2](http://iterm2.com/index.html) to display each
lolcommit (images only) in your terminal (after committing). For example:

![iterm inline sample screenshot](./assets/images/sample.png)

Expand All @@ -34,19 +33,19 @@ Then configure to enable and set the remote endpoint:
$ lolcommits --config -p term_output
# set enabled to `true`

That's it! Your next lolcommit will be displayed within your terminal.
To disable use:
That's it! Your next lolcommit will be displayed within your terminal. To
disable use:

$ lolcommits --config -p term_output
# and set enabled to `false`

## Development

Check out this repo and run `bin/setup`, this will install all
dependencies and generate docs. Use `bundle exec rake` to run all tests.
Check out this repo and run `bin/setup`, this will install all dependencies and
generate docs. Use `bundle exec rake` to run all tests.

You can also run `bin/console` for an interactive prompt that will allow
you to experiment with the gem code.
You can also run `bin/console` for an interactive prompt that will allow you to
experiment with the gem code.

## Tests

Expand All @@ -63,17 +62,14 @@ Generate docs for this gem with:
## Troubles?

If you think something is broken or missing, please raise a new
[issue](https://github.com/lolcommits/lolcommits-term_output/issues).
Take a moment to check it hasn't been raised in the past (and possibly
closed).
[issue](https://github.com/lolcommits/lolcommits-term_output/issues). Take a
moment to check it hasn't been raised in the past (and possibly closed).

## Contributing

Bug
[reports](https://github.com/lolcommits/lolcommits-term_output/issues)
and [pull
requests](https://github.com/lolcommits/lolcommits-term_output/pulls)
are welcome on GitHub.
Bug [reports](https://github.com/lolcommits/lolcommits-term_output/issues) and
[pull requests](https://github.com/lolcommits/lolcommits-term_output/pulls) are
welcome on GitHub.

When submitting pull requests, remember to add tests covering any new behaviour,
and ensure all tests are passing on CI. Read the [contributing
Expand All @@ -93,7 +89,7 @@ The gem is available as open source under the terms of

## Links

* [CI](https://github.com/lolcommits/lolcommits-term_output/actions/workflows/build.yml)
* [CI](https://github.com/lolcommits/lolcommits-term_output/actions/workflows/ci.yml)
* [RDoc](http://rdoc.info/projects/lolcommits/lolcommits-term_output)
* [Issues](http://github.com/lolcommits/lolcommits-term_output/issues)
* [Report a bug](http://github.com/lolcommits/lolcommits-term_output/issues/new)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList["test/**/*_test.rb"]
end

task :default => ['test']
task default: [ 'test' ]
5 changes: 5 additions & 0 deletions bin/rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
load Gem.bin_path("rubocop", "rubocop")
17 changes: 8 additions & 9 deletions lib/lolcommits/plugin/term_output.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# frozen_string_literal: true

require 'base64'
require 'lolcommits/plugin/base'
require "base64"
require "lolcommits/plugin/base"

module Lolcommits
module Plugin
class TermOutput < Base

## Prompts the user to configure the plugin's options. The default
#superclass method will ask for the `enabled` option to be set.
# superclass method will ask for the `enabled` option to be set.
#
# @return [Hash] hash of configured options `{ enabled: true/false }`
# @return [Nil] if this terminal does not support this plugin
Expand All @@ -33,16 +32,16 @@ def configure_options!
def run_capture_ready
if terminal_supported?
if !runner.vcs_info || runner.vcs_info.repo.empty?
debug 'repo is empty, skipping term output'
debug "repo is empty, skipping term output"
elsif !image_path
debug 'lolcommit videos not supported'
debug "lolcommit videos not supported"
else
debug "rendering image in iTerm"
base64 = Base64.encode64(open(image_path, &:read).to_s)
puts "#{begin_escape}1337;File=inline=1:#{base64};alt=#{runner.message};#{end_escape}\n"
end
else
debug 'Terminal not supported (requires iTerm2)'
debug "Terminal not supported (requires iTerm2)"
end
end

Expand Down Expand Up @@ -89,7 +88,7 @@ def end_escape
# @return [Boolan] true when running within a Tmux session
#
def tmux?
!ENV['TMUX'].nil?
!ENV["TMUX"].nil?
end

##
Expand All @@ -98,7 +97,7 @@ def tmux?
# @return [Boolan] true when terminal identifies as iTerm
#
def terminal_supported?
ENV['TERM_PROGRAM'] =~ /iTerm/
ENV["TERM_PROGRAM"] =~ /iTerm/
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/lolcommits/term_output.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

require 'lolcommits/term_output/version'
require 'lolcommits/plugin/term_output'
require "lolcommits/term_output/version"
require "lolcommits/plugin/term_output"
2 changes: 1 addition & 1 deletion lib/lolcommits/term_output/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Lolcommits
module TermOutput
VERSION = "0.5.0".freeze
VERSION = "0.5.1".freeze
end
end
6 changes: 3 additions & 3 deletions lolcommits-term_output.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ require 'lolcommits/term_output/version'
Gem::Specification.new do |spec|
spec.name = "lolcommits-term_output"
spec.version = Lolcommits::TermOutput::VERSION
spec.authors = ["Matthew Hutchinson"]
spec.email = ["[email protected]"]
spec.authors = [ "Matthew Hutchinson" ]
spec.email = [ "[email protected]" ]
spec.summary = "Display lolcommits within your iTerm terminal"
spec.homepage = "https://github.com/lolcommits/lolcommits-term_output"
spec.license = "LGPL-3.0"
Expand All @@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
spec.test_files = `git ls-files -- {test,features}/*`.split("\n")
spec.bindir = "bin"
spec.executables = []
spec.require_paths = ["lib"]
spec.require_paths = [ "lib" ]

spec.required_ruby_version = ">= 3.1"

Expand Down
Loading

0 comments on commit 44e95a3

Please sign in to comment.