balboa 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c75e34d3e6ac77e6c54426f34b818a6ab89f062
4
- data.tar.gz: 6a5a659d87bcb2411cc32e5a2271c7cef6298465
3
+ metadata.gz: ef19d875f6ac656065f2f7d7ff0becccafc84eae
4
+ data.tar.gz: 9dfd4d4c08f7fc5275b3ee1fdbeb2abeb8827e3e
5
5
  SHA512:
6
- metadata.gz: 3f31f8113ddfc943b705d51a49131d831492e2c212fbab4d9a4127a41201874ddcc6fcdf66ec4ff06ceda1418624325bbe784afe93de2dedd2718be9668c6092
7
- data.tar.gz: f2dd74759422b457b08be14979023417c4691ee94d8e4e1b59cf29038c5ea84e342c468114be927e02e605d7842e26ca8b46eb460dd51b0e8dd31ab1acdce636
6
+ metadata.gz: bcb71570d31f5e1b71c1fbbe2ae1136b721ba680cad14ea3307c0df1479b40cc7d6cf227944e27558ead12e45a3a79ca4eddb3d028500853dae01b4186cfff3f
7
+ data.tar.gz: e7c323ea423915735d1bef6799b539c6e8ea5452142793c21125103d9cf53e28c8dd46a9e2ff1d6076bf8067a8d899b45419936b2b7770c1b6978b6a796697bb
data/README.md CHANGED
@@ -1,34 +1,61 @@
1
1
  # Balboa
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/balboa`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ [![Gem Version](https://badge.fury.io/rb/balboa.svg)](https://badge.fury.io/rb/balboa)
6
4
 
7
5
  ## Installation
8
6
 
9
- Add this line to your application's Gemfile:
7
+ $ gem install balboa
10
8
 
11
- ```ruby
12
- gem 'balboa'
13
- ```
9
+ ## Usage
14
10
 
15
- And then execute:
11
+ A good way to start is:
16
12
 
17
- $ bundle
13
+ $ balboa -h
18
14
 
19
- Or install it yourself as:
15
+ Let's suppose you just want to punch (it will punch from the day after the last punch until it can not punch anymore):
20
16
 
21
- $ gem install balboa
17
+ $ balboa punch
18
+
19
+ Let's suppose you want to skip 11/11/2011, 12/12/2012 and 13/12/2012 (it will skip weekends and ask for punch on holidays):
22
20
 
23
- ## Usage
21
+ $ balboa punch -s '11/11/2011,12/12/2012,13/12/2012'
22
+
23
+ Let's suppose you will work for sometime in another project:
24
+
25
+ $ balboa punch -w 'Another Project'
26
+
27
+ Let's suppose you did not input your password (or changed it after setting balboa up) on the first run. You can either:
28
+
29
+ $ balboa reset # Or
30
+ $ balboa punch -p 'New Password'
31
+
32
+ Let's suppose you don't have phantomjs on your machine. Balboa doesn't care, it will install it for you. Just punch normally.
33
+
34
+ $ balboa punch
35
+
36
+ Let's suppose you don't understand what those `|number|` means. It is the calculated default schedule. Just press enter and Balboa will fill it up for you.
24
37
 
25
- TODO: Write usage instructions here
38
+ ```
39
+ First shift: |8|
40
+
41
+ Lunch: |12|
42
+
43
+ Second shift: |13|
44
+
45
+ Leave: |18|
46
+ ```
26
47
 
27
- ## Development
48
+ Let's suppose your schedule is different from the default. Balboa will help you out.
28
49
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+ ```
51
+ First shift: |8| 10
52
+
53
+ Lunch: |14| 15
30
54
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+ Second shift: |16|
56
+
57
+ Leave: |19|
58
+ ```
32
59
 
33
60
  ## Contributing
34
61
 
@@ -38,4 +65,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
38
65
  ## License
39
66
 
40
67
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -5,6 +5,8 @@ require 'yaml'
5
5
  module Balboa
6
6
  module CLI
7
7
  class Defaults
8
+ TOTAL_WORK_HOURS = 8
9
+
8
10
  def self.prompt(*args)
9
11
  new(*args).prompt
10
12
  end
@@ -36,6 +38,8 @@ module Balboa
36
38
  end
37
39
 
38
40
  def prompt_attributes
41
+ @cli.say("\nFirst run. Please type your settings!")
42
+
39
43
  @config['email'] = prompt_email
40
44
  @config['password'] = prompt_password
41
45
  @config['project'] = prompt_project
@@ -67,15 +71,23 @@ module Balboa
67
71
  end
68
72
 
69
73
  def prompt_lunch
70
- @cli.ask("\nLunch: ") { |qst| qst.default = '12' }
74
+ default = @config['start_at'].to_i + 4
75
+
76
+ @cli.ask("\nLunch: ") { |qst| qst.default = default.to_s }
71
77
  end
72
78
 
73
79
  def prompt_restart
74
- @cli.ask("\nSecond shift: ") { |qst| qst.default = '13' }
80
+ default = @config['lunch_at'].to_i + 1
81
+
82
+ @cli.ask("\nSecond shift: ") { |qst| qst.default = default.to_s }
75
83
  end
76
84
 
77
85
  def prompt_leave
78
- @cli.ask("\nLeave: ") { |qst| qst.default = '17' }
86
+ default = TOTAL_WORK_HOURS
87
+ default -= @config['lunch_at'].to_i - @config['start_at'].to_i
88
+ default += @config['restart_at'].to_i
89
+
90
+ @cli.ask("\nLeave: ") { |qst| qst.default = default.to_s }
79
91
  end
80
92
  end
81
93
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Balboa
4
- VERSION = '0.1.5'.freeze
4
+ VERSION = '0.1.6'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: balboa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Waldyr de Souza