Skip to content

Commit

Permalink
Feat: update dtg to latest version 6.0.0 and resolve active_support i…
Browse files Browse the repository at this point in the history
…mport changes (works without rails now)
  • Loading branch information
optimizasean committed Nov 28, 2023
1 parent e8d54d0 commit a3ece58
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 55 deletions.
2 changes: 0 additions & 2 deletions .coveralls.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/codeclimate-push.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/gem-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Ruby Gem
name: Ruby Test

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.5.5
ruby-3.2.2
89 changes: 51 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions dtg.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/dtg/active_support/time_with_zone_ext.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_relative '../date_time_group'
require 'active_support'
require 'active_support/time'

class ActiveSupport::TimeWithZone
Expand Down
1 change: 1 addition & 0 deletions lib/dtg/date_time_ext.rb
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
4 changes: 2 additions & 2 deletions lib/dtg/date_time_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/dtg/time_ext.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_relative 'date_time_group'
require 'active_support'
require 'active_support/core_ext/time'

class Time
Expand Down
2 changes: 1 addition & 1 deletion lib/dtg/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Dtg
# DTG version of gem
VERSION = '5.0.0'
VERSION = '6.0.0'
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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!
Expand Down

0 comments on commit a3ece58

Please sign in to comment.