From d2efca732c13dbd69092100851536abf96157f6c Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 25 Jun 2022 14:49:22 -0400 Subject: [PATCH] Move ruby testing to GH Actions & fix linting --- .github/workflows/ruby.yml | 20 ++++++++++++++++++++ .travis.yml | 22 ---------------------- Gemfile.lock | 7 +++---- README.md | 1 + Rakefile | 2 +- bin/dots.rb | 2 +- bin/dotutils.rb | 5 +++-- 7 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/ruby.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..3da0831 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,20 @@ +name: Ruby +on: + pull_request: + +jobs: + ruby_testing: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' + ruby: ['2.6', '2.7', '3.0', '3.1'] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - run: bundle exec rake tests diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 02f0158..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: ruby -cache: bundler - -os: - - linux -# - osx - -rvm: - - 2.5 - - 2.6 - - 2.7 - -before_install: - - gem update --system - - gem --version - -script: 'bundle exec rake tests' - -notifications: - slack: - on_success: always - secure: "HLf1vdPyg/2ezvShnwmRRtkXXap2yrMCsbU9Ow2moIhdPfDBhecXBBUsZ7/9vkIq6aTjvNb40708Q72Ndhycr1v9BE4y1KGTxcid99IhRuQEBFKkJRQpRSAqUhKq46hgUb986alQ5NoxYfMgXIC9+HzQYkoM1TXVrS3+D0cqBpkjUGl5pBG2DCa6nyAVeXzmVcs4+xeEOhkblfE5I7mXiFO0/aVcUeo+TYwSwDslPWx8OFd2PJjuceLMM8B1iBk4zY47FMdveUSA4lDQAtYMantiJvUrAGcyOUNEQZ8AsvVHuYW4HL3h3dvKXy6DM9ejwYxSFIYYtDlfCvTkY/m5HPCXvwLjABxV1JGCNkVs2vhmiCcvKSt4T4IdPxoGnMiT0UljVke5SY16hYaHkoaBtuzkRqCkRjD+nyPH5Y90c4D0uhrlob9dmUS7RkRqIZRDoaPoNS2xfrIHyEpsaXYr4rY0gBVB+ILd1DWJPIyAjRURkOVxKg1+0Tslq3B1FLAMmW/SkqYTtek680I5r+BDPFA9Eo+hxYqpWed/j68imRy6x6ZvwjS0ku+TG1G4z3P0W0wbys31/uC0PRP6YRJt1APKYxzP13rMWc21LXJoUgFtu19PbaCG2tHeb2oEdWkv3ilbbpMogjkU0+lrBP3ZLSIduuEvDDC9kpQy6Nrea5Y=" diff --git a/Gemfile.lock b/Gemfile.lock index 28bb082..79cea3f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -195,7 +195,7 @@ GEM tty-screen (~> 0.8) wisper (~> 2.0) tty-screen (0.8.1) - unicode-display_width (2.1.0) + unicode-display_width (2.2.0) webrick (1.7.0) wisper (2.0.1) xmlrpc (0.3.2) @@ -204,8 +204,7 @@ GEM trollop (~> 2) PLATFORMS - ruby - x86_64-darwin-16 + x86_64-darwin-19 x86_64-linux DEPENDENCIES @@ -236,4 +235,4 @@ DEPENDENCIES yamllint (~> 0.0.9) BUNDLED WITH - 2.2.16 + 2.3.5 diff --git a/README.md b/README.md index eaaaaec..94c89ce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # dots [![Ansible Lint](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml) +[![Ruby](https://github.com/genebean/dots/actions/workflows/ruby.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ruby.yml) My dot files and a tool to deploy them, and the programs that use them, to various OS's. Some additional tools that I consider part of my baseline setup diff --git a/Rakefile b/Rakefile index 2c0be51..a7ce508 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,7 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' require 'tty-command' require 'yamllint/rake_task' -require_relative 'bin/rake_tasks.rb' +require_relative 'bin/rake_tasks' exclude_paths = [ 'pkg/**/*', diff --git a/bin/dots.rb b/bin/dots.rb index 360b5c7..a5de1f6 100755 --- a/bin/dots.rb +++ b/bin/dots.rb @@ -5,7 +5,7 @@ require 'os' require 'tty-command' require 'tty-file' require 'tty-prompt' -require_relative 'dotutils.rb' +require_relative 'dotutils' cmd = TTY::Command.new @prompt = TTY::Prompt.new(help_color: :magenta) diff --git a/bin/dotutils.rb b/bin/dotutils.rb index 086c27b..ba68079 100644 --- a/bin/dotutils.rb +++ b/bin/dotutils.rb @@ -19,10 +19,11 @@ end def rename_file(source, destination, action) puts "#{destination} exists, renaming to #{destination}.predots" File.rename(destination, "#{destination}.predots") - if action.eql?('link') + case action + when 'link' puts "Linking #{destination} to #{source}" File.symlink(source, destination) - elsif action.eql?('copy') + when 'copy' puts "Copying #{destination} to #{source}" FileUtils.cp_r(source, destination) else