timeboss 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gem-push.yml +31 -0
  3. data/.github/workflows/ruby.yml +35 -0
  4. data/.travis.yml +3 -2
  5. data/Gemfile +2 -1
  6. data/README.md +17 -2
  7. data/Rakefile +3 -1
  8. data/bin/tbsh +2 -2
  9. data/lib/tasks/calendars.rake +5 -5
  10. data/lib/tasks/timeboss.rake +2 -2
  11. data/lib/timeboss/calendar/day.rb +3 -2
  12. data/lib/timeboss/calendar/half.rb +2 -1
  13. data/lib/timeboss/calendar/month.rb +2 -1
  14. data/lib/timeboss/calendar/parser.rb +9 -8
  15. data/lib/timeboss/calendar/period.rb +9 -6
  16. data/lib/timeboss/calendar/quarter.rb +2 -1
  17. data/lib/timeboss/calendar/support/formatter.rb +5 -4
  18. data/lib/timeboss/calendar/support/has_fiscal_weeks.rb +17 -0
  19. data/lib/timeboss/calendar/support/has_iso_weeks.rb +30 -0
  20. data/lib/timeboss/calendar/support/month_basis.rb +1 -1
  21. data/lib/timeboss/calendar/support/monthly_unit.rb +8 -8
  22. data/lib/timeboss/calendar/support/navigable.rb +2 -1
  23. data/lib/timeboss/calendar/support/shiftable.rb +12 -11
  24. data/lib/timeboss/calendar/support/translatable.rb +3 -2
  25. data/lib/timeboss/calendar/support/unit.rb +20 -13
  26. data/lib/timeboss/calendar/waypoints/absolute.rb +4 -3
  27. data/lib/timeboss/calendar/waypoints/relative.rb +14 -13
  28. data/lib/timeboss/calendar/week.rb +3 -2
  29. data/lib/timeboss/calendar/year.rb +2 -1
  30. data/lib/timeboss/calendar.rb +8 -7
  31. data/lib/timeboss/calendars/broadcast.rb +10 -7
  32. data/lib/timeboss/calendars/gregorian.rb +4 -5
  33. data/lib/timeboss/calendars.rb +3 -2
  34. data/lib/timeboss/version.rb +2 -1
  35. data/lib/timeboss.rb +2 -0
  36. data/spec/{calendar → lib/timeboss/calendar}/day_spec.rb +14 -14
  37. data/spec/{calendar → lib/timeboss/calendar}/quarter_spec.rb +9 -9
  38. data/spec/lib/timeboss/calendar/support/monthly_unit_spec.rb +91 -0
  39. data/spec/{calendar → lib/timeboss/calendar}/support/unit_spec.rb +23 -22
  40. data/spec/{calendar → lib/timeboss/calendar}/week_spec.rb +20 -20
  41. data/spec/lib/timeboss/calendars/broadcast_spec.rb +796 -0
  42. data/spec/lib/timeboss/calendars/gregorian_spec.rb +793 -0
  43. data/spec/{calendars_spec.rb → lib/timeboss/calendars_spec.rb} +19 -19
  44. data/spec/spec_helper.rb +2 -2
  45. data/timeboss.gemspec +16 -14
  46. metadata +51 -20
  47. data/lib/timeboss/support/shellable.rb +0 -17
  48. data/spec/calendar/support/monthly_unit_spec.rb +0 -85
  49. data/spec/calendars/broadcast_spec.rb +0 -796
  50. data/spec/calendars/gregorian_spec.rb +0 -684
@@ -2,8 +2,8 @@ module TimeBoss
2
2
  class Calendar
3
3
  describe Week do
4
4
  let(:calendar) { instance_double(TimeBoss::Calendar, supports_weeks?: true) }
5
- let(:start_date) { Date.parse('2048-04-06') }
6
- let(:end_date) { Date.parse('2048-04-12') }
5
+ let(:start_date) { Date.parse("2048-04-06") }
6
+ let(:end_date) { Date.parse("2048-04-12") }
7
7
  let(:subject) { described_class.new(calendar, start_date, end_date) }
8
8
 
9
9
  it "doesn't even exist if its calendar doesn't support weeks" do
@@ -11,65 +11,65 @@ module TimeBoss
11
11
  expect { subject }.to raise_error TimeBoss::Calendar::Support::Unit::UnsupportedUnitError
12
12
  end
13
13
 
14
- it 'knows its stuff' do
14
+ it "knows its stuff" do
15
15
  expect(subject.start_date).to eq start_date
16
16
  expect(subject.end_date).to eq end_date
17
17
  expect(subject.to_range).to eq start_date..end_date
18
18
  end
19
19
 
20
- it 'knows its title' do
20
+ it "knows its title" do
21
21
  expect(subject.title).to eq "Week of April 6, 2048"
22
22
  end
23
23
 
24
- describe '#current?' do
25
- it 'knows when it is' do
24
+ describe "#current?" do
25
+ it "knows when it is" do
26
26
  allow(Date).to receive(:today).and_return start_date
27
27
  expect(subject).to be_current
28
28
  end
29
29
 
30
- it 'knows when it is not' do
30
+ it "knows when it is not" do
31
31
  expect(subject).not_to be_current
32
32
  end
33
33
  end
34
34
 
35
- context 'navigation' do
35
+ context "navigation" do
36
36
  let(:calendar) { TimeBoss::Calendars::Broadcast.new }
37
37
 
38
- describe '#previous' do
39
- it 'can back up simply' do
38
+ describe "#previous" do
39
+ it "can back up simply" do
40
40
  result = subject.previous
41
41
  expect(result).to be_a described_class
42
42
  expect(result.to_s).to eq "2048W14: 2048-03-30 thru 2048-04-05"
43
43
  end
44
44
 
45
- it 'can wrap to the previous 52-week year' do
46
- result = described_class.new(calendar, Date.parse('2021-12-27'), Date.parse('2022-01-02')).previous
45
+ it "can wrap to the previous 52-week year" do
46
+ result = described_class.new(calendar, Date.parse("2021-12-27"), Date.parse("2022-01-02")).previous
47
47
  expect(result).to be_a described_class
48
48
  expect(result.to_s).to eq "2021W52: 2021-12-20 thru 2021-12-26"
49
49
  end
50
50
 
51
- it 'can wrap to the previous 53-week year' do
52
- result = described_class.new(calendar, Date.parse('2024-01-01'), Date.parse('2024-01-07')).previous
51
+ it "can wrap to the previous 53-week year" do
52
+ result = described_class.new(calendar, Date.parse("2024-01-01"), Date.parse("2024-01-07")).previous
53
53
  expect(result).to be_a described_class
54
54
  expect(result.to_s).to eq "2023W53: 2023-12-25 thru 2023-12-31"
55
55
  end
56
56
  end
57
57
 
58
- describe '#next' do
59
- it 'can move forward simply' do
58
+ describe "#next" do
59
+ it "can move forward simply" do
60
60
  result = subject.next
61
61
  expect(result).to be_a described_class
62
62
  expect(result.to_s).to eq "2048W16: 2048-04-13 thru 2048-04-19"
63
63
  end
64
64
 
65
- it 'can wrap from week 52 to the next year' do
66
- result = described_class.new(calendar, Date.parse('2021-12-20'), Date.parse('2021-12-26')).next
65
+ it "can wrap from week 52 to the next year" do
66
+ result = described_class.new(calendar, Date.parse("2021-12-20"), Date.parse("2021-12-26")).next
67
67
  expect(result).to be_a described_class
68
68
  expect(result.to_s).to eq "2022W1: 2021-12-27 thru 2022-01-02"
69
69
  end
70
70
 
71
- it 'can wrap from week 53 to the next year' do
72
- result = described_class.new(calendar, Date.parse('2023-12-25'), Date.parse('2023-12-31')).next
71
+ it "can wrap from week 53 to the next year" do
72
+ result = described_class.new(calendar, Date.parse("2023-12-25"), Date.parse("2023-12-31")).next
73
73
  expect(result).to be_a described_class
74
74
  expect(result.to_s).to eq "2024W1: 2024-01-01 thru 2024-01-07"
75
75
  end