Skip to content

Commit

Permalink
Merge pull request #54 from slang800/master
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
alanhamlett committed Jun 4, 2016
2 parents 94f2711 + 4415ca9 commit 7802d5a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 60 deletions.
28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
atom-wakatime
=============
# atom-wakatime

Quantify your coding inside GitHub's Atom editor.


Installation
------------
## Installation

1. Inside Atom, navigate to `Preferences`/`Settings` -> `Install` and search for `wakatime`.

![Project Overview](https://wakatime.com/static/img/ScreenShots/atom-wakatime-install-1.png)
![Project Overview](https://wakatime.com/static/img/ScreenShots/atom-wakatime-install-1.png)

2. Click the `Install` button.

![Project Overview](https://wakatime.com/static/img/ScreenShots/atom-wakatime-install-2.png)
![Project Overview](https://wakatime.com/static/img/ScreenShots/atom-wakatime-install-2.png)

3. Click `Settings`, then enter your [api key](https://wakatime.com/settings#apikey).

4. Use Atom like you normally do and your time will automatically be tracked for you.

5. Visit https://wakatime.com to see your logged time.

5. Visit <https://wakatime.com> to see your logged time.

Screen Shots
------------
## Screen Shots

![Project Overview](https://wakatime.com/static/img/ScreenShots/Screen-Shot-2016-03-21.png)


Configuring
-----------
## Configuring

Settings for atom-wakatime are under `Settings -> Packages -> wakatime -> Settings`.

Additional settings are in `$HOME/.wakatime.cfg` for [wakatime cli](https://github.com/wakatime/wakatime#configuring).

## Troubleshooting

Troubleshooting
---------------

Note: Behind a proxy? Configure Atom to use your proxy when installing wakatime:
https://github.com/atom/apm#behind-a-firewall
Note: Behind a proxy? Configure Atom to use your proxy when installing wakatime: <https://github.com/atom/apm#behind-a-firewall>

Atom writes errors to the developer console at `View -> Developer -> Toggle Developer Tools`.

Expand Down
46 changes: 12 additions & 34 deletions lib/wakatime.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,6 @@ ini = require 'ini'
StatusBarTileView = require './status-bar-tile-view'

module.exports =
config:
apikey:
title: 'Api Key'
description: 'Your secret key from https://wakatime.com/settings.'
type: 'string'
default: ''
order: 1
ignore:
title: 'Exclude File Paths'
description: 'Exclude these file paths from logging; POSIX regex patterns'
type: 'array'
default: ['^/var/', '^/tmp/', '^/private/', 'COMMIT_EDITMSG$', 'PULLREQ_EDITMSG$', 'MERGE_MSG$']
items:
type: 'string'
order: 2
showStatusBarIcon:
title: 'Show WakaTime in Atom status bar'
description: 'Add an icon to Atom\'s status bar with WakaTime info. Hovering over the icon shows current WakaTime status or error message.'
type: 'boolean'
default: true
order: 3

activate: (state) ->
packageVersion = atom.packages.getLoadedPackage('wakatime').metadata.version
setupConfigs()
Expand Down Expand Up @@ -102,7 +80,7 @@ finishActivation = () ->
setupEventHandlers()
statusBarTileView?.setTitle('WakaTime ready')
statusBarTileView?.setStatus()

settingChangedHandler = (settings) ->
if settings.showStatusBarIcon
statusBarTileView?.show()
Expand Down Expand Up @@ -183,24 +161,24 @@ enoughTimePassed = (time) ->
return lastHeartbeat + 120000 < time

setupEventHandlers = (callback) ->
atom.workspace.observeTextEditors (editor) =>
atom.workspace.observeTextEditors (editor) ->
try
buffer = editor.getBuffer()
buffer.onDidSave (e) =>
buffer.onDidSave (e) ->
file = buffer.file
if file? and file
lineno = null
if editor.cursors.length > 0
lineno = editor.cursors[0].getCurrentLineBufferRange().end.row + 1
sendHeartbeat(file, lineno, true)
buffer.onDidChange (e) =>
buffer.onDidChange (e) ->
file = buffer.file
if file? and file
lineno = null
if editor.cursors.length > 0
lineno = editor.cursors[0].getCurrentLineBufferRange().end.row + 1
sendHeartbeat(file, lineno)
editor.onDidChangeCursorPosition (e) =>
editor.onDidChangeCursorPosition (e) ->
file = buffer.file
if file? and file
lineno = null
Expand Down Expand Up @@ -263,10 +241,10 @@ installPython = (callback) ->
statusBarTileView?.setStatus('extracting python...')

unzip(zipFile, __dirname + path.sep + 'python', ->
fs.unlink(zipFile)
console.log 'Finished installing python.'
if callback?
callback()
fs.unlink(zipFile)
console.log 'Finished installing python.'
if callback?
callback()
)
)

Expand Down Expand Up @@ -468,10 +446,10 @@ formatDate = (date) ->
ampm = 'AM'
hour = date.getHours()
if (hour > 11)
ampm = 'PM'
hour = hour - 12
ampm = 'PM'
hour = hour - 12
if (hour == 0)
hour = 12
hour = 12
minute = date.getMinutes()
if (minute < 10)
minute = '0' + minute
Expand Down
47 changes: 40 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
{
"name": "wakatime",
"version": "6.0.2",
"description": "Fitbit for programmers. Get automated metrics and insights about your programming.",
"license": "BSD",
"repository": "https://github.com/wakatime/atom-wakatime",
"version": "6.0.2",
"author": "WakaTime <support@wakatime.com>",
"main": "./lib/wakatime",
"engines": {
"atom": ">0.50.0"
"configSchema": {
"apikey": {
"title": "Api Key",
"description": "Your secret key from https://wakatime.com/settings.",
"type": "string",
"default": "",
"order": 1
},
"ignore": {
"title": "Exclude File Paths",
"description": "Exclude these file paths from logging; POSIX regex patterns",
"type": "array",
"default": [
"^/var/",
"^/tmp/",
"^/private/",
"COMMIT_EDITMSG$",
"PULLREQ_EDITMSG$",
"MERGE_MSG$"
],
"items": {
"type": "string"
},
"order": 2
},
"showStatusBarIcon": {
"title": "Show WakaTime in Atom status bar",
"description": "Add an icon to Atom's status bar with WakaTime info. Hovering over the icon shows current WakaTime status or error message.",
"type": "boolean",
"default": true,
"order": 3
}
},
"consumedServices": {
"status-bar": {
Expand All @@ -21,5 +48,11 @@
"ini": "^1.3.4",
"request": "2.61.0",
"rimraf": "2.4.3"
}
},
"engines": {
"atom": ">0.50.0"
},
"license": "BSD-3-Clause",
"main": "./lib/wakatime",
"repository": "https://github.com/wakatime/atom-wakatime"
}

0 comments on commit 7802d5a

Please sign in to comment.