-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
139 lines (105 loc) · 4.51 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
wakatimer: UNOFFICIAL WakaTime Plugin for RStudio
------
```{r, eval = TRUE, echo = FALSE}
library(remoji)
```
Currently, test cheking **Mac OS X only**. Please report other plaform result and [issues](https://github.com/uribo/wakatimer/issues/new).
![進捗どうですか](https://github.com/uribo/wakatimer/raw/108c5fb6f2e894fbccf025fb42fb0dbdd8033ca5/inst/shigotohajime_man_good.png)
(image by いらすとや http://www.irasutoya.com)
## `r emoji("computer")` Requirement and Setup
1. [Create a WakaTime accont](https://wakatime.com/signup).
2. Configure your own [API key](https://wakatime.com/settings).
3. [Create a new app](https://wakatime.com/apps) and get an OAuth 2.0 client token to use wakatimer. Add `http://localhost:1410/` as an Authorized Redirect URI.
Then, Install package from GitHub repository.
```{r, eval = FALSE}
devtools::install_github("uribo/wakatimer")
```
## `r emoji("beginner")` How to Use
Loading package and run `write_scope()` function to authorize.
```{r, eval = FALSE}
library(wakatimer)
write_scope()
# Waiting for authentication in browser...
# Press Esc/Ctrl + C to abort
# Authentication complete.
```
Next, wakatime api key and app id set to R global environment.
```{r, eval = FALSE}
Sys.setenv("WAKATIME_KEY" = "<your api key>")
Sys.setenv("WAKATIME_ID" = "<application id>")
Sys.setenv("WAKATIME_SECRET" = "<application secret>")
```
I recommend these variables are add to **.Rprofile** such as below.
```{r, eval = FALSE}
# .Rprofile
Sys.setenv(
WAKATIME_KEY = "<your api key>",
WAKATIME_ID = "<application id>",
WAKATIME_SECRET = "<application secret>"
)
```
**Use like you normally do and your time will record by log.**
```{r, eval = FALSE}
q()
# execute `wt_post()` function in the background
```
The **`{wakatimer}`** provide current sessions modificate file information will sent to WakaTime!! Visit https://wakatime.com to see your logged time. However, when in such situation out of scope for post to wakatime API 1) *Force Quit RStudio* 2) *Restart R*.
Also, you can confirm in RStudio :)
```{r, eval = FALSE}
# project,language,branch,is_write,is_debugging,lines
req <- wakatimer:::wt_api(resource = "heartbeats",
key = Sys.getenv("WAKATIME_KEY"),
param = list(date = format(Sys.Date(), "%m/%d/%Y"), time = "time", "entity"))
req$data %>% head() %>% knitr::kable(format = "markdown")
```
|entity |id | time|type |
|:------------------------------------------------------|:------------------------------------|----------:|:----|
|~/git/r_pkg/wakatimer/vignettes/wakatimer-workflow.Rmd |02d27d37-d228-49f4-9067-2ee7260fc14d | 1453734664|file |
|~/git/r_pkg/wakatimer/R/zzz.R |207cd092-251b-40d4-b1c4-f26a296f298e | 1453742043|file |
|~/git/r_pkg/wakatimer/R/zzz.R |94d89fae-3407-4ee0-a920-8cce3f375038 | 1453742827|file |
|~/git/r_pkg/wakatimer/.Rprofile |61bc6270-3b9b-4f9e-8241-9a1a8b2b5f08 | 1453745367|file |
|~/git/r_pkg/wakatimer/R/wt_sync.R |53b85419-fc44-4fc8-beef-f7d6f94aaa17 | 1453746391|file |
|~/git/r_pkg/wakatimer/README.Rmd |71a5c819-6299-4287-b3cd-55f79d872ab7 | 1453747159|file |
### Recommend
Do not forget loading package.
```{r, eval = FALSE}
# .Rprofile
.First <- function() {
# invalid when rmarkdown render
if(interactive()) {
suppressMessages(library(wakatimer))
wakatimer::write_scope()
}
}
```
## `r emoji("moyai")` Milestone
0.1.0
- [x] セッション中のファイル変更を自動的に記録、POSTするまで
- [x] lineno, cursorpos パラメータの追加
0.2.0
- [x] テストファイルの整備
- [ ] 継続的インテグレーションが実行できるようにする
- [ ] **`{rstudioaddin}`**との連携
- [ ] .wakatime.cfg に管理対象外のファイルを追加する関数
- [ ] 管理対象のファイルはエラー扱いにする
- [ ] APIを使った可視化
- [ ] 全APIへの対応
- [ ] Shiny Widget への対応
- [ ] vignettes, documentの充実
- [x] オフラインでの記録と再接続時の投稿
- [ ] Mac以外のOSへの対応
## `r emoji("rotating_light")` Current Issues
多分、正常に動作ているだろうという不安さ。