- Guide to install and start contributing
- Open Sublime Text.
- Go to Preferences -> Browse packages.
- A new window containing Sublime packages directory will open up. Let's call this folder
SublimePackagesFolder. - Open your terminal and navigate to
SublimePackagesFolder. - Clone this repository inside
SublimePackagesFolder(This makes sure that Sublime recognizes our plugin package to execute). - Copy the Context.sublime-menu file to your User Packages directory. To go to User Packages directory, navigate to
SublimePackagesFolder/Userfolder. - Change configuration settings in the CustomPreferences.sublime-settings file.
- timeout - Set the interval you want to run the logging thread
- api_token - Token to connect to the hosted Django API
- python-env - The absolute path of the python environment for this project (can be just left as
python3if native environment is to be used) - request-url - The url for the django api to send the log values to
- You are all set. The plugin is now active and is running in the background.
- Open Sublime Text.
- Open a file that you wish to work on.
- In the file pane, right click and select the option
View CodeTime Dashboard. - Access the Django UI TBD
Note: Please install and use Sublime Text 3 only for development.
- Perform the steps in the Installation section described above.
- Install Package Control by pressing
ctrl+shift+p (Win/Linux)orcmd+shift+p (Mac). - Run
python setup.py installto install all the dependencies. - Back in Sublime Text, Open Package Control by pressing
ctrl+shift+p (Win/Linux)orcmd+shift+p (Mac). Navigate to optionPackage Control: Install Package. Install packages:SublimeLinter,SublimeLinter-flake8,sublack,UnitTesting. - Navigate to
Package Settingsoption underPreferencesin Menu bar. ForMacusers, thePreferencesoption will be found underSublime Textin Menu bar. - Once under Package Settings, move to
SublimeLinter > Settings. You will see that a file with the nameSublimeLinter.sublime-settings - Useropens up. Copy the following code snippet to ignore a linting error related to Tabs vs Spaces war.
// SublimeLinter Settings - User
{
"linters": {
"flake8": {
"args": ["--ignore=W191"],
}
}
}
python --version
= 3.6
mysql --version
mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper- Django and code base requirements
- Linter, which adheres to PEP8 standards:
flake8 - For auto code formatters, we have used
blackand we recommend the same.
Note: We recommend using virtualenv. Also, always makemigrations and commit those new migration files to respository to keep track of changes to Database.
- Install MySQL Client, Use user
$DB_USERand assign password$DB_PASSWORD - Export the following variables, better add to user profile:
export MYSQL_CODE_TIME_DB_NAME=codetime_dbexport MYSQL_CODE_TIME_USER=$DB_USERexport MYSQL_CODE_TIME_PASSWORD=$DB_PASSWORDexport MYSQL_CODE_TIME_HOST=localhostexport MYSQL_CODE_TIME_CONNECTION_PORT=3306export CODE_TIME_SECRET_KEY=Sample
- Install all the requirements) in your environment.
- Go to the codetime_server folder tree,
cd code/codetime_server - Run following commands:
python manage.py makemigrationspython manage.py migrate- Finally run server on port 8000:
python manage.py runserver 0.0.0.0:8000
Refer to the WHAT documentation of codetime_server over here: docs
- For local execution of the tests, make sure that the Sublime package
UnitTestingis installed. - Navigate to a test file in
testsfolder that you want to run your tests for. - Open Package Control and type in
UnitTesting: Test Current Package. - The tests will run and a small output panel pops up showing that the tests are running.
For more information and guide on how to run tests, take a look at this README.md by randy3k. For examples on how to write tests for sublime plugin, take a look at this Repo by randy3k.
- Navigate to the folder
code/codetime_serverand run the commandmanage.py test codetime
- Run the command
flake8 --max-line-length=200from the root folder
- From the root folder run the command
coverage run --source='.' --omit=*sgi*,*app*