Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General maintenance and updates #32

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,36 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', head]
ruby: ['3.1', '3.2', '3.4', head]
test_task: ['tests']
includes:
- ruby: head
test_task: 'spec'
excludes:
- ruby: head
test_task: 'tests'
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || endsWith(matrix.ruby, 'jruby') }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake
- run: bundle exec rake ${{ matrix.test_task }}
coverage:
needs: [ test ]
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true
- run: bundle exec rake
env:
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.CUCUMBER_PUBLISH_TOKEN }}
- uses: paambaati/codeclimate-action@v3.2.0
- uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
Expand Down
12 changes: 10 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
require: rubocop-rspec
require:
- rubocop-rspec
- rubocop-performance
- rubocop-rake

AllCops:
TargetRubyVersion: 2.6
NewCops: enable

Style/EmptyLiteral:
Enabled: false

Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec

Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.2
3.1.2
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Test Coverage](https://codeclimate.com/github/sugarcrm/sugar_utils/badges/coverage.svg)](https://codeclimate.com/github/sugarcrm/sugar_utils/coverage)
[![License](http://img.shields.io/badge/license-Apache2-green.svg?style=flat)](LICENSE)

[![RubyDoc](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://rubydoc.org/gems/sugar_utils)
[![RubyDoc](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](https://rubydoc.info/gems/sugar_utils)
[![CucumberReports: sugar_utils](https://messages.cucumber.io/api/report-collections/7a992611-6430-4ca9-ae77-aa071ba60c8b/badge)](https://reports.cucumber.io/report-collections/7a992611-6430-4ca9-ae77-aa071ba60c8b)

Utility methods extracted from SugarCRM Ruby projects.
Expand Down Expand Up @@ -71,7 +71,7 @@ Links to other places on the web where this projects exists:
* [Github](https://github.com/sugarcrm/sugar_utils)
* [Kandi](https://kandi.openweaver.com/ruby/sugarcrm/sugar_utils)
* [OpenHub](https://www.openhub.net/p/sugar_utils)
* [RubyDoc](http://rubydoc.org/gems/sugar_utils)
* [RubyDoc](https://rubydoc.info/gems/sugar_utils)
* [RubyGems](https://rubygems.org/gems/sugar_utils)
* [Ruby LibHunt](https://ruby.libhunt.com/sugar_utils-alternatives)
* [Ruby Toolbox](https://www.ruby-toolbox.com/projects/sugar_utils)
Expand All @@ -88,4 +88,4 @@ See [CONTRIBUTING](CONTRIBUTING.md) for how you can contribute changes back into

## Acknowledgements

Copyright 2019 [SugarCRM Inc.](http://sugarcrm.com), released under the Apache2 License.
Copyright 2025 [SugarCRM Inc.](http://sugarcrm.com), released under the [Apache2 License](https://www.apache.org/licenses/LICENSE-2.0.html).
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ task 'bundle:outdated' do
sh("bundle outdated --only-explicit | tee #{bundle_outdated_report_pathname}")
end

task tests: %i[spec features]

task default: %i[spec features rubocop yard yardstick_measure bundle:audit license_finder]
8 changes: 4 additions & 4 deletions features/read_json_file.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Scenario: Read an existing file

puts SugarUtils::File.read_json('test.json')
"""
Then the output should contain:
Then the output should match:
"""
{"key"=>"value"}
{"key"\s*=>\s*"value"}
"""

Scenario: Read an existing file and scurb encoding errors
Expand All @@ -37,7 +37,7 @@ Scenario: Read an existing file and scurb encoding errors
File.write('test.json', %({\"key\":\"foo\\x92bar\\x93\"}))
puts SugarUtils::File.read_json('test.json', scrub_encoding: true)
"""
Then the output should contain:
Then the output should match:
"""
{"key"=>"foobar"}
{"key"\s*=>\s*"foobar"}
"""
6 changes: 3 additions & 3 deletions spec/sugar_utils/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

before do
allow(Timeout).to receive(:timeout).with(expected_timeout).and_yield
expect(file).to receive(:flock).with(::File::LOCK_SH)
expect(file).to receive(:flock).with(File::LOCK_SH)
end

inputs :options, :expected_timeout
Expand All @@ -26,7 +26,7 @@

before do
allow(Timeout).to receive(:timeout).with(expected_timeout).and_yield
expect(file).to receive(:flock).with(::File::LOCK_EX)
expect(file).to receive(:flock).with(File::LOCK_EX)
end

inputs :options, :expected_timeout
Expand Down Expand Up @@ -559,7 +559,7 @@ def expect_not_to_raise_error
#
# @return [void]
def write(filename, content, perm = nil)
FileUtils.mkdir_p(::File.dirname(filename))
FileUtils.mkdir_p(File.dirname(filename))
File.write(filename, content)
FileUtils.chmod(perm, filename) if perm
end
Expand Down
15 changes: 9 additions & 6 deletions sugar_utils.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,30 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files -z`.split("\x0")
spec.require_paths = ['lib']

spec.required_ruby_version = '>= 2.6.0'
spec.required_ruby_version = '>= 3.1.2'

spec.metadata['rubygems_mfa_required'] = 'true'

spec.add_dependency 'multi_json', '~> 1.0'
spec.add_dependency 'solid_assert', '~> 1.0'

spec.add_development_dependency 'aruba', '~> 2.0'
spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'cucumber', '~> 8.0'
spec.add_development_dependency 'fakefs', '~> 1.0'
spec.add_development_dependency 'cucumber', '~> 9.0'
spec.add_development_dependency 'fakefs', '~> 3.0'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.8'
spec.add_development_dependency 'rspec-side_effects', '~> 0.2.0'
spec.add_development_dependency 'rspec-tabular', '~> 0.3.0'
spec.add_development_dependency 'rspec-side_effects', '~> 0.2'
spec.add_development_dependency 'rspec-tabular', '~> 0.3'

# Dependencies whose APIs we do not really depend upon, and can be upgraded
# without limiting.
spec.add_development_dependency 'bundler-audit'
spec.add_development_dependency 'irb'
spec.add_development_dependency 'license_finder'
spec.add_development_dependency 'logger'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-performance'
spec.add_development_dependency 'rubocop-rake'
spec.add_development_dependency 'rubocop-rspec'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'simplecov-lcov'
Expand Down
Loading