Skip to content

Commit

Permalink
Update to Ruby 2.7, all deps, migrate to GH actions.
Browse files Browse the repository at this point in the history
Copying changes from other project over at
https://github.com/nathankleyn/sliding_window to improve the ease with
which I can maintain this project!

Note this commit contains a crazy amount of changes to appease Rubocop.
  • Loading branch information
nathankleyn committed Dec 2, 2020
1 parent 9b65c53 commit ef00c1a
Show file tree
Hide file tree
Showing 49 changed files with 712 additions and 409 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish

on:
push:
tags:
- 'v*'

jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7

- name: Publish to GPR
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
OWNER: ${{ github.repository_owner }}

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rspec
- name: Run Rubocop
run: bundle exec rubocop
- name: Update Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
*.gem
.yardoc
doc/

/bin
/coverage
/doc
/tmp
/.bundle
/.yardoc
coverage
Gemfile.lock
*.gem
72 changes: 66 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,69 @@
LineLength:
Max: 120
require: rubocop-rspec

AllCops:
TargetRubyVersion: 2.7

MethodLength:
Max: 100
Layout/LineLength:
Enabled: true
Max: 120

Metrics/BlockLength:
Exclude:
- spec/**/*.rb
Enabled: true
Max: 300

Metrics/MethodLength:
Enabled: true
Max: 20

RSpec/ExampleLength:
Enabled: true
Max: 20

Metrics/AbcSize:
Enabled: true
Max: 20

Lint/DuplicateBranch:
Enabled: true

Lint/DuplicateRegexpCharacterClassElement:
Enabled: true

Lint/EmptyBlock:
Enabled: true

Lint/EmptyClass:
Enabled: true

Lint/NoReturnInBeginEndBlocks:
Enabled: true

Lint/ToEnumArguments:
Enabled: true

Lint/UnexpectedBlockArity:
Enabled: true

Lint/UnmodifiedReduceAccumulator:
Enabled: true

Style/ArgumentsForwarding:
Enabled: true

Style/CollectionCompact:
Enabled: true

Style/DocumentDynamicEvalDefinition:
Enabled: true

Style/NegatedIfElseCondition:
Enabled: true

Style/NilLambda:
Enabled: true

Style/RedundantArgument:
Enabled: true

Style/SwapValues:
Enabled: true
15 changes: 15 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require 'simplecov-lcov'

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end

SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter
]
)
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
148 changes: 73 additions & 75 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,110 +1,108 @@
PATH
remote: .
specs:
lego-nxt (0.2.0)
activesupport (~> 5.2.1)
lego-nxt (0.2.0.pre.1.pre.g83ce604)
activesupport (~> 6.0, >= 6.0.3.4)
libusb (~> 0.6.4)
serialport (~> 1.3.1)

GEM
remote: https://rubygems.org/
specs:
activesupport (5.2.1)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.4.0)
byebug (10.0.2)
coderay (1.1.2)
concurrent-ruby (1.0.5)
coveralls (0.8.22)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.4)
tins (~> 1.6)
diff-lcs (1.3)
docile (1.3.1)
ffi (1.9.25)
filewatcher (1.0.1)
trollop (~> 2.1, >= 2.1.2)
i18n (1.1.0)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.1)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
diff-lcs (1.4.4)
docile (1.3.2)
ffi (1.13.1)
filewatcher (1.1.1)
optimist (~> 3.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1)
json (2.1.0)
libusb (0.6.4)
ffi (~> 1.0)
mini_portile2 (~> 2.1)
method_source (0.9.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
parallel (1.12.1)
parser (2.5.1.2)
ast (~> 2.4.0)
powerpack (0.1.2)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
method_source (1.0.0)
mini_portile2 (2.5.0)
minitest (5.14.2)
optimist (3.0.1)
parallel (1.20.1)
parser (2.7.2.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rainbow (3.0.0)
redcarpet (3.4.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.1)
redcarpet (3.5.0)
regexp_parser (2.0.0)
rexml (3.2.4)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.0)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.58.2)
jaro_winkler (~> 1.5.1)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (1.5.0)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.0)
rexml
rubocop-ast (>= 1.2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.29.0)
rubocop (>= 0.58.0)
ruby-progressbar (1.10.0)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.3.0)
parser (>= 2.7.1.5)
rubocop-rspec (2.0.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.10.1)
serialport (1.3.1)
simplecov (0.16.1)
simplecov (0.20.0)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
term-ansicolor (1.6.0)
tins (~> 1.0)
thor (0.19.4)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.2)
thread_safe (0.3.6)
tins (1.16.3)
trollop (2.9.9)
tzinfo (1.2.5)
tzinfo (1.2.8)
thread_safe (~> 0.1)
unicode-display_width (1.4.0)
yard (0.9.16)
unicode-display_width (1.7.0)
yard (0.9.25)
zeitwerk (2.4.2)

PLATFORMS
ruby

DEPENDENCIES
coveralls (~> 0.8.22)
filewatcher (~> 1.0.1)
filewatcher (~> 1.1, >= 1.1.1)
lego-nxt!
pry-byebug (~> 3.6.0)
redcarpet (~> 3.4.0)
rspec (~> 3.8.0)
rubocop (~> 0.58.2)
rubocop-rspec (~> 1.29.0)
yard (~> 0.9.16)
pry-byebug (~> 3.9, >= 3.9.0)
redcarpet (~> 3.5, >= 3.5.0)
rspec (~> 3.10, >= 3.10.0)
rubocop (~> 1.4, >= 1.4.2)
rubocop-rspec (~> 2.0, >= 2.0.0)
simplecov (~> 0.20, >= 0.20.0)
simplecov-lcov (~> 0.8, >= 0.8.0)
yard (~> 0.9, >= 0.9.25)

BUNDLED WITH
1.16.3
2.1.4
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Lego NXT [![Gem Version](https://badge.fury.io/rb/lego-nxt.png)](http://badge.fury.io/rb/lego-nxt) [![Build Status](https://travis-ci.org/nathankleyn/lego-nxt.png)](https://travis-ci.org/nathankleyn/lego-nxt) [![Code Climate](https://codeclimate.com/github/nathankleyn/lego-nxt.png)](https://codeclimate.com/github/nathankleyn/lego-nxt) [![Coverage Status](https://coveralls.io/repos/nathankleyn/lego-nxt/badge.png)](https://coveralls.io/r/nathankleyn/lego-nxt) [![Dependency Status](https://gemnasium.com/nathankleyn/lego-nxt.png)](https://gemnasium.com/nathankleyn/lego-nxt)
# Lego NXT [![Build Status](https://github.com/nathankleyn/lego-nxt/workflows/Tests/badge.svg)](https://github.com/nathankleyn/lego-nxt/actions?query=workflow%3ATests) [![Coverage Status](https://coveralls.io/repos/github/nathankleyn/attr_combined_accessor/badge.svg?branch=master)](https://coveralls.io/github/nathankleyn/lego-nxt?branch=master) [![RubyGems Version](https://img.shields.io/gem/v/lego-nxt.svg)](https://rubygems.org/gems/lego-nxt)

> **This gem is under heavy development!** A lot of the below code may not work, and is certainly not guranteed to be reliable if it does! If you need to base a working project on this, I recommend [going back to the `ruby-nxt` gem this work is inspired by](https://github.com/zuk/ruby-nxt) for the time being.
Expand Down Expand Up @@ -108,12 +108,4 @@ In addition to this, you might find the tests quite helpful. There are currently

## License

The MIT License

Copyright (c) 2014 Nathan Kleyn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This project is licensed [via MIT license](LICENSE).
Loading

0 comments on commit ef00c1a

Please sign in to comment.