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

[SR-1397] Incorporate unused 0.8.2 improvements #11

Draft
wants to merge 43 commits into
base: 0-8-stable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
81788e0
Failing test cases for issues #36, #45 and #83
dugjason Oct 19, 2015
812482e
Resolution attempt for issues #36, #45 and #83. Ensure we wind to beg…
dugjason Oct 19, 2015
99cdb1e
Trivial refactoring suggested by Rubocop
dugjason Oct 19, 2015
ed889d9
Enable tests to run on new (much faster) Travis architecture
dugjason Oct 20, 2015
0f40a40
Adds support for inclusive results from business_days_until() method
dugjason Nov 15, 2015
35aaacb
Add examples for `#workday?`
ramontayag Dec 10, 2015
96191e3
Changing the license to reflect that its now 2016 and I still care
bokmann Jan 15, 2016
95e1010
Update bundler before travis
Jan 27, 2016
731dac8
Merge pull request #120 from dugjason/feature/issue-83
bokmann Feb 3, 2016
a07a0ac
Merge pull request #122 from aelogica/readme_workday
bokmann Feb 3, 2016
791fc05
Merge pull request #123 from crowdworks/fix_bundler
bokmann Feb 3, 2016
11095ec
Merge pull request #121 from dugjason/feature/inclusive-business_days…
bokmann Feb 3, 2016
43f637f
adding ruby 2.3.0 to the travis build
bokmann Mar 10, 2016
7488cc3
updating the contributor code of conduct.
bokmann Mar 10, 2016
26afba9
adding my email address to the code of conduct
bokmann Mar 10, 2016
dfb7cd7
Adds the gitmessage to the repo.
bokmann Mar 10, 2016
4c468bd
Revises the copyright dates in the license
bokmann Mar 22, 2016
0351d3d
adds a better email address for me to the gemspec.
bokmann Apr 5, 2016
fb4cab3
Updates copyright.
bokmann Apr 5, 2016
a866119
Updates Activesupport version and internal version prepping for release.
bokmann Apr 5, 2016
6a8a483
Merge pull request #127 from bokmann/feature/copyright_update
bokmann Apr 5, 2016
5e799df
Fix timezone inconsistencies
Jun 9, 2016
700fa15
Merge pull request #134 from bazzargh/tzfix
bokmann Jun 9, 2016
6a38817
updates changelog to reflect the change bazzargh contributed.
bokmann Jun 9, 2016
c16e018
bumping version in prep for release
bokmann Jun 9, 2016
a7f1b04
mend
bokmann Jun 9, 2016
040ca0b
Merge commit 'a7f1b04adb2542593a4c29421c397f00e5c5bf60' into feature/…
dlozano Aug 2, 2016
e2ffff2
Added collaborator to gemspec
dlozano Aug 4, 2016
0789e87
Merge pull request #4 from kantox/feature/PT-3440-merge-official-develop
dlozano Aug 8, 2016
560b2e3
Parse holidays on config loading
dlozano Jul 28, 2016
6fde2be
Refactor load_holidays methods. No more accept_parsing
dlozano Aug 4, 2016
484ef39
Unify enumerable specifics inside Config
dlozano Aug 4, 2016
e8f241c
Refactor #workday?. Memory efficient, and probably CPU efficient
dlozano Aug 4, 2016
8dddf1d
Perf improvement: n less objects + n less Hash#merge
dlozano Aug 4, 2016
3d668ad
Removed after action in test
dlozano Aug 8, 2016
e8f0113
Merge pull request #3 from kantox/feature/PT-3440-parse-holidays-on-l…
dlozano Aug 8, 2016
644c684
Bumped 0.8.2
dlozano Aug 8, 2016
793d82a
WIP
dlozano Jun 25, 2024
76286f3
WIP
dlozano Jun 25, 2024
2ff8faa
[SR-0000] Try to incorporate 1.8.2 improvements
dlozano Jun 25, 2024
3c7ba24
Added CODEOWNERS
dlozano Jun 25, 2024
9e8b85c
Push beta
dlozano Jun 25, 2024
b3f4d11
Merge branch 'feature/SR-1396-add-ci-and-loosen-activesupport-require…
dlozano Jun 25, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @kantox/site-reliability
89 changes: 89 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: build

on: [push]

jobs:
test:
name: "Ruby ${{ matrix.ruby-version }} - active_support ${{ matrix.active_support_version }}"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allow-failure }}
strategy:
fail-fast: false
matrix:
ruby-version: ['2.4']
allow-failure: [false]
frozen-string: [true]
active_support_version: ['4']
push-gem: [true]
include:
- ruby-version: '2.4'
allow-failure: false
frozen-string: true
active_support_version: '5'
push-gem: false
- ruby-version: '2.7'
allow-failure: false
frozen-string: true
active_support_version: '5'
push-gem: false
- ruby-version: '3.0'
allow-failure: false
frozen-string: true
active_support_version: '6'
push-gem: false
# We need upstream 0.11 with
# https://github.com/bokmann/business_time/pull/212/files
# 3.1+ compat
- ruby-version: '3.2'
allow-failure: false
frozen-string: true
active_support_version: '7'
push-gem: false
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
env:
ACTIVE_SUPPORT_VERSION: ${{ matrix.active_support_version }}
BUNDLE_GEMFILE: gemfiles/active_support_${{ matrix.active_support_version }}.gemfile
- run: bundle exec rake
env:
ACTIVE_SUPPORT_VERSION: ${{ matrix.active_support_version }}
BUNDLE_GEMFILE: gemfiles/active_support_${{ matrix.active_support_version }}.gemfile
# another option is to search for something like [PUSH_BETA_GEM] in event.payload.commits[0].message
- name: Publish Beta to GitHub Packages
if: ${{ github.event.ref != 'refs/heads/master' && ! contains(github.event.ref, 'refs/tags') && matrix.push-gem }}
run: |
set +x
mkdir -p $HOME/.gem
cat << EOF > ~/.gem/credentials
---
:github: Bearer ${GITHUB_TOKEN}
EOF
chmod 0600 $HOME/.gem/credentials
set -x

git config --global --add safe.directory "$(pwd)"

gem build $GEMSPEC | tee build.log
export GEM_VERSION=$(grep Version build.log | cut -d ':' -f 2 | xargs)
if [[ $GEM_VERSION =~ beta[0-9]*$ ]]; then
echo 'publish beta version'
gem push --key github --host https://rubygems.pkg.github.com/${OWNER} *.gem
else
echo 'Only beta versions are allowed'
exit 1
fi
env:
GEMSPEC: ${{github.event.repository.name}}.gemspec
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
OWNER: ${{github.event.repository.owner.login}}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ rdoc
pkg
.bundle
.rvmrc
.rbenv-version
.ruby-version
.rbenv-gemsets

## PROJECT::SPECIFIC
# for binstubs, since this gem has no executables
bin
vendor
.byebug_history
gemfiles/active_support_4.gemfile.lock gemfiles/active_support_5.gemfile.lock
19 changes: 19 additions & 0 deletions .gitmessage
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# in 60 characters or less, title this change starting with a present
# tense action verb. as in:
# fixes the issue with print stylesheets in chrome.
# cleans up the formatting of the css files.
# defines the database tables we'll need for the time-travel device.


# Write your diatribe here explaining why, if necessary. As in:
# After the change to Rails 10.9.8, the new ActiveHyperspace-fu library
# conflicted with Ruby 8.2. This commit resolves the failed attempt
# to store data in the remote Mars web service via generation of
# gravity waves.


# Hopefully, this references a github issue. If so, reference it here,
# as in:
# references | fixes | closes issue #289.


8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

75 changes: 68 additions & 7 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,74 @@
# Contributor Code of Conduct
# Contributor Covenant Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
## Our Pledge

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
## Our Standards

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
Examples of behavior that contributes to creating a positive environment
include:

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

*This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)*
Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [dbock at javaguy dot org]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
47 changes: 0 additions & 47 deletions Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009,2010,2011,2012 bokmann
Copyright (c) 2009-2016 bokmann

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
16 changes: 13 additions & 3 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ I needed this, but taking into account business hours/days and holidays.
1.business_day.ago
4.business_days.ago
8.business_days.ago

Date.today.workday?
Date.parse("2015-12-09").workday?
Date.parse("2015-12-12").workday?

And we can do it from any Date or Time object.
my_birthday = Date.parse("August 4th, 1969")
Expand Down Expand Up @@ -175,12 +179,11 @@ and some complexities (bugs?) in the timeWithZone class, this was harder than ex
preserved and the beginning and end of times for the business day are
referenced in that time zone.

This can lead to some wierd looking effects if, say, you are in the Eastern time zone but doing everything in UTC times...
This can lead to some weird looking effects if, say, you are in the Eastern time zone but doing everything in UTC times...
Your business day will appear to start and end at 9:00 and 5:00 UTC.
If this seems perplexing to you, I can almost guarantee you are in over your head with timezones in other ways too,
this is just the first place you encountered it.
Timezone relative date handling gets more and more complicated every time you look at it and takes a long time before it starts to seem simple again.
I'm hoping Arild and I write some good blog entries on the subject at http://blog.codesherpas.com.

== Integration with the Holidays gem

Expand All @@ -195,6 +198,12 @@ I'm hoping Arild and I write some good blog entries on the subject at http://blo

== Releases

0.7.6 - Fixed a defect where timezone was not preserved when dealing with beginning_or_workday and end_of_workday.
Thanks bazzargh.

0.7.2 - 0.7.5 - many pull requests from contributors, and a changelog was not adequately kept. I regret that.
git blame is your friend for diagnosing these dark days.

0.7.1 - fixing a multithreaded issue, upgrading some dependencies, loosening the dependency on TZInfo

0.7.0 - major maintenance upgrade on the process of constructing the gem, testing the gem, and updating dependencies.
Expand All @@ -211,6 +220,7 @@ I'm hoping Arild and I write some good blog entries on the subject at http://blo
* Glenn Vanderburg http://github.com/glv
* Michael Grosser http://github.com/grosser
* Michael Curtis http://github.com/mcurtis
* Brian Ewins http://github.com/bazzargh

(Special thanks for Arild on the complexities of dealing with TimeWithZone)

Expand Down Expand Up @@ -244,4 +254,4 @@ I'm hoping Arild and I write some good blog entries on the subject at http://blo

== Copyright

Copyright (c) 2010,2011,2012,2013 bokmann. See LICENSE for details.
Copyright (c) 2010-2016 bokmann. See LICENSE for details.
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require 'bundler/setup'
require 'bundler/gem_tasks'

desc "Default: run unit tests."
task default: :test

require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << "test"
test.verbose = true
end
task :default => :test

task :cov do
ENV["COV"] = "1"
Expand Down
15 changes: 7 additions & 8 deletions business_time.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ Gem::Specification.new do |s|
s.description = %Q{Have you ever wanted to do things like "6.business_days.from_now" and have weekends and holidays taken into account? Now you can.}
s.homepage = "https://github.com/bokmann/business_time"
s.authors = ["bokmann", 'Kantox LTD']
s.email = ["dbock@codesherpas.com", '[email protected]']
s.email = ["dbock@javaguy.org", 'aleksei.matiushkin@kantox.com', 'david.lozano@kantox.com']
s.license = "MIT"

s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/(test|spec|features)\//) }
s.require_paths = %w(lib)

s.add_dependency 'activesupport', '>= 3.1.0', '< 5'
s.add_dependency 'tzinfo'
s.add_dependency('activesupport','>= 4.2')
s.add_dependency("tzinfo")

s.add_development_dependency "rake", '~> 10'
s.add_development_dependency "rdoc", '~> 4'
s.add_development_dependency "minitest", '~> 5'
s.add_development_dependency "minitest-rg", '~> 5'
s.add_development_dependency "minitest-reporters", '~> 1'
s.add_development_dependency "rake"
s.add_development_dependency "rdoc"
s.add_development_dependency "minitest"
s.add_development_dependency "minitest-reporters"
end
6 changes: 6 additions & 0 deletions gemfiles/active_support_4.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'
gemspec path: '../'

group :development, :test do
gem 'activesupport', '~> 4.0'
end
6 changes: 6 additions & 0 deletions gemfiles/active_support_5.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'
gemspec path: '../'

group :development, :test do
gem 'activesupport', '~> 5.0'
end
6 changes: 6 additions & 0 deletions gemfiles/active_support_6.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'
gemspec path: '../'

group :development, :test do
gem 'activesupport', '~> 6.0'
end
6 changes: 6 additions & 0 deletions gemfiles/active_support_7.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'
gemspec path: '../'

group :development, :test do
gem 'activesupport', '~> 7.0'
end
Loading
Loading