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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0993a0cd3f9eaf4c63e71aac4b816950c7454d7cdbebb41032d4d52ed401fa9f'
4
- data.tar.gz: 7b3ecd196897915c0ca137b21d2e70b3004513098fe1c880e7847106529f5e8b
3
+ metadata.gz: '082c0c9219e3f40e3e8f98a9850212b678fa895afd0c9062fe4dd21219e879e7'
4
+ data.tar.gz: 95f5b7c19bd48f94b458aed504f258a7942daf98e0e5f30d8eed50fdfb572811
5
5
  SHA512:
6
- metadata.gz: 9e57840bb1b2645a1247a9868840abb1b1eed60de9106115b8a103aac7ee4689c476d0cbf44ac9596e1ff5ce538caa23666bcaedf85d732d84cd14d71671fde4
7
- data.tar.gz: 6fd2d42323c56dd3af20a1312c993fa31ac7652cc01826fff856529ef2019c8b66da0d9b47b0563c3a8753ab15de84e6321e2a465d02611886fccc533ccfa3ce
6
+ metadata.gz: a38a6b535c9b65bb8051e1c54003a05e2ce50c4b1e8d6575ef89f9d7f1ce8976f99b713a8a34e2380c98694696f5b8a4765416631f970ed035c85e7d1744a672
7
+ data.tar.gz: 3db1f8f1d6551f9c94c14496f2a13c9133d59ef9352cf638d91b3953a6d17981fef6f70b5a045de259f610cbed8d12fcd109b70df3b3dab08aeaae8b86567d69
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # TimeBoss [![Build Status](https://travis-ci.com/kevinstuffandthings/timeboss.svg?branch=master)](https://travis-ci.com/kevinstuffandthings/timeboss)
1
+ # TimeBoss [![Build Status](https://travis-ci.com/kevinstuffandthings/timeboss.svg?branch=master)](https://travis-ci.com/kevinstuffandthings/timeboss) [![Gem Version](https://badge.fury.io/rb/timeboss.svg)](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
- $ rake timeboss:calendars:broadcast:shell
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
- - [x] Add gem deployment via [Travis-CI](https://docs.travis-ci.com/user/deployment/rubygems/#:~:text=Travis%20CI%20can%20automatically%20release,RubyGems%20after%20a%20successful%20build.&text=If%20you%20tag%20a%20commit,tags%20are%20uploaded%20to%20GitHub.&text=You%20will%20be%20prompted%20to,key%20on%20the%20command%20line.)
206
+ - [ ] Add comprehensive documentation
@@ -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)
@@ -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'
@@ -11,6 +11,14 @@ module TimeBoss
11
11
  include Waypoints
12
12
  delegate :parse, to: :parser
13
13
 
14
+ def name
15
+ self.class.to_s.demodulize.underscore
16
+ end
17
+
18
+ def title
19
+ name.titleize
20
+ end
21
+
14
22
  protected
15
23
 
16
24
  attr_reader :basis
@@ -17,7 +17,7 @@ module TimeBoss
17
17
  end
18
18
 
19
19
  def [](name)
20
- find { |e| e.name == name.to_sym }&.calendar
20
+ find { |e| e.name == name&.to_sym }&.calendar
21
21
  end
22
22
 
23
23
  private
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module TimeBoss
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
@@ -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
- expect(described_class[:my_test_calendar]).to be_instance_of MyTestCalendar
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.7
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-16 00:00:00.000000000 Z
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
- rubygems_version: 3.0.8
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