TokiCLI 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +9 -17
  4. data/.rspec +3 -0
  5. data/.travis.yml +3 -0
  6. data/CHANGELOG.md +4 -0
  7. data/README.md +99 -163
  8. data/Rakefile +5 -0
  9. data/TokiCLI.gemspec +5 -4
  10. data/bin/toki +2 -2
  11. data/lib/API/helpers.rb +27 -170
  12. data/lib/API/toki_api.rb +227 -0
  13. data/lib/API/toki_db.rb +67 -0
  14. data/lib/TokiCLI.rb +270 -5
  15. data/lib/TokiCLI/adnimport.rb +202 -0
  16. data/lib/TokiCLI/fileops.rb +187 -0
  17. data/lib/TokiCLI/status.rb +49 -37
  18. data/lib/TokiCLI/version.rb +1 -1
  19. data/lib/TokiCLI/view.rb +133 -86
  20. data/lib/TokiServer/.bowerrc +3 -0
  21. data/lib/TokiServer/.gitignore +2 -0
  22. data/lib/TokiServer/Gemfile +1 -0
  23. data/lib/TokiServer/bower.json +0 -0
  24. data/lib/TokiServer/bower_components/fastclick/.bower.json +4 -4
  25. data/lib/TokiServer/bower_components/fastclick/bower.json +1 -1
  26. data/lib/TokiServer/bower_components/fastclick/lib/fastclick.js +33 -2
  27. data/lib/TokiServer/bower_components/foundation/.bower.json +5 -4
  28. data/lib/TokiServer/bower_components/foundation/bower.json +2 -1
  29. data/lib/TokiServer/bower_components/foundation/css/foundation.css +2173 -922
  30. data/lib/TokiServer/bower_components/foundation/css/foundation.css.map +7 -0
  31. data/lib/TokiServer/bower_components/foundation/css/normalize.css +53 -16
  32. data/lib/TokiServer/bower_components/foundation/css/normalize.css.map +7 -0
  33. data/lib/TokiServer/bower_components/foundation/js/foundation.js +782 -542
  34. data/lib/TokiServer/bower_components/foundation/js/foundation.min.js +4 -3
  35. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.abide.js +45 -31
  36. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.accordion.js +12 -6
  37. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.alert.js +5 -5
  38. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.clearing.js +34 -10
  39. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.dropdown.js +83 -29
  40. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.equalizer.js +3 -3
  41. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.interchange.js +25 -12
  42. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.joyride.js +112 -40
  43. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.js +19 -5
  44. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.magellan.js +22 -11
  45. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.offcanvas.js +52 -8
  46. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.orbit.js +133 -271
  47. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.reveal.js +27 -20
  48. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.slider.js +73 -33
  49. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.tab.js +88 -31
  50. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.tooltip.js +7 -5
  51. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.topbar.js +44 -24
  52. data/lib/TokiServer/bower_components/foundation/js/vendor/fastclick.js +2 -2
  53. data/lib/TokiServer/bower_components/foundation/js/vendor/modernizr.js +2 -2
  54. data/lib/TokiServer/bower_components/foundation/scss/foundation.scss +38 -38
  55. data/lib/TokiServer/bower_components/foundation/scss/foundation/_functions.scss +3 -3
  56. data/lib/TokiServer/bower_components/foundation/scss/foundation/_settings.scss +417 -271
  57. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_accordion.scss +110 -6
  58. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_alert-boxes.scss +2 -2
  59. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_block-grid.scss +2 -2
  60. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_breadcrumbs.scss +8 -3
  61. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_button-groups.scss +99 -9
  62. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_buttons.scss +66 -28
  63. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_clearing.scss +5 -5
  64. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_dropdown-buttons.scss +4 -4
  65. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_dropdown.scss +48 -35
  66. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_forms.scss +104 -32
  67. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_global.scss +48 -30
  68. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_grid.scss +19 -4
  69. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_icon-bar.scss +293 -0
  70. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_joyride.scss +11 -9
  71. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_keystrokes.scss +4 -4
  72. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_labels.scss +4 -2
  73. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_magellan.scss +1 -1
  74. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_offcanvas.scss +193 -35
  75. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_orbit.scss +92 -147
  76. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_pagination.scss +22 -10
  77. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_panels.scss +10 -7
  78. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_pricing-tables.scss +11 -11
  79. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_progress-bars.scss +2 -2
  80. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_range-slider.scss +29 -9
  81. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_reveal.scss +60 -56
  82. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_side-nav.scss +3 -2
  83. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_split-buttons.scss +2 -2
  84. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_sub-nav.scss +2 -2
  85. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_switches.scss +226 -0
  86. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tables.scss +13 -7
  87. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tabs.scss +22 -8
  88. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_thumbs.scss +2 -4
  89. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_toolbar.scss +70 -0
  90. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tooltips.scss +9 -7
  91. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_top-bar.scss +77 -44
  92. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_type.scss +21 -9
  93. data/lib/TokiServer/bower_components/modernizr/.bower.json +4 -4
  94. data/lib/TokiServer/bower_components/modernizr/feature-detects/workers-blobworkers.js +2 -2
  95. data/lib/TokiServer/bower_components/modernizr/grunt.js +1 -1
  96. data/lib/TokiServer/bower_components/modernizr/modernizr.js +2 -2
  97. data/lib/TokiServer/config.rb +0 -0
  98. data/lib/TokiServer/humans.txt +0 -0
  99. data/lib/TokiServer/{itunesicon.rb → itunesicons.rb} +25 -23
  100. data/lib/TokiServer/js/app.js +0 -0
  101. data/lib/TokiServer/public/stylesheets/app.css +2636 -1610
  102. data/lib/TokiServer/robots.txt +0 -0
  103. data/lib/TokiServer/scss/_settings.scss +0 -0
  104. data/lib/TokiServer/scss/app.scss +7 -1
  105. data/lib/TokiServer/tokiserver.rb +239 -244
  106. data/lib/TokiServer/views/activity.erb +42 -0
  107. data/lib/TokiServer/views/apps_total.erb +8 -2
  108. data/lib/TokiServer/views/error.erb +13 -4
  109. data/lib/TokiServer/views/index.erb +36 -27
  110. data/lib/TokiServer/views/logs_total.erb +34 -0
  111. data/spec/TokiCLI_spec.rb +354 -0
  112. data/spec/mock/mock.sqlite3 +0 -0
  113. data/spec/spec_helper.rb +26 -0
  114. metadata +78 -23
  115. data/lib/API/dbapi.rb +0 -488
  116. data/lib/TokiCLI/app.rb +0 -389
  117. data/lib/TokiCLI/authorize.rb +0 -77
  118. data/lib/TokiCLI/export.rb +0 -81
  119. data/lib/TokiCLI/get_channels.rb +0 -22
  120. data/lib/TokiCLI/get_messages.rb +0 -32
  121. data/lib/TokiCLI/import.rb +0 -122
  122. data/lib/TokiCLI/scan.rb +0 -19
  123. data/lib/TokiCLI/search_messages.rb +0 -23
  124. data/lib/TokiServer/README.md +0 -37
  125. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_reveal-new.scss +0 -0
  126. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_switch.scss +0 -294
  127. data/lib/TokiServer/views/name_log.erb +0 -50
  128. data/lib/TokiServer/views/name_split.erb +0 -37
  129. data/lib/TokiServer/views/name_total.erb +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13c76e7823ff774b8ccfe4af10201d6ea64afb6e
4
- data.tar.gz: 3b7450b26fb26fba73dacda65d4f7d8e95b1cfd2
3
+ metadata.gz: 9d881a874cdf17efa2db5ad24c0ab808d5a89fc7
4
+ data.tar.gz: 118745d1d2ee3ab2e4108115303f99fc507ed1c1
5
5
  SHA512:
6
- metadata.gz: c6e91245035e3dbd2939fdcb3af86249143df5c549068001ca91a7418692165c31585be41fb09ee0eb14db2fe46b481ef04ab94dcb9d45a9144af85e7535a4f8
7
- data.tar.gz: 5c206edc01a9d1e385509d32c1c7c5b6d5de59fc79b7f8981a4bab1864564d082748c94e9f93bcf23c7e431de9d685530b48297a73c83b4bd1d17a145596fad9
6
+ metadata.gz: 6ea00b551307a61234ffed4f78fcbbd8bb355e5831a88903107eadcf7e3ead7281b2f225dc5e173d2a60c243ac2a392c72776803e0d800bc382c60687d129ff1
7
+ data.tar.gz: d9d1c10fa33308227dbcb96e5ebbb497dc50f2d88a1338765d6c8ccd6bda7ece83b872b3631555e2597e00fb02bc3662c725ccc616abcc28358dd07127895207
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -1,20 +1,11 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
1
+ /.bundle/
2
+ /.yardoc
6
3
  Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
4
+ /_yardoc/
5
+ /coverage/
6
+ /pkg/
7
+ /spec/reports/
8
+ tmp/
18
9
  *.bundle
19
10
  *.so
20
11
  *.o
@@ -22,5 +13,6 @@ tmp
22
13
  mkmf.log
23
14
  token
24
15
  .tags
25
- lib/TokiServer/.sass-cache
16
+ .sass-cache/
26
17
  .sublime*
18
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --fail-fast
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
@@ -1,3 +1,7 @@
1
+ # 0.3.0
2
+
3
+ - Complete refactoring
4
+
1
5
  # 0.2.1
2
6
 
3
7
  - Fixed the "log" method in the CLI
data/README.md CHANGED
@@ -1,39 +1,10 @@
1
- - [TokiCLI](#tokicli)
2
- - [Installation](#installation)
3
- - [Usage](#usage)
4
- - [Total](#total)
5
- - [Top](#top)
6
- - [Day](#day)
7
- - [Since](#since)
8
- - [Before](#before)
9
- - [Range](#range)
10
- - [App](#app)
11
- - [App before](#app-before)
12
- - [App since](#app-since)
13
- - [App day](#app-day)
14
- - [App range](#app-range)
15
- - [Log](#log)
16
- - [Scan](#scan)
17
- - [Auth](#auth)
18
- - [Global option: JSON](#global-option-json)
19
- - [Global option: CSV](#global-option-csv)
20
- - [Restore database from App.net](#restore-database-from-appnet)
21
- - [API](#api)
22
- - [Local server for the API](#local-server-for-the-api)
23
- - [Endpoints](#endpoints)
24
- - [Tools](#tools)
25
- - [Toki](#toki)
26
- - [Important](#important)
27
- - [Next](#next)
28
- - [Thanks](#thanks)
29
-
30
1
  # TokiCLI
31
2
 
32
3
  Toki.app command-line client and API server.
33
4
 
34
5
  Access your Toki data from the local database or from the App.net backup channel, via the CLI interface or the served API.
35
6
 
36
- ![TokiCLI](https://www.evernote.com/shard/s89/sh/dd392b00-82b6-4f13-b573-c925a99ae5a0/02aa5ea4266e8bc7e28d7c91ba8b922c/deep/0/toki-server.png)
7
+ ![TokiServer example](https://www.evernote.com/shard/s89/sh/dd392b00-82b6-4f13-b573-c925a99ae5a0/02aa5ea4266e8bc7e28d7c91ba8b922c/deep/0/toki-server.png)
37
8
 
38
9
 
39
10
  ## Installation
@@ -42,6 +13,20 @@ Access your Toki data from the local database or from the App.net backup channel
42
13
 
43
14
  ## Usage
44
15
 
16
+ ### Help
17
+
18
+ `toki`
19
+
20
+ shows the basic commands.
21
+
22
+ `toki help <command>`
23
+
24
+ shows help and available options for a specific command.
25
+
26
+ Example:
27
+
28
+ `toki help bundle`
29
+
45
30
  ### Total
46
31
 
47
32
  The **total** command shows the total usage time for all apps.
@@ -88,60 +73,74 @@ The **range** command shows your top used apps between two specific days.
88
73
 
89
74
  ### App
90
75
 
91
- Total tracked time for an app
76
+ Complete log for an app
77
+
78
+ `toki app airmail`
79
+
80
+ Several apps may contain the same name. In that case, they will all be processed.
81
+
82
+ Example: `toki app apple`
92
83
 
93
- `toki app iterm`
84
+ #### App before
94
85
 
95
- You don't have to specify the exact name of the identifier: for example, typing 'iterm' will find 'com.googlecode.iterm2'.
86
+ Complete log for an app before a specific day
96
87
 
97
- However, you can specify a bundle identifier if you need it.
88
+ `toki app airmail --before 2014-04-19`
98
89
 
99
- `toki app --bundle 'com.googlecode.iterm2'`
100
90
 
101
- ### App before
91
+ #### App since
102
92
 
103
- Total tracked time for an app before a specific day
93
+ Complete log for an app since a specific day
104
94
 
105
- `toki app_before iterm 2014-04-19`
95
+ `toki app airmail --since 2014-04-19`
106
96
 
107
- `toki app_before --bundle 'com.googlecode.iterm2' 2014-04-19`
108
97
 
98
+ #### App day
109
99
 
110
- ### App since
100
+ Complete log for an app on a specific day
111
101
 
112
- Total tracked time for an app since a specific day
102
+ `toki app airmail --day 2014-04-19`
113
103
 
114
- `toki app_since iterm 2014-04-19`
104
+ #### App range
115
105
 
116
- `toki app_since --bundle 'com.googlecode.iterm2' 2014-04-19`
106
+ Complete log for an app between two specific days
117
107
 
108
+ `toki app airmail --range 2014-04-19 2014-05-12`
118
109
 
119
- ### App day
120
110
 
121
- Total tracked time for an app on a specific day
111
+ ### Bundle
122
112
 
123
- `toki app_day iterm 2014-04-19`
113
+ Complete log for an app, given its exact bundle ID.
124
114
 
125
- `toki app_day --bundle 'com.googlecode.iterm2' 2014-04-19`
115
+ Same features as for `app`, just give an app bundle instead of an app name.
126
116
 
127
- ### App range
117
+ This should always return only one app log.
118
+
119
+ ```
120
+ toki bundle it.bloop.airmail
121
+ toki bundle it.bloop.airmail --before 2014-04-19
122
+ toki bundle it.bloop.airmail --since 2014-04-19
123
+ toki bundle it.bloop.airmail --day 2014-04-19
124
+ toki bundle it.bloop.airmail --range 2014-04-19 2014-05-12
125
+ ```
128
126
 
129
- Total tracked time for an app between two specific days
127
+ ### Activity
130
128
 
131
- `toki app_range iterm 2014-04-19 2014-04-23`
129
+ Recent Toki activity log.
132
130
 
133
- `toki app_range --bundle 'com.googlecode.iterm2' 2014-04-19 2014-04-23`
131
+ `toki activity`
134
132
 
133
+ #### Activity since
135
134
 
136
- ### Log
135
+ Complete Toki activity log since a specific day.
137
136
 
138
- The **log** command shows the entire log (history) for one app.
137
+ `toki activity --since 2014-04-19`
139
138
 
140
- `toki log iterm`
139
+ #### Activity day
141
140
 
142
- `toki log --bundle 'com.googlecode.iterm2'`
141
+ Complete Toki activity log for a specific day.
143
142
 
144
- The results are sorted by ascending date and time.
143
+ `toki activity --day 2014-04-19`
145
144
 
146
145
  ### Scan
147
146
 
@@ -149,154 +148,101 @@ Scan for apps name.
149
148
 
150
149
  Will crawl the Applications folder and try to resolve app names from bundle identifiers.
151
150
 
152
- Toki will display apps names in results if apps have been scanned.
151
+ *Toki can display apps names in results only if apps have been scanned.*
152
+
153
153
 
154
- ### Auth
154
+ ### Option: JSON
155
155
 
156
- In order to be able to access your ADN channel (optional), TokiCLI has to obtain a "token" (secret code) from App.net.
156
+ Export the Toki results as a JSON file with the `--json` option:
157
157
 
158
- Just do `toki auth` and follow the steps, this is fast and easy.
158
+ `toki total --json`
159
159
 
160
- ### Global option: JSON
160
+ `toki day 2014-04-18 --json `
161
161
 
162
- Export the Toki results as a JSON file with the `-j` option:
162
+ `toki top -n10 -J`
163
163
 
164
- `toki total -j`
164
+ ### Option: CSV
165
165
 
166
- `toki day 2014-04-18 -j`
166
+ Export the Toki results as a CSV file with the `--csv` option:
167
167
 
168
- `toki top -n 10 -j`
168
+ `toki total --csv`
169
169
 
170
- ### Global option: CSV
170
+ `toki day 2014-04-18 --csv`
171
171
 
172
- Export the Toki results as a CSV file with the `-c` option:
172
+ `toki top -n10 -C`
173
173
 
174
- `toki total -c`
174
+ ### Delete
175
175
 
176
- `toki day 2014-04-18 -c`
176
+ Completely delete all traces of an app in the database.
177
177
 
178
- `toki top -n 10 -c`
178
+ With backup:
179
+
180
+ `toki delete it.bloop.airmail`
181
+
182
+ Without backup:
183
+
184
+ `toki delete it.bloop.airmail --no-backup`
179
185
 
180
186
  ### Restore database from App.net
181
187
 
182
188
  Toki.app backs up your Toki tracked apps data 'in the cloud' via an App.net channel.
183
189
 
184
- TokiCLI should be able to download this data and *rebuild the Toki database* if you lost your local install or you're simply moving toki.app to a new machine.
185
-
186
- `toki auth`
190
+ TokiCLI should be able to download this data and *rebuild the Toki database* if you lost your local install or if it has been compromised.
187
191
 
188
192
  `toki restore`
189
193
 
190
194
  # API
191
195
 
192
- ## Local server for the API
196
+ ## Server for the API
193
197
 
194
198
  `toki serve`
195
199
 
196
- You can see a list of requests on the index page: *http://localhost:4567*.
200
+ Returns a JSON response for each request.
197
201
 
198
202
  Examples of API calls with curl:
199
203
 
200
204
  ```
201
205
  curl http://localhost:4567/api/apps/top/10
202
- curl http://localhost:4567/api/find/safari/log
203
- curl http://localhost:4567/api/find/safari/since/2014-05-27
204
- curl http://localhost:4567/api/bundle/com.apple.Safari/before/2014-05-27
205
206
  curl http://localhost:4567/api/apps/day/2014-05-27
206
207
  curl http://localhost:4567/api/apps/range/2014-05-27/2014-05-30
208
+ curl http://localhost:4567/api/logs/app/safari/
209
+ curl http://localhost:4567/api/logs/app/safari/since/2014-05-27
210
+ curl http://localhost:4567/api/logs/bundle/com.apple.Safari/before/2014-05-27
211
+ curl http://localhost:4567/api/user
212
+ curl http://localhost:4567/api/bundles
207
213
  ```
208
214
 
209
- Remove the "/api" part of the URL to access rendered views of the responses.
215
+ Find the list of all endpoints with `curl http://localhost:4567/api`.
210
216
 
211
- ## Endpoints
217
+ ## Library
212
218
 
213
- You can also use the TokiCLI API in another app.
219
+ You can also use the TokiCLI API in another app:
214
220
 
215
221
  `require 'TokiCLI'`
216
222
 
217
- Create a TokiCLI API instance:
218
-
219
- `toki = TokiCLI::DBAPI.new`
220
-
221
- Get the total time for an app, in seconds, given its exact bundle identifier:
222
-
223
- `time = toki.bundle_total 'com.sublimetext.3'`
224
-
225
- With a (partial) name:
226
-
227
- `time = toki.name_total 'sublime'`
228
-
229
- Get the total time for an app, in seconds, given its exact bundle identifier, since a specific day:
230
-
231
- `time = toki.bundle_total_since 'com.sublimetext.3', '2014-05-15'`
232
-
233
- With a (partial) name:
234
-
235
- `time = toki.name_total_since 'sublime', '2014-05-15'`
223
+ ### Basic
236
224
 
237
- Get the total time for an app, in seconds, given its exact bundle identifier, before a specific day:
225
+ Create a basic TokiCLI API instance:
238
226
 
239
- `time = toki.bundle_total_before 'com.sublimetext.3', '2014-05-15'`
227
+ `toki = TokiCLI::TokiAPI.new("#{~/Library/path/to/tokiapp/db}")`
240
228
 
241
- With a (partial) name:
229
+ *That's the format used by the test suite.*
242
230
 
243
- `time = toki.name_total_before 'sublime', '2014-05-15'`
231
+ ### With apps names
244
232
 
245
- Get the total time for an app, in seconds, given its exact bundle identifier, before and since a specific day:
233
+ Create a TokiCLI FileOps instance:
246
234
 
247
- `time = toki.bundle_total_split 'com.sublimetext.3', '2014-05-15'`
235
+ `fileops = TokiCLI::FileOps.new`
248
236
 
249
- With a (partial) name:
237
+ Scan for apps names (see ##Tools):
250
238
 
251
- `time = toki.name_total_split 'sublime', '2014-05-15'`
239
+ `fileops.save_bundles`
252
240
 
253
- Get the total time for an app, in seconds, given its exact bundle identifier, between two specific days:
254
-
255
- `time = toki.bundle_total_range 'com.sublimetext.3', '2014-05-15', '2014-05-17'`
256
-
257
- With a (partial) name:
258
-
259
- `time = toki.name_total_range 'sublime', '2014-05-15', '2014-05-17'`
260
-
261
- Get the total time of all apps used between day 1 and day 2:
262
-
263
- `apps = toki.apps_range '2014-05-15', '2014-05-17'`
264
-
265
- Get the total time of all apps used on a specific day:
266
-
267
- `apps = toki.apps_day '2014-05-15'`
268
-
269
- Get the total time of all tracked apps:
270
-
271
- `apps = toki.apps_total`
272
-
273
- Get the top x tracked apps (5 by default):
274
-
275
- `apps = toki.apps_top 10`
276
-
277
- Get the complete log for an app:
278
-
279
- `log = toki.bundle_log 'com.sublimetext.3'`
280
-
281
- With a (partial) name:
282
-
283
- `log = toki.name_log 'sublime text'`
284
-
285
-
286
- ## Tools
287
-
288
- Scan disk for installed apps, get their names from their bundle identifiers and save the file (ignores unresolved identifiers):
289
-
290
- `app_names = toki.scan_apps`
291
-
292
- Get apps names and bundle identifiers (without re-scanning, and including unresolved identifiers):
293
-
294
- `app_names = toki.tracked_apps`
295
-
296
- Get bundle_id from app name or partial app name:
241
+ Create a TokiCLI API instance:
297
242
 
298
- `bundle_id = toki.get_bundle_from_name 'sublime'`
243
+ `toki = TokiCLI::TokiAPI.new(fileops.db_file, fileops.bundles)`
299
244
 
245
+ *See `toki_api.rb` and `fileops.rb` for the list of available methods.*
300
246
 
301
247
  # Toki
302
248
 
@@ -311,13 +257,3 @@ It's a time tracker for your apps that sits in the menu bar.
311
257
  **Tracking is the job of Toki.app by @keita.**
312
258
 
313
259
  TokiCLI interacts only with the Toki.app database or the App.net backup channel.
314
-
315
- ## Next
316
-
317
- Teasing: TokiCLI has only read-only commands... for now. ;)
318
-
319
- ## Thanks
320
-
321
- Keita was super nice and said "Awesome!" instead of just "Yes" or "GTFO" when I asked him if I could use the 'Toki' name for this companion Gem.
322
-
323
- Many thanks and congrats to Keita! :)
data/Rakefile CHANGED
@@ -1,2 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
2
7