Skip to content

Commit 76cf4f8

Browse files
authored
Fix wrong should work until time on break time (#253)
* Fix wrong should work until time on break time Fixes #229 * Update dependencies * Remove os-homedir as it's deprecated and built into node * Update github handle * Update readme for binary file setup
1 parent b8508b0 commit 76cf4f8

File tree

7 files changed

+4985
-4049
lines changed

7 files changed

+4985
-4049
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Omid Hezaveh
3+
Copyright (c) 2017-2020 Nick Okapi
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A command line tool for tracking work hours, as simple as it can get.
44

55
[![Backers on Open Collective](https://opencollective.com/moro/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/moro/sponsors/badge.svg)](#sponsors) [![Downloads](https://img.shields.io/npm/dt/moro.svg)](https://npmjs.org/moro)
6-
[![Greenkeeper badge](https://badges.greenkeeper.io/omidfi/moro.svg)](https://greenkeeper.io/)
6+
[![Greenkeeper badge](https://badges.greenkeeper.io/albacoretuna/moro.svg)](https://greenkeeper.io/)
77
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)
88

99
## Demo
@@ -13,18 +13,30 @@ A command line tool for tracking work hours, as simple as it can get.
1313
## Install
1414

1515
### If you have node and npm
16+
17+
You need node version 10 or higher (we haven't tested lower versions)
18+
19+
To install just type this into command line:
20+
1621
```bash
1722
npm install -g moro
1823

19-
# yarn works too
24+
# or if you are using yarn, it works too
2025
yarn global add moro
2126
```
22-
You need node version 10 or higher (we haven't tested lower versions)
2327

24-
### No node on your machine?
28+
You are done installing Moro!
2529

26-
You can download the executable files from [releases page](https://github.com/omidfi/moro/releases) for Linux, Mac and Windows.
30+
### (alternative install method) Download the compiled binary file
31+
We recommend installing moro using npm but if you don't have node and npm on your machine, you can download the executable files from [releases page](https://github.com/albacoretuna/moro/releases) for Linux, Mac and Windows.
32+
33+
Remember to copy ./lib/config.json to your home directory and rename it to
34+
35+
```
36+
~/.moro-config.json
37+
```
2738

39+
Then you can copy the downloaded executable file to your path, for example to /bin and start using moro just like the nomral installation.
2840

2941

3042
## Update
@@ -48,7 +60,7 @@ To see the full report of previous days run `moro report --all`.
4860
Those two steps above should be all you need to know about Moro, but there are 3 ways to learn more:
4961

5062
* `$: moro --help`
51-
* See the documentation: [link](https://github.com/omidfi/moro/blob/master/DOCUMENTATION.md)
63+
* See the documentation: [link](https://github.com/albacoretuna/moro/blob/master/DOCUMENTATION.md)
5264
* Or check this screen recording: [link](https://asciinema.org/a/106792)
5365

5466
## Frequently Asked Questions (FAQ)
@@ -93,9 +105,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
93105

94106
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
95107
<!-- prettier-ignore -->
96-
| [<img src="https://avatars2.githubusercontent.com/u/7697632?v=3" width="100px;"/><br /><sub><b>Nick Okapi</b></sub>](http://omid.fi)<br />[💬](#question-omidfi "Answering Questions") [🐛](https://github.com/omidfi/moro/issues?q=author%3Aomidfi "Bug reports") [💻](https://github.com/omidfi/moro/commits?author=omidfi "Code") [📖](https://github.com/omidfi/moro/commits?author=omidfi "Documentation") [👀](#review-omidfi "Reviewed Pull Requests") [⚠️](https://github.com/omidfi/moro/commits?author=omidfi "Tests") | [<img src="https://avatars2.githubusercontent.com/u/4089975?v=3" width="100px;"/><br /><sub><b>Mario</b></sub>](https://github.com/mario-s)<br />[💻](https://github.com/omidfi/moro/commits?author=mario-s "Code") [📖](https://github.com/omidfi/moro/commits?author=mario-s "Documentation") [⚠️](https://github.com/omidfi/moro/commits?author=mario-s "Tests") | [<img src="https://avatars2.githubusercontent.com/u/2211050?v=3" width="100px;"/><br /><sub><b>Karl Fleischmann</b></sub>](https://twitter.com/fleischie28)<br />[💻](https://github.com/omidfi/moro/commits?author=fleischie "Code") [📖](https://github.com/omidfi/moro/commits?author=fleischie "Documentation") [⚠️](https://github.com/omidfi/moro/commits?author=fleischie "Tests") | [<img src="https://avatars0.githubusercontent.com/u/12087554?v=3" width="100px;"/><br /><sub><b>Niloofar Motamed</b></sub>](https://niloofarmotamed.com)<br />[📖](https://github.com/omidfi/moro/commits?author=niloomotita "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/5592940?v=3" width="100px;"/><br /><sub><b>Wolf-Rost</b></sub>](https://github.com/Wolf-Rost)<br />[📖](https://github.com/omidfi/moro/commits?author=Wolf-Rost "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/2776719?v=3" width="100px;"/><br /><sub><b>Henri Koski</b></sub>](https://github.com/heppu)<br />[📖](https://github.com/omidfi/moro/commits?author=heppu "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/6113341?v=3" width="100px;"/><br /><sub><b>Olavi Haapala</b></sub>](https://twitter.com/0lpeh)<br />[📖](https://github.com/omidfi/moro/commits?author=olpeh "Documentation") [🐛](https://github.com/omidfi/moro/issues?q=author%3Aolpeh "Bug reports") |
108+
| [<img src="https://avatars2.githubusercontent.com/u/7697632?v=3" width="100px;"/><br /><sub><b>Nick Okapi</b></sub>](http://omid.fi)<br />[💬](#question-albacoretuna "Answering Questions") [🐛](https://github.com/albacoretuna/moro/issues?q=author%3Aalbacoretuna "Bug reports") [💻](https://github.com/albacoretuna/moro/commits?author=albacoretuna "Code") [📖](https://github.com/albacoretuna/moro/commits?author=albacoretuna "Documentation") [👀](#review-albacoretuna "Reviewed Pull Requests") [⚠️](https://github.com/albacoretuna/moro/commits?author=albacoretuna "Tests") | [<img src="https://avatars2.githubusercontent.com/u/4089975?v=3" width="100px;"/><br /><sub><b>Mario</b></sub>](https://github.com/mario-s)<br />[💻](https://github.com/albacoretuna/moro/commits?author=mario-s "Code") [📖](https://github.com/albacoretuna/moro/commits?author=mario-s "Documentation") [⚠️](https://github.com/albacoretuna/moro/commits?author=mario-s "Tests") | [<img src="https://avatars2.githubusercontent.com/u/2211050?v=3" width="100px;"/><br /><sub><b>Karl Fleischmann</b></sub>](https://twitter.com/fleischie28)<br />[💻](https://github.com/albacoretuna/moro/commits?author=fleischie "Code") [📖](https://github.com/albacoretuna/moro/commits?author=fleischie "Documentation") [⚠️](https://github.com/albacoretuna/moro/commits?author=fleischie "Tests") | [<img src="https://avatars0.githubusercontent.com/u/12087554?v=3" width="100px;"/><br /><sub><b>Niloofar Motamed</b></sub>](https://niloofarmotamed.com)<br />[📖](https://github.com/albacoretuna/moro/commits?author=niloomotita "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/5592940?v=3" width="100px;"/><br /><sub><b>Wolf-Rost</b></sub>](https://github.com/Wolf-Rost)<br />[📖](https://github.com/albacoretuna/moro/commits?author=Wolf-Rost "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/2776719?v=3" width="100px;"/><br /><sub><b>Henri Koski</b></sub>](https://github.com/heppu)<br />[📖](https://github.com/albacoretuna/moro/commits?author=heppu "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/6113341?v=3" width="100px;"/><br /><sub><b>Olavi Haapala</b></sub>](https://twitter.com/0lpeh)<br />[📖](https://github.com/albacoretuna/moro/commits?author=olpeh "Documentation") [🐛](https://github.com/albacoretuna/moro/issues?q=author%3Aolpeh "Bug reports") |
97109
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
98-
| [<img src="https://avatars1.githubusercontent.com/u/15911342?v=4" width="100px;"/><br /><sub><b>Walid Mani</b></sub>](https://github.com/Flouss)<br />[💻](https://github.com/omidfi/moro/commits?author=Flouss "Code") |
110+
| [<img src="https://avatars1.githubusercontent.com/u/15911342?v=4" width="100px;"/><br /><sub><b>Walid Mani</b></sub>](https://github.com/Flouss)<br />[💻](https://github.com/albacoretuna/moro/commits?author=Flouss "Code") |
99111
<!-- ALL-CONTRIBUTORS-LIST:END -->
100112

101113
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

lib/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const report = (args, options, logger, date) => {
116116
console.log(table)
117117

118118
if (!data.end) {
119-
helpers.shouldWorkUntil(data.start, config)
119+
helpers.shouldWorkUntil(data.start, config, data.breakDuration)
120120
}
121121

122122
spinnerInfo(spinner, constants.TEXT.helpTip)

lib/utils/configManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// packages and natives
44
const path = require('path')
55
const jsonfile = require('jsonfile')
6-
const osHomedir = require('os-homedir')
6+
const osHomedir = require('os').homedir()
77
const Promise = require('bluebird')
88
const fs = require('fs-extra')
99

@@ -23,7 +23,7 @@ let configFile
2323

2424
const initConfigFile = () => {
2525
const CONFIG_FILE_DEFAULT = path.join(__dirname, '..', 'config.json')
26-
const CONFIG_FILE_LOCAL = path.join(osHomedir(), '.moro-config.json')
26+
const CONFIG_FILE_LOCAL = path.join(osHomedir, '.moro-config.json')
2727
if (!fs.existsSync(CONFIG_FILE_LOCAL)) {
2828
fs.copySync(CONFIG_FILE_DEFAULT, CONFIG_FILE_LOCAL)
2929
}
@@ -45,7 +45,7 @@ const logTestMode = isTestMode => {
4545
const getDBFilePath = () => {
4646
initConfigFile()
4747
const configPath = jsonfile.readFileSync(configFile).DB_FILE_MAIN
48-
const defaultPath = path.join(osHomedir(), constants.DB_FILE_MAIN)
48+
const defaultPath = path.join(osHomedir, constants.DB_FILE_MAIN)
4949

5050
// test mode
5151
if (isTestMode) {

lib/utils/helpers.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ const calculateWorkHours = (start, end, pause) => {
4848
}
4949

5050
// to tell users when they can go home!
51-
const shouldWorkUntil = (start, CONFIG) => {
51+
const shouldWorkUntil = (start, CONFIG, breakDuration) => {
5252
const goHomeTime = composeDateObject(start)
5353
.add({ hour: CONFIG.HOURS_IN_A_WORK_DAY })
54-
.add({ minutes: CONFIG.BREAK_DEFAULT })
54+
// if user has added a total break duration for today, consider that, otherwise just use the default duration
55+
.add({ minutes: breakDuration || CONFIG.BREAK_DEFAULT })
5556
.format('HH:mm')
5657
// FIXME this can be moved to utils/spinner.js as well
5758
// for CI

0 commit comments

Comments
 (0)