waaah 0.1.1 → 0.1.2
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/lib/waaah/cli.rb +40 -31
- data/lib/waaah/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00d4ee490e420882000aeb95d4f69fd2d0f1e7556edd424be259021fd1c1c1e4
|
4
|
+
data.tar.gz: ddf385283fadafb0f2177d62a0de646eb96406a1c90f892a900afa34ffe0b670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd508211d174d9715f19a02ed70bf694b8e94ca1bf6c252f2b2ed7ae750090e81a513087aee4a04b51b9fe2be19ea650f6ec409ba6481c3c85f72e0414915a19
|
7
|
+
data.tar.gz: 636095d17616e9f9d43375498a9c53ed06a06c9aeb86cb7b0da19861b69230053328a39187c32d43d19600c6223f7e454f5f464721fd0b78ad3318e7561d96c0
|
data/lib/waaah/cli.rb
CHANGED
@@ -3,45 +3,54 @@ require 'date'
|
|
3
3
|
|
4
4
|
module Waaah
|
5
5
|
class CLI
|
6
|
-
|
7
|
-
|
6
|
+
class << self
|
7
|
+
def run(argv)
|
8
|
+
options = {}
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.on('-h' '--help', 'Command execution example: waaah -d YYYY-MM-DD') do |boolean|
|
12
|
+
puts ops
|
13
|
+
exit
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
opts.on("-d", "--date DATE", "Specify the due date(ex: 2025-01-01)") do |date|
|
17
|
+
begin
|
18
|
+
options[:due_date] = Date.parse(date)
|
19
|
+
rescue ArgumentError
|
20
|
+
puts 'Error: The date format is not correct.(ex: 2025-01-01)'
|
21
|
+
exit 1
|
22
|
+
end
|
21
23
|
end
|
24
|
+
end.parse!
|
25
|
+
|
26
|
+
unless options[:due_date]
|
27
|
+
warn "Error: The specification of the due date is required."
|
28
|
+
exit 1
|
22
29
|
end
|
23
|
-
end.parse!
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
31
|
+
today = Date.today
|
32
|
+
due_date = options[:due_date]
|
33
|
+
start_date = due_date - 280
|
29
34
|
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
puts '----------------------'
|
36
|
+
puts "Due date: #{due_date}"
|
37
|
+
puts '----------------------'
|
38
|
+
puts "Pregnancy start date: #{start_date}"
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
40
|
+
(1..10).each do |month|
|
41
|
+
month_start_date = start_date + (month * 28)
|
42
|
+
now = ' *' if months_of_pregnancy?(today, month_start_date)
|
43
|
+
puts "#{month} month of pregnancy: #{month_start_date}#{now}"
|
44
|
+
end
|
45
|
+
end
|
38
46
|
|
39
|
-
(
|
40
|
-
|
41
|
-
month_end_date
|
42
|
-
|
43
|
-
|
47
|
+
def months_of_pregnancy?(today, month_start_date)
|
48
|
+
month_end_date = month_start_date + 27
|
49
|
+
(month_start_date..month_end_date).cover?(today)
|
50
|
+
end
|
51
|
+
def due_date?(due_date, today)
|
52
|
+
due_date == today
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
47
|
-
end
|
56
|
+
end
|
data/lib/waaah/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waaah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tadaaki
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-26 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
executables:
|
13
13
|
- waaah
|
@@ -24,6 +24,7 @@ licenses:
|
|
24
24
|
metadata:
|
25
25
|
homepage_uri: https://github.com/torinoko/waaah
|
26
26
|
source_code_uri: https://github.com/torinoko/waaah
|
27
|
+
changelog_uri: https://github.com/torinoko/waaah/CHANGELOG.md
|
27
28
|
rdoc_options: []
|
28
29
|
require_paths:
|
29
30
|
- lib
|