timeboss 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/README.md +4 -8
- data/bin/tbsh +15 -0
- data/lib/tasks/calendars.rake +5 -0
- data/lib/timeboss/calendar.rb +8 -0
- data/lib/timeboss/calendars.rb +1 -1
- data/lib/timeboss/version.rb +1 -1
- data/spec/calendars_spec.rb +7 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '082c0c9219e3f40e3e8f98a9850212b678fa895afd0c9062fe4dd21219e879e7'
|
4
|
+
data.tar.gz: 95f5b7c19bd48f94b458aed504f258a7942daf98e0e5f30d8eed50fdfb572811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a38a6b535c9b65bb8051e1c54003a05e2ce50c4b1e8d6575ef89f9d7f1ce8976f99b713a8a34e2380c98694696f5b8a4765416631f970ed035c85e7d1744a672
|
7
|
+
data.tar.gz: 3db1f8f1d6551f9c94c14496f2a13c9133d59ef9352cf638d91b3953a6d17981fef6f70b5a045de259f610cbed8d12fcd109b70df3b3dab08aeaae8b86567d69
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# TimeBoss [](https://travis-ci.com/kevinstuffandthings/timeboss)
|
1
|
+
# TimeBoss [](https://travis-ci.com/kevinstuffandthings/timeboss) [](https://badge.fury.io/rb/timeboss)
|
2
2
|
A gem providing convenient navigation of the [Broadcast Calendar](https://en.wikipedia.org/wiki/Broadcast_calendar).
|
3
3
|
|
4
|
-
_This is a work in progress. Check back soon for the initial release!_
|
5
|
-
|
6
4
|
## Installation
|
7
5
|
Add this line to your application's Gemfile:
|
8
6
|
```ruby
|
@@ -20,8 +18,6 @@ Or install it yourself as:
|
|
20
18
|
$ gem install timeboss
|
21
19
|
```
|
22
20
|
|
23
|
-
You can find the gem on [RubyGems](https://rubygems.org/gems/timeboss).
|
24
|
-
|
25
21
|
## Usage
|
26
22
|
Supports `year`, `half`, `quarter`, `month`, `week`, and `day`.
|
27
23
|
|
@@ -127,10 +123,10 @@ period = calendar.parse('2020W3..2020Q1')
|
|
127
123
|
The examples above are just samples. Try different periods, operators, etc.
|
128
124
|
|
129
125
|
### Shell
|
130
|
-
To open an IRB shell for the broadcast calendar, use the `timeboss:calendars:broadcast:shell` rake task.
|
126
|
+
To open an IRB shell for the broadcast calendar, use the `tbsh` executable, or the `timeboss:calendars:broadcast:shell` rake task.
|
131
127
|
You will find yourself in the context of an instantiated `TimeBoss::Calendars::Broadcast` object:
|
132
128
|
```bash
|
133
|
-
$
|
129
|
+
$ tbsh
|
134
130
|
2.4.1 :001 > next_quarter
|
135
131
|
=> #<TimeBoss::Calendar::Quarter:0x007fe04c16a1c8 @calendar=#<TimeBoss::Calendars::Broadcast:0x007fe04c1a0458 @basis=TimeBoss::Calendars::Broadcast::Basis>, @year_index=2020, @index=4, @start_date=#<Date: 2020-09-28 ((2459121j,0s,0n),+0s,2299161j)>, @end_date=#<Date: 2020-12-27 ((2459211j,0s,0n),+0s,2299161j)>>
|
136
132
|
2.4.1 :002 > last_year
|
@@ -207,4 +203,4 @@ With the new calendar implemented, it can be accessed in one of 2 ways:
|
|
207
203
|
```
|
208
204
|
|
209
205
|
## TODO
|
210
|
-
- [
|
206
|
+
- [ ] Add comprehensive documentation
|
data/bin/tbsh
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'timeboss/calendars'
|
4
|
+
require 'timeboss/support/shellable'
|
5
|
+
|
6
|
+
calendar = if ARGV.length == 1
|
7
|
+
TimeBoss::Calendars[ARGV.first]&.calendar
|
8
|
+
else
|
9
|
+
TimeBoss::Calendars.first.calendar
|
10
|
+
end
|
11
|
+
|
12
|
+
abort "Unknown calendar" if calendar.nil?
|
13
|
+
|
14
|
+
puts "Active calendar: #{calendar.title}"
|
15
|
+
TimeBoss::Support::Shellable.open(calendar)
|
data/lib/tasks/calendars.rake
CHANGED
@@ -4,6 +4,11 @@ namespace :timeboss do
|
|
4
4
|
namespace :calendars do
|
5
5
|
TimeBoss::Calendars.each do |entry|
|
6
6
|
namespace entry.name do
|
7
|
+
desc "Evaluate an expression for the #{entry.name} calendar"
|
8
|
+
task :evaluate, %i[expression] => ['timeboss:init'] do |_, args|
|
9
|
+
puts entry.calendar.parse(args[:expression])
|
10
|
+
end
|
11
|
+
|
7
12
|
desc "Open a shell with the #{entry.name} calendar"
|
8
13
|
task shell: ['timeboss:init'] do
|
9
14
|
require 'timeboss/support/shellable'
|
data/lib/timeboss/calendar.rb
CHANGED
data/lib/timeboss/calendars.rb
CHANGED
data/lib/timeboss/version.rb
CHANGED
data/spec/calendars_spec.rb
CHANGED
@@ -28,10 +28,16 @@ module TimeBoss
|
|
28
28
|
c2 = described_class[:broadcast]
|
29
29
|
expect(c1).to be_instance_of TimeBoss::Calendars::Broadcast
|
30
30
|
expect(c1).to be c2
|
31
|
+
|
32
|
+
expect(c1.name).to eq 'broadcast'
|
33
|
+
expect(c1.title).to eq 'Broadcast'
|
31
34
|
end
|
32
35
|
|
33
36
|
it 'can return a new calendar' do
|
34
|
-
|
37
|
+
c1 = described_class[:my_test_calendar]
|
38
|
+
expect(c1).to be_instance_of MyTestCalendar
|
39
|
+
expect(c1.name).to eq 'my_test_calendar'
|
40
|
+
expect(c1.title).to eq 'My Test Calendar'
|
35
41
|
end
|
36
42
|
|
37
43
|
it 'can graceully give you nothing' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McDonald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -111,7 +111,8 @@ dependencies:
|
|
111
111
|
description: Broadcast Calendar navigation in Ruby made simple
|
112
112
|
email:
|
113
113
|
- kevinstuffandthings@gmail.com
|
114
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- tbsh
|
115
116
|
extensions: []
|
116
117
|
extra_rdoc_files: []
|
117
118
|
files:
|
@@ -122,6 +123,7 @@ files:
|
|
122
123
|
- LICENSE.txt
|
123
124
|
- README.md
|
124
125
|
- Rakefile
|
126
|
+
- bin/tbsh
|
125
127
|
- lib/tasks/calendars.rake
|
126
128
|
- lib/tasks/timeboss.rake
|
127
129
|
- lib/timeboss.rb
|
@@ -172,7 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
174
|
- !ruby/object:Gem::Version
|
173
175
|
version: '0'
|
174
176
|
requirements: []
|
175
|
-
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.7.7
|
176
179
|
signing_key:
|
177
180
|
specification_version: 4
|
178
181
|
summary: Broadcast Calendar navigation in Ruby made simple
|