mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
4adb8a8796 | |||
48e1993b24 | |||
8a3375bb23 | |||
8bd54a7427 | |||
fcbbf05933 | |||
9733087094 | |||
da4e02199a | |||
09a16dea1e | |||
4c7adf0943 | |||
216a8eaa0a |
33
HISTORY.rst
33
HISTORY.rst
@ -3,6 +3,39 @@ History
|
||||
-------
|
||||
|
||||
|
||||
1.6.5 (2014-03-05)
|
||||
++++++++++++++++++
|
||||
|
||||
- upgrade external wakatime package to v1.0.1
|
||||
- use new domain wakatime.com
|
||||
|
||||
|
||||
1.6.4 (2014-02-05)
|
||||
++++++++++++++++++
|
||||
|
||||
- upgrade external wakatime package to v1.0.0
|
||||
- support for mercurial revision control
|
||||
|
||||
|
||||
1.6.3 (2014-01-15)
|
||||
++++++++++++++++++
|
||||
|
||||
- upgrade common wakatime package to v0.5.3
|
||||
|
||||
|
||||
1.6.2 (2014-01-14)
|
||||
++++++++++++++++++
|
||||
|
||||
- upgrade common wakatime package to v0.5.2
|
||||
|
||||
|
||||
1.6.1 (2013-12-13)
|
||||
++++++++++++++++++
|
||||
|
||||
- upgrade common wakatime package to v0.5.1
|
||||
- second line in .wakatime-project now sets branch name
|
||||
|
||||
|
||||
1.6.0 (2013-12-13)
|
||||
++++++++++++++++++
|
||||
|
||||
|
@ -8,7 +8,7 @@ Installation
|
||||
|
||||
Heads Up! For Sublime Text 2 on Windows & Linux, WakaTime depends on [Python](http://www.python.org/getit/) being installed to work correctly.
|
||||
|
||||
1. Get an api key from: https://wakati.me
|
||||
1. Get an api key from: https://wakatime.com/#apikey
|
||||
|
||||
2. Using [Sublime Package Control](http://wbond.net/sublime_packages/package_control):
|
||||
|
||||
@ -18,16 +18,16 @@ Heads Up! For Sublime Text 2 on Windows & Linux, WakaTime depends on [Python](ht
|
||||
|
||||
c) Type `wakatime`, then press `enter` with the `WakaTime` plugin selected.
|
||||
|
||||
3. You will see a prompt at the bottom asking for your [api key](https://www.wakati.me/#apikey). Enter your api key, then press `enter`.
|
||||
3. You will see a prompt at the bottom asking for your [api key](https://www.wakatime.com/#apikey). Enter your api key, then press `enter`.
|
||||
|
||||
4. Use Sublime and your time will automatically be tracked for you.
|
||||
|
||||
5. Visit https://wakati.me to see your logged time.
|
||||
5. Visit https://wakatime.com to see your logged time.
|
||||
|
||||
6. Consider installing [BIND9](https://help.ubuntu.com/community/BIND9ServerHowto#Caching_Server_configuration) to cache your repeated DNS requests: `sudo apt-get install bind9`
|
||||
|
||||
Screen Shots
|
||||
------------
|
||||
|
||||

|
||||

|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
""" ==========================================================
|
||||
File: WakaTime.py
|
||||
Description: Automatic time tracking for Sublime Text 2 and 3.
|
||||
Maintainer: WakaTi.me <support@wakatime.com>
|
||||
Website: https://www.wakati.me/
|
||||
Maintainer: WakaTime <support@wakatime.com>
|
||||
Website: https://www.wakatime.com/
|
||||
==========================================================="""
|
||||
|
||||
__version__ = '1.6.0'
|
||||
__version__ = '1.6.5'
|
||||
|
||||
import sublime
|
||||
import sublime_plugin
|
||||
|
@ -3,7 +3,7 @@
|
||||
// This settings file will be overwritten when upgrading.
|
||||
|
||||
{
|
||||
// Your api key from https://www.wakati.me/#apikey
|
||||
// Your api key from https://www.wakatime.com/#apikey
|
||||
// Set this in your User specific WakaTime.sublime-settings file.
|
||||
"api_key": "",
|
||||
|
||||
|
@ -12,3 +12,4 @@ Patches and Suggestions
|
||||
-----------------------
|
||||
|
||||
- 3onyc <3onyc@x3tech.com>
|
||||
- userid <xixico@ymail.com>
|
||||
|
@ -3,6 +3,36 @@ History
|
||||
-------
|
||||
|
||||
|
||||
1.0.1 (2014-03-05)
|
||||
++++++++++++++++++
|
||||
|
||||
- use new domain name wakatime.com
|
||||
|
||||
|
||||
1.0.0 (2014-02-05)
|
||||
++++++++++++++++++
|
||||
|
||||
- detect project name and branch name from mercurial revision control
|
||||
|
||||
|
||||
0.5.3 (2014-01-15)
|
||||
++++++++++++++++++
|
||||
|
||||
- bug fix for unicode in Python3
|
||||
|
||||
|
||||
0.5.2 (2014-01-14)
|
||||
++++++++++++++++++
|
||||
|
||||
- minor bug fix for Subversion on non-English systems
|
||||
|
||||
|
||||
0.5.1 (2013-12-13)
|
||||
++++++++++++++++++
|
||||
|
||||
- second line in .wakatime-project file now sets branch name
|
||||
|
||||
|
||||
0.5.0 (2013-12-13)
|
||||
++++++++++++++++++
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2013 Alan Hamlett https://wakati.me
|
||||
Copyright (c) 2013 Alan Hamlett https://wakatime.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -12,7 +12,7 @@ modification, are permitted provided that the following conditions are met:
|
||||
in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* Neither the names of Wakatime or Wakati.Me, nor the names of its
|
||||
* Neither the names of Wakatime or WakaTime, nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
WakaTime
|
||||
========
|
||||
|
||||
Automatic time tracking for your text editor. This is the common interface
|
||||
for the WakaTime api. You shouldn't need to directly use this package.
|
||||
Fully automatic time tracking for your text editor.
|
||||
|
||||
This is the common interface for the WakaTime api. You shouldn't need to directly use this package unless you are creating a new plugin.
|
||||
|
||||
Go to http://wakatime.com to install the plugin for your text editor.
|
||||
|
||||
@ -10,4 +11,4 @@ Go to http://wakatime.com to install the plugin for your text editor.
|
||||
Installation
|
||||
------------
|
||||
|
||||
https://www.wakati.me/help/plugins/installing-plugins
|
||||
https://www.wakatime.com/help/plugins/installing-plugins
|
||||
|
@ -12,7 +12,7 @@ setup(
|
||||
version=VERSION,
|
||||
license='BSD 3 Clause',
|
||||
description=' '.join([
|
||||
'Action event appender for Wakati.Me, a time',
|
||||
'Action event appender for WakaTime, a time',
|
||||
'tracking api for text editors.',
|
||||
]),
|
||||
long_description=open('README.rst').read(),
|
||||
|
@ -3,9 +3,8 @@
|
||||
wakatime
|
||||
~~~~~~~~
|
||||
|
||||
Common interface to WakaTime.com for most text editor plugins.
|
||||
WakaTime.com is fully automatic time tracking for text editors.
|
||||
More info at http://wakatime.com
|
||||
Common interface to the WakaTime api.
|
||||
http://wakatime.com
|
||||
|
||||
:copyright: (c) 2013 Alan Hamlett.
|
||||
:license: BSD, see LICENSE for more details.
|
||||
@ -14,7 +13,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
__title__ = 'wakatime'
|
||||
__version__ = '0.5.0'
|
||||
__version__ = '1.0.1'
|
||||
__author__ = 'Alan Hamlett'
|
||||
__license__ = 'BSD'
|
||||
__copyright__ = 'Copyright 2013 Alan Hamlett'
|
||||
@ -135,7 +134,7 @@ def parseArguments(argv):
|
||||
|
||||
# define supported command line arguments
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Wakati.Me event api appender')
|
||||
description='Common interface for the WakaTime api.')
|
||||
parser.add_argument('--file', dest='targetFile', metavar='file',
|
||||
action=FileAction, required=True,
|
||||
help='absolute path to file for current action')
|
||||
@ -150,7 +149,7 @@ def parseArguments(argv):
|
||||
help='optional text editor plugin name and version '+
|
||||
'for User-Agent header')
|
||||
parser.add_argument('--key', dest='key',
|
||||
help='your wakati.me api key; uses api_key from '+
|
||||
help='your wakatime api key; uses api_key from '+
|
||||
'~/.wakatime.conf by default')
|
||||
parser.add_argument('--ignore', dest='ignore', action='append',
|
||||
help='filename patterns to ignore; POSIX regex syntax; can be used more than once')
|
||||
@ -228,7 +227,7 @@ def get_user_agent(plugin):
|
||||
|
||||
def send_action(project=None, branch=None, stats={}, key=None, targetFile=None,
|
||||
timestamp=None, isWrite=None, plugin=None, **kwargs):
|
||||
url = 'https://www.wakati.me/api/v1/actions'
|
||||
url = 'https://www.wakatime.com/api/v1/actions'
|
||||
log.debug('Sending action to api at %s' % url)
|
||||
data = {
|
||||
'time': timestamp,
|
||||
|
@ -13,15 +13,18 @@ import logging
|
||||
import os
|
||||
|
||||
from .base import BaseProject
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
except ImportError:
|
||||
from ..packages.ordereddict import OrderedDict
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# str is unicode in Python3
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
||||
class Git(BaseProject):
|
||||
|
||||
def process(self):
|
||||
|
@ -18,13 +18,41 @@ from .base import BaseProject
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# str is unicode in Python3
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
||||
class Mercurial(BaseProject):
|
||||
|
||||
def process(self):
|
||||
return False
|
||||
self.configDir = self._find_hg_config_dir(self.path)
|
||||
return self.configDir is not None
|
||||
|
||||
def name(self):
|
||||
if self.configDir:
|
||||
return unicode(os.path.basename(os.path.dirname(self.configDir)))
|
||||
return None
|
||||
|
||||
def branch(self):
|
||||
return None
|
||||
if self.configDir:
|
||||
branch_file = os.path.join(self.configDir, 'branch')
|
||||
try:
|
||||
with open(branch_file) as fh:
|
||||
return unicode(fh.readline().strip().rsplit('/', 1)[-1])
|
||||
except IOError:
|
||||
pass
|
||||
return unicode('default')
|
||||
|
||||
def _find_hg_config_dir(self, path):
|
||||
path = os.path.realpath(path)
|
||||
if os.path.isfile(path):
|
||||
path = os.path.split(path)[0]
|
||||
if os.path.isdir(os.path.join(path, '.hg')):
|
||||
return os.path.join(path, '.hg')
|
||||
split_path = os.path.split(path)
|
||||
if split_path[1] == '':
|
||||
return None
|
||||
return self._find_hg_config_dir(split_path[0])
|
||||
|
@ -29,6 +29,13 @@ from .base import BaseProject
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# str is unicode in Python3
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
||||
class ProjectMap(BaseProject):
|
||||
|
||||
def process(self):
|
||||
|
@ -24,6 +24,13 @@ except ImportError:
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# str is unicode in Python3
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
||||
class Subversion(BaseProject):
|
||||
|
||||
def process(self):
|
||||
@ -41,6 +48,7 @@ class Subversion(BaseProject):
|
||||
info = OrderedDict()
|
||||
stdout = None
|
||||
try:
|
||||
os.environ['LANG'] = 'en_US'
|
||||
stdout, stderr = Popen([
|
||||
'svn', 'info', os.path.realpath(path)
|
||||
], stdout=PIPE, stderr=PIPE).communicate()
|
||||
|
@ -4,7 +4,8 @@
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Information from a .wakatime-project file about the project for
|
||||
a given file.
|
||||
a given file. First line of .wakatime-project sets the project
|
||||
name. Second line sets the current branch name.
|
||||
|
||||
:copyright: (c) 2013 Alan Hamlett.
|
||||
:license: BSD, see LICENSE for more details.
|
||||
@ -19,24 +20,37 @@ from .base import BaseProject
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# str is unicode in Python3
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
||||
class WakaTime(BaseProject):
|
||||
|
||||
def process(self):
|
||||
self.config = self._find_config(self.path)
|
||||
self._project_name = None
|
||||
self._project_branch = None
|
||||
|
||||
if self.config:
|
||||
|
||||
try:
|
||||
with open(self.config) as fh:
|
||||
self._project_name = unicode(fh.readline().strip())
|
||||
self._project_branch = unicode(fh.readline().strip())
|
||||
except IOError as e:
|
||||
log.exception("Exception:")
|
||||
|
||||
return True
|
||||
return False
|
||||
|
||||
def name(self):
|
||||
try:
|
||||
with open(self.config) as fh:
|
||||
return unicode(fh.readline().strip())
|
||||
except IOError as e:
|
||||
log.exception("Exception:")
|
||||
return None
|
||||
return self._project_name
|
||||
|
||||
def branch(self):
|
||||
return None
|
||||
return self._project_branch
|
||||
|
||||
def _find_config(self, path):
|
||||
path = os.path.realpath(path)
|
||||
|
Reference in New Issue
Block a user