Skip to content

Commit

Permalink
Merge pull request #16 from daveallie/ci
Browse files Browse the repository at this point in the history
Setup CI
  • Loading branch information
ghiculescu authored Jan 15, 2024
2 parents 3d80f73 + cabf037 commit 80d1c95
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

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

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake spec
- name: Lint
run: bundle exec rubocop
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ Style/HashTransformValues:

RSpec/ExampleLength:
Enabled: false

Gemspec/DevelopmentDependencies:
Enabled: false

Metrics/MethodLength:
Enabled: false
1 change: 1 addition & 0 deletions entangler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
spec.add_dependency 'listen', '~> 3.7'
spec.add_dependency 'to_regexp', '~> 0.2.1'
spec.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion lib/entangler/entangled_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create_parent_directory

def write_contents
delete_file if file_exists? && File.directory?(full_path)
File.open(full_path, 'w') { |f| f.write(contents) }
File.write(full_path, contents)
File.utime(File.atime(full_path), desired_modtime, full_path)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/entangler/executor/validation/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ def validate_remote_entangler_version

res = `#{generate_ssh_command('entangler --version', source_rvm: true)}`
if res.empty?
msg = 'Entangler is not installed on the remote server.' \
' Install Entangler on the remote server (SSH in, then `gem install entangler`), then try again.'
msg = 'Entangler is not installed on the remote server. ' \
'Install Entangler on the remote server (SSH in, then `gem install entangler`), then try again.'
raise Entangler::NotInstalledOnRemoteError, msg
end

remote_version = Gem::Version.new(res.strip)
local_version = Gem::Version.new(Entangler::VERSION)
return unless major_version_mismatch?(local_version, remote_version)

msg = 'Entangler version too far apart, please update either local or remote Entangler.' \
" Local version is #{local_version} and remote version is #{remote_version}."
msg = 'Entangler version too far apart, please update either local or remote Entangler. ' \
"Local version is #{local_version} and remote version is #{remote_version}."
raise Entangler::VersionMismatchError, msg
end

Expand Down
2 changes: 1 addition & 1 deletion spec/entangler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

describe Entangler do
it 'has a version number' do
expect(Entangler::VERSION).not_to be nil
expect(Entangler::VERSION).not_to be_nil
end
end

0 comments on commit 80d1c95

Please sign in to comment.