diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..35dc073 --- /dev/null +++ b/.github/dependabot.yml @@ -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: "-" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..394c64c --- /dev/null +++ b/.github/workflows/publish.yml @@ -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}}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b06b47b --- /dev/null +++ b/.github/workflows/test.yml @@ -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}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1c4bfe4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: ruby -rvm: - - 2.3.5 -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 - > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - "./cc-test-reporter before-build" -after_script: - - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT" -deploy: - provider: rubygems - api_key: - secure: k768r2hPxMuPFRK5vlU2z9ioXVyN1NTuvI6EnPmgPX89Ecag1Whlv2PckhI+xqq0t3ZIcm9Y2MpKXUYXPb5Bb6PjHc2SHFIA3UOReZetK/Ql7thAkcp7leh9jgCscgocRAXybRdA33TTERWJ8ZDQXS3cSRpMBnshW6wAwopyqxmjia0YKz1uOT4Cmxq/VNXMDuUr0CnIQ3M/X+vMV6l4SYRvhMSQJC6h9nYxBHClCVocVr4EHkGSoVPuCFjs/kC6c73V99P4xfBVnYQndqpYLT7zukOr77bHn1qomxV+gamPVXwlfYHbzBExqWlZWAV5oJPJNuxq8D1wPLoFSf2xls7cK5Y5y2iRljDEHid5J5Irf49jCerqrFknoIFO/a3iPA50c+63zCid5mAbvYYK0nW4p9VRp8mkJKN86L5Xa1yySCqOItvJnarkxOL5tWNZAUh3bw0+wAhO7QDv+bXCOxvQOiC7VfvoY9Ak+Q+D1Pr0AkmNO5Dn95oJ3gbrK6ddgC7+HHKiSSBoQPEnXnM2QDO9euQE7t70dSYmpmqDZWcG/4Fdvr91fpIxkln3FWumLvrUlCj6OFc5tSNFvU/sbYFO85eIItbodwVyRQPd59f4UF0LyQDJ0tTjYk+uM9wYO/mD5h/p6FAHWvWyuUQvkP0nE+fzyhjiklkhQCqwcUc= - gem: json_kit - on: - tags: true - repo: Sage/json_kit - condition: "$TRAVIS_RUBY_VERSION == 2.3.5" -env: - global: - secure: MkjV5fQ8XQA3qAfR1o0gZ4jAMYRyMWVRM582y/z4YYBN4fBI7Ec5QZgn7Y0IY/T1z0HmXYjoZV6eQ0N8bIqOnX2F/pRcY1WAz4EFziJtXhph+BpwZgyw42PH2EWjjbMX3EPf4udjXZKTowqiqmzIoM9d3ztsusF2r438N7fyLA8aN5JubR7pTffjh52Z9XpMuBgHmFoFNeBZmjDR1fTMp5VAFx1VazgMDGpVup8C6IKUMhXadIyTwwlnYFnVJhWIJf5fVzf61SqQYWfFQVXfR/bGPfgPqCYPkxTNrIzbqisH1dBMYzFvuVvT55f7Ev0yWYC3eH64nkzvGLentRAs8K8n9fobZzu4M6QOcILX0m8SaTa4c2b1n5NIHumluXrJHhL3GWvo/CmfbfCspkZpz9uoTMKODlHnqb+kr4QQ7DsmrsCTHaePiu3jhsos/NJFVQYxHbi8OAUTgSVmA/1Ql7ciVjTS5VRMEN++vU64Ym0P0gtzPUtGAPnLW9GkEj+b8lb8VFWY1ebm+skyywzNCtv0cJnMWo08UeeRUi5JAsevbhUtuYHOI4EhvNx3rgeShFPBYFUU9jbgRhYcQnXzl76APAUAxIWIMJlqJ1+pM5JAOeThCJP3Stx2QktchoevbKrVU3WFhLCFuKPtY1TQF1jeK2f6uvXmmFvzXCJHytI= diff --git a/README.md b/README.md index 3705f97..fef7e48 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/json_kit.gemspec b/json_kit.gemspec index ba32de2..21f222d 100644 --- a/json_kit.gemspec +++ b/json_kit.gemspec @@ -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' diff --git a/lib/json_kit/helper.rb b/lib/json_kit/helper.rb index 0b50ac2..edb1292 100644 --- a/lib/json_kit/helper.rb +++ b/lib/json_kit/helper.rb @@ -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) @@ -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 @@ -64,4 +64,4 @@ def convert_array(array) end end -end \ No newline at end of file +end diff --git a/lib/json_kit/version.rb b/lib/json_kit/version.rb index aad0917..c872cea 100644 --- a/lib/json_kit/version.rb +++ b/lib/json_kit/version.rb @@ -1,3 +1,3 @@ module JsonKit - VERSION = "0.1.5" + VERSION = "1.0.0" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0380d2b..68152d9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,8 @@ require 'simplecov' +require 'simplecov_json_formatter' + +SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter + SimpleCov.start do add_filter 'spec/' end