Skip to content

Commit

Permalink
Merge pull request #4 from Sage/ruby_32_support
Browse files Browse the repository at this point in the history
Ruby 3.2 support / CI replacement
  • Loading branch information
adamgeorgeson authored Jan 3, 2024
2 parents 4d8e919 + efe4bda commit f8ece35
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 28 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
registries:
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
pull-request-branch-name:
separator: "-"
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Gem
on:
release:
types:
- "created"

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- 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 json_kit.gemspec
gem push json_kit-*.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'

- name: Run tests
run: bundle install && bundle exec rspec

- name: Upload Coverage Report to CodeClimate
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ obj = helper.from_json(json, TestEntity, transforms)

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sage/hash_kit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Bug reports and pull requests are welcome on GitHub at https://github.com/sage/json_kit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.


## License
Expand Down
5 changes: 4 additions & 1 deletion json_kit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_development_dependency 'bundler', '~> 1.11'
spec.required_ruby_version = '>= 3.0.0'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'simplecov_json_formatter'

spec.add_dependency 'json'
spec.add_dependency 'hash_kit'
Expand Down
6 changes: 3 additions & 3 deletions lib/json_kit/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def initialize
end

def to_json(obj)
if [String, Fixnum, Numeric, Date, DateTime, Time, Integer, TrueClass, FalseClass].include?(obj.class)
if [String, Numeric, Date, DateTime, Time, Integer, TrueClass, FalseClass].include?(obj.class)
return obj
elsif obj.is_a?(Hash)
return JSON.dump(obj)
Expand All @@ -23,7 +23,7 @@ def from_json(json, klass = nil, transforms = [])

obj = JSON.parse(json)

if [String, Fixnum, Numeric, Date, DateTime, Time, Integer, TrueClass, FalseClass].include?(obj.class)
if [String, Numeric, Date, DateTime, Time, Integer, TrueClass, FalseClass].include?(obj.class)
return json
end

Expand Down Expand Up @@ -64,4 +64,4 @@ def convert_array(array)
end

end
end
end
2 changes: 1 addition & 1 deletion lib/json_kit/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module JsonKit
VERSION = "0.1.5"
VERSION = "1.0.0"
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
require 'simplecov'
require 'simplecov_json_formatter'

SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter

SimpleCov.start do
add_filter 'spec/'
end
Expand Down

0 comments on commit f8ece35

Please sign in to comment.