From a3ece5881984db54e021089b43dfd72fca7984c6 Mon Sep 17 00:00:00 2001 From: optimizasean Date: Mon, 27 Nov 2023 15:51:13 -1000 Subject: [PATCH] Feat: update dtg to latest version 6.0.0 and resolve active_support import changes (works without rails now) --- .coveralls.yml | 2 - .github/workflows/codeclimate-push.yml | 5 -- .github/workflows/coveralls.yml | 26 ++++++ .github/workflows/gem-test.yml | 2 +- .ruby-version | 2 +- Gemfile.lock | 89 +++++++++++--------- dtg.gemspec | 8 +- lib/dtg/active_support/time_with_zone_ext.rb | 1 + lib/dtg/date_time_ext.rb | 1 + lib/dtg/date_time_group.rb | 4 +- lib/dtg/time_ext.rb | 1 + lib/dtg/version.rb | 2 +- spec/spec_helper.rb | 2 +- 13 files changed, 90 insertions(+), 55 deletions(-) delete mode 100644 .coveralls.yml delete mode 100644 .github/workflows/codeclimate-push.yml create mode 100644 .github/workflows/coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index bf5af4f..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,2 +0,0 @@ -service_name: travis-pro -repo_token: iUOMWTixWuZw2STOVeE8oagMM9m022kdM diff --git a/.github/workflows/codeclimate-push.yml b/.github/workflows/codeclimate-push.yml deleted file mode 100644 index 32cdf89..0000000 --- a/.github/workflows/codeclimate-push.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Code Climate Test Reporter - uses: aktions/codeclimate-test-reporter@v1 - with: - codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }} - command: after-build diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 0000000..9be9d8d --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,26 @@ +on: ["push", "pull_request"] + +name: Test Coveralls + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + + - name: Use Ruby + uses: ruby/setup-ruby@v1 + # Not required with .ruby-version file + # with: + # ruby-version: '3.2.2' + + - name: bundle install and rspec test + run: | + bundle install + bundle exec rspec + + - name: Coveralls + uses: coverallsapp/github-action@v2 diff --git a/.github/workflows/gem-test.yml b/.github/workflows/gem-test.yml index bde5a5b..ce32305 100644 --- a/.github/workflows/gem-test.yml +++ b/.github/workflows/gem-test.yml @@ -1,4 +1,4 @@ -name: Ruby Gem +name: Ruby Test on: push: diff --git a/.ruby-version b/.ruby-version index 80d02f9..9e79f6c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.5.5 +ruby-3.2.2 diff --git a/Gemfile.lock b/Gemfile.lock index 2f69527..f838103 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,79 +1,92 @@ PATH remote: . specs: - dtg (5.0.0) - activesupport + dtg (6.0.0) + activesupport (~> 7.0.8) GEM remote: https://rubygems.org/ specs: - activesupport (7.1.2) - base64 - bigdecimal + abbrev (0.1.1) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) - connection_pool (>= 2.2.5) - drb i18n (>= 1.6, < 2) minitest (>= 5.1) - mutex_m tzinfo (~> 2.0) - base64 (0.2.0) - bigdecimal (3.1.4) concurrent-ruby (1.2.2) - connection_pool (2.4.1) coveralls (0.8.23) json (>= 1.8, < 3) simplecov (~> 0.16.1) term-ansicolor (~> 1.3) thor (>= 0.19.4, < 2.0) tins (~> 1.6) - diff-lcs (1.3) - docile (1.3.2) - drb (2.2.0) - ruby2_keywords + diff-lcs (1.5.0) + docile (1.4.0) + haml (6.2.3) + temple (>= 0.8.2) + thor + tilt i18n (1.14.1) concurrent-ruby (~> 1.0) - json (2.3.1) + json (2.6.3) minitest (5.20.0) - mutex_m (0.2.0) - prettier (0.15.0) - rake (13.0.1) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.5) + prettier (4.0.2) + syntax_tree (>= 4.0.1) + syntax_tree-haml (>= 2.0.0) + syntax_tree-rbs (>= 0.2.0) + prettier_print (1.2.1) + rake (13.1.0) + rbs (3.3.2) + abbrev + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.2) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.3) - ruby2_keywords (0.0.5) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) + sync (0.5.0) + syntax_tree (6.2.0) + prettier_print (>= 1.2.0) + syntax_tree-haml (4.0.3) + haml (>= 5.2) + prettier_print (>= 1.2.1) + syntax_tree (>= 6.0.0) + syntax_tree-rbs (1.0.0) + prettier_print + rbs + syntax_tree (>= 2.0.1) + temple (0.10.3) term-ansicolor (1.7.1) tins (~> 1.0) - thor (0.20.3) - tins (1.21.1) + thor (1.3.0) + tilt (2.3.0) + tins (1.32.1) + sync tzinfo (2.0.6) concurrent-ruby (~> 1.0) PLATFORMS - ruby + x86_64-darwin-21 DEPENDENCIES - bundler (~> 1.17) + bundler (~> 2.4.22) coveralls dtg! prettier - rake (~> 13.0) - rspec (~> 3.0) + rake (~> 13.1.0) + rspec (~> 3.12.0) BUNDLED WITH - 1.17.3 + 2.4.22 diff --git a/dtg.gemspec b/dtg.gemspec index 6256af1..b30e58b 100644 --- a/dtg.gemspec +++ b/dtg.gemspec @@ -51,14 +51,14 @@ Gem::Specification.new do |spec| spec.require_paths = %w[lib] # Active support is necessary for ActiveSupport::TimeWithZone integration - spec.add_dependency 'activesupport' + spec.add_dependency 'activesupport', '~> 7.0.8' # Bundler to manage gems ad versions - spec.add_development_dependency 'bundler', '~> 1.17' + spec.add_development_dependency 'bundler', '~> 2.4.22' # Rake to run tasks - spec.add_development_dependency 'rake', '~> 13.0' + spec.add_development_dependency 'rake', '~> 13.1.0' # RSpec for testing suite - spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'rspec', '~> 3.12.0' # Prettier for better formatting spec.add_development_dependency 'prettier' # Coveralls for test suite reporting diff --git a/lib/dtg/active_support/time_with_zone_ext.rb b/lib/dtg/active_support/time_with_zone_ext.rb index a959968..9e5c222 100644 --- a/lib/dtg/active_support/time_with_zone_ext.rb +++ b/lib/dtg/active_support/time_with_zone_ext.rb @@ -1,4 +1,5 @@ require_relative '../date_time_group' +require 'active_support' require 'active_support/time' class ActiveSupport::TimeWithZone diff --git a/lib/dtg/date_time_ext.rb b/lib/dtg/date_time_ext.rb index 375d010..1d4b89a 100644 --- a/lib/dtg/date_time_ext.rb +++ b/lib/dtg/date_time_ext.rb @@ -1,5 +1,6 @@ require_relative 'date_time_group' require 'date' +require 'active_support' require 'active_support/core_ext/date' # require "active_support/core_ext/date_and_time" diff --git a/lib/dtg/date_time_group.rb b/lib/dtg/date_time_group.rb index de26f50..4706142 100644 --- a/lib/dtg/date_time_group.rb +++ b/lib/dtg/date_time_group.rb @@ -54,7 +54,7 @@ def self.from_dtg(dtg) year += year_temp - year_temp % 100 end zone = UTC_ZONES[dtg_hash[:zone].downcase.to_sym].to_s - if zone.blank? + if zone.nil? | zone.strip.empty? zone = '+00:00' elsif zone == 'UTC' zone = '+00:00' @@ -76,7 +76,7 @@ def self.from_dtg(dtg) end # Change will convert a DTG into a different zone with respect to its zone code - def self.convert(dtg, zone = :w) + def self.convert(dtg, zone = :z) old = from_dtg(dtg) old.to_dtg(zone) end diff --git a/lib/dtg/time_ext.rb b/lib/dtg/time_ext.rb index 50e66d2..42d568d 100644 --- a/lib/dtg/time_ext.rb +++ b/lib/dtg/time_ext.rb @@ -1,4 +1,5 @@ require_relative 'date_time_group' +require 'active_support' require 'active_support/core_ext/time' class Time diff --git a/lib/dtg/version.rb b/lib/dtg/version.rb index 46ba79d..9a7326c 100644 --- a/lib/dtg/version.rb +++ b/lib/dtg/version.rb @@ -1,4 +1,4 @@ module Dtg # DTG version of gem - VERSION = '5.0.0' + VERSION = '6.0.0' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a8eba53..4cf6cf2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ # Coveralls Configuration -if ENV['TRAVIS'] +if ENV['GITHUB_TEST'] # When running in Travis, report coverage stats to Coveralls. require 'coveralls' Coveralls.wear!