horario 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/horario +43 -29
- metadata +2 -2
data/bin/horario
CHANGED
@@ -1,45 +1,59 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
2
3
|
|
3
4
|
require 'colorize'
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
6
|
+
if (ARGV.size == 0)
|
7
|
+
puts
|
8
|
+
print ' Horario diário (h:m): '.green
|
9
|
+
total = gets.chomp
|
10
|
+
|
11
|
+
puts
|
12
|
+
print ' Hora de entrada (h:m): '.green
|
13
|
+
hour = gets.chomp
|
14
|
+
|
15
|
+
puts
|
16
|
+
print ' Tempo adicional (h:m): '.green
|
17
|
+
hour_add = gets.chomp
|
18
|
+
elsif (ARGV.size == 2)
|
19
|
+
total = ARGV[0]
|
20
|
+
hour = ARGV[1]
|
21
|
+
elsif (ARGV.size == 3)
|
22
|
+
total = ARGV[0]
|
23
|
+
hour = ARGV[1]
|
24
|
+
hour_add = ARGV[2]
|
25
|
+
end
|
26
|
+
|
27
|
+
total = total.split(':') if total
|
28
|
+
hour = hour.split(':') if hour
|
29
|
+
hour_add = hour_add.split(':') if hour_add
|
24
30
|
|
25
31
|
now = Time.now
|
26
32
|
year = now.year
|
27
33
|
month = now.month
|
28
34
|
day = now.day
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
minutes_add = Integer(
|
34
|
-
|
35
|
-
|
35
|
+
minutes = Integer(hour[1])
|
36
|
+
hour = Integer(hour[0])
|
37
|
+
|
38
|
+
if (hour_add)
|
39
|
+
minutes_add = Integer(hour_add[1])
|
40
|
+
hour_add = Integer(hour_add[0])
|
41
|
+
|
42
|
+
hour_add = (60 * 60 * hour_add)
|
43
|
+
minutes_add = (60 * 60 * (100/60.0*minutes_add/100))
|
44
|
+
else
|
45
|
+
hour_add = 0
|
46
|
+
minutes_add = 0
|
47
|
+
end
|
48
|
+
|
49
|
+
total_hours = Integer(total[0])
|
50
|
+
total_minutes = Integer(total[1])
|
36
51
|
|
37
52
|
time = Time.new(year, month, day, hour, minutes, 0)
|
38
|
-
interval = (60 * 60 * (
|
39
|
-
result = (time+interval+
|
53
|
+
interval = (60 * 60 * (total_hours + (100/60.0*total_minutes/100)))
|
54
|
+
result = (time+interval+hour_add+minutes_add).strftime('%H:%M')
|
40
55
|
|
41
56
|
puts
|
42
57
|
puts " Seu horario de saida e #{result}".yellow
|
43
58
|
puts
|
44
|
-
puts
|
45
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: horario
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|