diff --git a/README.md b/README.md index 88c59be..c9d18b4 100644 --- a/README.md +++ b/README.md @@ -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 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: Atom writes errors to the developer console at `View -> Developer -> Toggle Developer Tools`. diff --git a/lib/wakatime.coffee b/lib/wakatime.coffee index 758d699..3a0785f 100644 --- a/lib/wakatime.coffee +++ b/lib/wakatime.coffee @@ -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() @@ -102,7 +80,7 @@ finishActivation = () -> setupEventHandlers() statusBarTileView?.setTitle('WakaTime ready') statusBarTileView?.setStatus() - + settingChangedHandler = (settings) -> if settings.showStatusBarIcon statusBarTileView?.show() @@ -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 @@ -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() ) ) @@ -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 diff --git a/package.json b/package.json index 32cf204..4255357 100644 --- a/package.json +++ b/package.json @@ -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 ", - "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": { @@ -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" }