TokiCLI 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +7 -0
- data/README.md +56 -10
- data/TokiCLI.gemspec +5 -2
- data/lib/API/dbapi.rb +104 -67
- data/lib/API/helpers.rb +47 -3
- data/lib/TokiCLI/app.rb +88 -12
- data/lib/TokiCLI/version.rb +1 -1
- data/lib/TokiCLI/view.rb +5 -1
- data/lib/TokiServer/Gemfile +6 -0
- data/lib/TokiServer/README.md +37 -0
- data/lib/TokiServer/bower.json +8 -0
- data/lib/TokiServer/bower_components/fastclick/.bower.json +23 -0
- data/lib/TokiServer/bower_components/fastclick/LICENSE +22 -0
- data/lib/TokiServer/bower_components/fastclick/README.md +133 -0
- data/lib/TokiServer/bower_components/fastclick/bower.json +13 -0
- data/lib/TokiServer/bower_components/fastclick/lib/fastclick.js +790 -0
- data/lib/TokiServer/bower_components/foundation/.bower.json +30 -0
- data/lib/TokiServer/bower_components/foundation/bower.json +20 -0
- data/lib/TokiServer/bower_components/foundation/css/foundation.css +4860 -0
- data/lib/TokiServer/bower_components/foundation/css/normalize.css +320 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation.js +5543 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation.min.js +3 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.abide.js +299 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.accordion.js +59 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.alert.js +43 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.clearing.js +534 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.dropdown.js +311 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.equalizer.js +74 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.interchange.js +331 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.joyride.js +843 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.js +611 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.magellan.js +178 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.offcanvas.js +108 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.orbit.js +610 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.reveal.js +437 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.slider.js +199 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.tab.js +167 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.tooltip.js +298 -0
- data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.topbar.js +425 -0
- data/lib/TokiServer/bower_components/foundation/js/vendor/fastclick.js +9 -0
- data/lib/TokiServer/bower_components/foundation/js/vendor/jquery.cookie.js +8 -0
- data/lib/TokiServer/bower_components/foundation/js/vendor/jquery.js +26 -0
- data/lib/TokiServer/bower_components/foundation/js/vendor/modernizr.js +8 -0
- data/lib/TokiServer/bower_components/foundation/js/vendor/placeholder.js +2 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation.scss +45 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/_functions.scss +101 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/_settings.scss +1289 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_accordion.scss +53 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_alert-boxes.scss +126 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_block-grid.scss +132 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_breadcrumbs.scss +127 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_button-groups.scss +108 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_buttons.scss +222 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_clearing.scss +247 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_dropdown-buttons.scss +129 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_dropdown.scss +248 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_flex-video.scss +51 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_forms.scss +498 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_global.scss +429 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_grid.scss +260 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_inline-lists.scss +57 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_joyride.scss +220 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_keystrokes.scss +61 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_labels.scss +104 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_magellan.scss +34 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_offcanvas.scss +355 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_orbit.scss +423 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_pagination.scss +150 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_panels.scss +90 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_pricing-tables.scss +150 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_progress-bars.scss +79 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_range-slider.scss +148 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_reveal-new.scss +0 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_reveal.scss +216 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_side-nav.scss +115 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_split-buttons.scss +191 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_sub-nav.scss +125 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_switch.scss +294 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tables.scss +129 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tabs.scss +109 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_thumbs.scss +68 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tooltips.scss +140 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_top-bar.scss +644 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_type.scss +511 -0
- data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_visibility.scss +408 -0
- data/lib/TokiServer/bower_components/foundation/scss/normalize.scss +425 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/.bower.json +17 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/.gitattributes +1 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/.gitignore +1 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/LICENSE-MIT.txt +20 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/README.md +76 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/bower.json +5 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/demo.html +55 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/jquery.placeholder.js +185 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/tests/index.html +32 -0
- data/lib/TokiServer/bower_components/jquery-placeholder/tests/tests.js +134 -0
- data/lib/TokiServer/bower_components/jquery.cookie/.bower.json +28 -0
- data/lib/TokiServer/bower_components/jquery.cookie/jquery.cookie.js +117 -0
- data/lib/TokiServer/bower_components/jquery/.bower.json +37 -0
- data/lib/TokiServer/bower_components/jquery/MIT-LICENSE.txt +21 -0
- data/lib/TokiServer/bower_components/jquery/bower.json +27 -0
- data/lib/TokiServer/bower_components/jquery/dist/jquery.js +9190 -0
- data/lib/TokiServer/bower_components/jquery/dist/jquery.min.js +5 -0
- data/lib/TokiServer/bower_components/jquery/dist/jquery.min.map +1 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax.js +806 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/jsonp.js +89 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/load.js +75 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/parseJSON.js +13 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/parseXML.js +28 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/script.js +64 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/var/nonce.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/var/rquery.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/ajax/xhr.js +135 -0
- data/lib/TokiServer/bower_components/jquery/src/attributes.js +11 -0
- data/lib/TokiServer/bower_components/jquery/src/attributes/attr.js +143 -0
- data/lib/TokiServer/bower_components/jquery/src/attributes/classes.js +158 -0
- data/lib/TokiServer/bower_components/jquery/src/attributes/prop.js +96 -0
- data/lib/TokiServer/bower_components/jquery/src/attributes/support.js +35 -0
- data/lib/TokiServer/bower_components/jquery/src/attributes/val.js +163 -0
- data/lib/TokiServer/bower_components/jquery/src/callbacks.js +205 -0
- data/lib/TokiServer/bower_components/jquery/src/core.js +498 -0
- data/lib/TokiServer/bower_components/jquery/src/core/access.js +60 -0
- data/lib/TokiServer/bower_components/jquery/src/core/init.js +123 -0
- data/lib/TokiServer/bower_components/jquery/src/core/parseHTML.js +39 -0
- data/lib/TokiServer/bower_components/jquery/src/core/ready.js +97 -0
- data/lib/TokiServer/bower_components/jquery/src/core/var/rsingleTag.js +4 -0
- data/lib/TokiServer/bower_components/jquery/src/css.js +451 -0
- data/lib/TokiServer/bower_components/jquery/src/css/addGetHookIf.js +24 -0
- data/lib/TokiServer/bower_components/jquery/src/css/curCSS.js +57 -0
- data/lib/TokiServer/bower_components/jquery/src/css/defaultDisplay.js +70 -0
- data/lib/TokiServer/bower_components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/lib/TokiServer/bower_components/jquery/src/css/support.js +91 -0
- data/lib/TokiServer/bower_components/jquery/src/css/swap.js +28 -0
- data/lib/TokiServer/bower_components/jquery/src/css/var/cssExpand.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/css/var/getStyles.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/css/var/isHidden.js +13 -0
- data/lib/TokiServer/bower_components/jquery/src/css/var/rmargin.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/data.js +179 -0
- data/lib/TokiServer/bower_components/jquery/src/data/Data.js +181 -0
- data/lib/TokiServer/bower_components/jquery/src/data/accepts.js +20 -0
- data/lib/TokiServer/bower_components/jquery/src/data/var/data_priv.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/data/var/data_user.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/deferred.js +149 -0
- data/lib/TokiServer/bower_components/jquery/src/deprecated.js +13 -0
- data/lib/TokiServer/bower_components/jquery/src/dimensions.js +50 -0
- data/lib/TokiServer/bower_components/jquery/src/effects.js +649 -0
- data/lib/TokiServer/bower_components/jquery/src/effects/Tween.js +114 -0
- data/lib/TokiServer/bower_components/jquery/src/effects/animatedSelector.js +13 -0
- data/lib/TokiServer/bower_components/jquery/src/event.js +868 -0
- data/lib/TokiServer/bower_components/jquery/src/event/alias.js +39 -0
- data/lib/TokiServer/bower_components/jquery/src/event/support.js +9 -0
- data/lib/TokiServer/bower_components/jquery/src/exports/amd.js +24 -0
- data/lib/TokiServer/bower_components/jquery/src/exports/global.js +32 -0
- data/lib/TokiServer/bower_components/jquery/src/intro.js +44 -0
- data/lib/TokiServer/bower_components/jquery/src/jquery.js +36 -0
- data/lib/TokiServer/bower_components/jquery/src/manipulation.js +582 -0
- data/lib/TokiServer/bower_components/jquery/src/manipulation/_evalUrl.js +18 -0
- data/lib/TokiServer/bower_components/jquery/src/manipulation/support.js +31 -0
- data/lib/TokiServer/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/offset.js +204 -0
- data/lib/TokiServer/bower_components/jquery/src/outro.js +1 -0
- data/lib/TokiServer/bower_components/jquery/src/queue.js +142 -0
- data/lib/TokiServer/bower_components/jquery/src/queue/delay.js +22 -0
- data/lib/TokiServer/bower_components/jquery/src/selector-native.js +172 -0
- data/lib/TokiServer/bower_components/jquery/src/selector-sizzle.js +14 -0
- data/lib/TokiServer/bower_components/jquery/src/selector.js +1 -0
- data/lib/TokiServer/bower_components/jquery/src/serialize.js +111 -0
- data/lib/TokiServer/bower_components/jquery/src/sizzle/dist/sizzle.js +2044 -0
- data/lib/TokiServer/bower_components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
- data/lib/TokiServer/bower_components/jquery/src/traversing.js +200 -0
- data/lib/TokiServer/bower_components/jquery/src/traversing/findFilter.js +100 -0
- data/lib/TokiServer/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/lib/TokiServer/bower_components/jquery/src/var/arr.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/var/class2type.js +4 -0
- data/lib/TokiServer/bower_components/jquery/src/var/concat.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/var/hasOwn.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/var/indexOf.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/var/pnum.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/var/push.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/var/rnotwhite.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/var/slice.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/var/strundefined.js +3 -0
- data/lib/TokiServer/bower_components/jquery/src/var/support.js +4 -0
- data/lib/TokiServer/bower_components/jquery/src/var/toString.js +5 -0
- data/lib/TokiServer/bower_components/jquery/src/wrap.js +78 -0
- data/lib/TokiServer/bower_components/modernizr/.bower.json +14 -0
- data/lib/TokiServer/bower_components/modernizr/.editorconfig +10 -0
- data/lib/TokiServer/bower_components/modernizr/.gitignore +2 -0
- data/lib/TokiServer/bower_components/modernizr/.travis.yml +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/a-download.js +8 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/audio-audiodata-api.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/audio-webaudio-api.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/battery-api.js +8 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/battery-level.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/blob-constructor.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/canvas-todataurl-type.js +28 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/contenteditable.js +9 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/contentsecuritypolicy.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/contextmenu.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/cookies.js +15 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/cors.js +3 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-backgroundposition-shorthand.js +19 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-backgroundposition-xy.js +15 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-backgroundrepeat.js +31 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-backgroundsizecover.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-boxsizing.js +9 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-calc.js +12 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-cubicbezierrange.js +8 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-displayrunin.js +18 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-displaytable.js +27 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-filters.js +7 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-hyphens.js +205 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-lastchild.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-mask.js +12 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-mediaqueries.js +3 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-objectfit.js +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-overflow-scrolling.js +9 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-pointerevents.js +25 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-positionsticky.js +13 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-regions.js +55 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-remunit.js +19 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-resize.js +8 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-scrollbars.js +19 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-shapes.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-subpixelfont.js +23 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-supports.js +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-userselect.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-vhunit.js +14 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-vmaxunit.js +14 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-vminunit.js +14 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/css-vwunit.js +14 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/custom-protocol-handler.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/dart.js +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/dataview-api.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/dom-classlist.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/dom-createElement-attrs.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/dom-dataset.js +9 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/dom-microdata.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-datalist.js +12 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-details.js +25 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-output.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-progress-meter.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-ruby.js +53 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-time.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/elem-track.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/emoji.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/es5-strictmode.js +7 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/event-deviceorientation-motion.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/exif-orientation.js +32 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/file-api.js +12 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/file-filesystem.js +9 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/forms-fileinput.js +13 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/forms-formattribute.js +29 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/forms-inputnumber-l10n.js +32 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/forms-placeholder.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/forms-speechinput.js +19 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/forms-validation.js +62 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/fullscreen-api.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/gamepad.js +12 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/getusermedia.js +5 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/ie8compat.js +12 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/iframe-sandbox.js +5 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/iframe-seamless.js +5 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/iframe-srcdoc.js +5 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/img-apng.js +26 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/img-webp.js +20 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/json.js +7 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/lists-reversed.js +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/mathml.js +23 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/network-connection.js +22 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/network-eventsource.js +5 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/network-xhr2.js +13 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/notification.js +10 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/performance.js +5 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/pointerlock-api.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/quota-management-api.js +11 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/requestanimationframe.js +7 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/script-async.js +3 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/script-defer.js +3 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/style-scoped.js +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/svg-filters.js +13 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/unicode.js +32 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/url-data-uri.js +26 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/userdata.js +7 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/vibration.js +4 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/web-intents.js +6 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/webgl-extensions.js +42 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/websockets-binary.js +20 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/window-framed.js +8 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/workers-blobworkers.js +66 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/workers-dataworkers.js +34 -0
- data/lib/TokiServer/bower_components/modernizr/feature-detects/workers-sharedworkers.js +3 -0
- data/lib/TokiServer/bower_components/modernizr/grunt.js +69 -0
- data/lib/TokiServer/bower_components/modernizr/media/Modernizr 2 Logo.ai +292 -1
- data/lib/TokiServer/bower_components/modernizr/media/Modernizr 2 Logo.eps +0 -0
- data/lib/TokiServer/bower_components/modernizr/media/Modernizr 2 Logo.pdf +292 -1
- data/lib/TokiServer/bower_components/modernizr/media/Modernizr 2 Logo.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/media/Modernizr 2 Logo.svg +35 -0
- data/lib/TokiServer/bower_components/modernizr/modernizr.js +1406 -0
- data/lib/TokiServer/bower_components/modernizr/readme.md +28 -0
- data/lib/TokiServer/bower_components/modernizr/test/basic.html +65 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse.html +1451 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/Windsong-webfont.eot +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/Windsong-webfont.otf +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/Windsong-webfont.svg +147 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/Windsong-webfont.ttf +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/Windsong-webfont.woff +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/alpha.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/apng_test.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/before-after.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/form_validation.html +15 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/ga.js +43 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/green5x5.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/hashchange.html +16 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/jquery.min.js +18 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/mathml.html +120 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/mathml_ref.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/modernizr-1.7.min.js +2 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/png_alpha_result.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/pushstate.html +40 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/red30x30.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/ruby.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/stroked-text.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/style.css +168 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/svg-html-blur.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/svg-img.svg +5 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/svg-img.svg.1 +5 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/svg_blur.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/table.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/text-shadow1.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/text-shadow2.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/windsong_font.png +0 -0
- data/lib/TokiServer/bower_components/modernizr/test/caniuse_files/xhtml.html +14 -0
- data/lib/TokiServer/bower_components/modernizr/test/index.html +104 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/basic.html +65 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/dumpdata.js +75 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/lib/detect-global.js +153 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/lib/jquery-1.7b2.js +9279 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/lib/jsonselect.js +279 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/lib/polyfills.js +96 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/lib/uaparser.js +215 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/setup.js +44 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/unit-caniuse.js +191 -0
- data/lib/TokiServer/bower_components/modernizr/test/js/unit.js +669 -0
- data/lib/TokiServer/bower_components/modernizr/test/qunit/qunit.css +231 -0
- data/lib/TokiServer/bower_components/modernizr/test/qunit/qunit.js +1932 -0
- data/lib/TokiServer/bower_components/modernizr/test/qunit/run-qunit.js +72 -0
- data/lib/TokiServer/config.rb +25 -0
- data/lib/TokiServer/humans.txt +8 -0
- data/lib/TokiServer/itunesicon.rb +60 -0
- data/lib/TokiServer/js/app.js +3 -0
- data/lib/TokiServer/public/stylesheets/app.css +8094 -0
- data/lib/TokiServer/robots.txt +4 -0
- data/lib/TokiServer/scss/_settings.scss +1240 -0
- data/lib/TokiServer/scss/app.scss +102 -0
- data/lib/TokiServer/tokiserver.rb +377 -0
- data/lib/TokiServer/views/apps_total.erb +28 -0
- data/lib/TokiServer/views/error.erb +25 -0
- data/lib/TokiServer/views/index.erb +191 -0
- data/lib/TokiServer/views/layout.erb +20 -0
- data/lib/TokiServer/views/name_log.erb +50 -0
- data/lib/TokiServer/views/name_split.erb +37 -0
- data/lib/TokiServer/views/name_total.erb +34 -0
- metadata +416 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57d68e57afaea0eb395e8ff1c9812120f3ef38f1
|
4
|
+
data.tar.gz: 88db8f5eb97538cb4875ae60cba14fed3ae832ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50bc4c6af9b2d8c80b0941e698bfa31706d6e2c6a2105dc4854a33f70609c7465007e22acb24cd11f00b980d8cf5567abd8db36f6ac446b5b3de55c171692e79
|
7
|
+
data.tar.gz: 6ff97c30d19c09da4455d8f35e9ba93cd6e376a251122deee42f0c998ef26a048afeb31ad8c83a7c758ee58b8631927892ec38bdb170a18347f30917a17b039c
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,39 @@
|
|
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
|
+
|
1
30
|
# TokiCLI
|
2
31
|
|
3
|
-
Toki.app command-line client.
|
32
|
+
Toki.app command-line client and API server.
|
4
33
|
|
5
|
-
Access your Toki data from the local database or from the App.net backup channel.
|
34
|
+
Access your Toki data from the local database or from the App.net backup channel, via the CLI interface or the served API.
|
6
35
|
|
7
|
-
![TokiCLI](https://
|
36
|
+
![TokiCLI](https://www.evernote.com/shard/s89/sh/dd392b00-82b6-4f13-b573-c925a99ae5a0/02aa5ea4266e8bc7e28d7c91ba8b922c/deep/0/toki-server.png)
|
8
37
|
|
9
38
|
|
10
39
|
## Installation
|
@@ -148,11 +177,11 @@ Export the Toki results as a CSV file with the `-c` option:
|
|
148
177
|
|
149
178
|
`toki top -n 10 -c`
|
150
179
|
|
151
|
-
|
180
|
+
### Restore database from App.net
|
152
181
|
|
153
182
|
Toki.app backs up your Toki tracked apps data 'in the cloud' via an App.net channel.
|
154
183
|
|
155
|
-
TokiCLI
|
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.
|
156
185
|
|
157
186
|
`toki auth`
|
158
187
|
|
@@ -160,17 +189,34 @@ TokiCLI is able to download this data and *rebuild the Toki database* if you los
|
|
160
189
|
|
161
190
|
# API
|
162
191
|
|
163
|
-
|
192
|
+
## Local server for the API
|
193
|
+
|
194
|
+
`toki serve`
|
195
|
+
|
196
|
+
You can see a list of requests on the index page: *http://localhost:4567*.
|
197
|
+
|
198
|
+
Examples of API calls with curl:
|
164
199
|
|
165
200
|
```
|
166
|
-
|
201
|
+
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
|
+
curl http://localhost:4567/api/apps/day/2014-05-27
|
206
|
+
curl http://localhost:4567/api/apps/range/2014-05-27/2014-05-30
|
167
207
|
```
|
168
208
|
|
169
|
-
|
209
|
+
Remove the "/api" part of the URL to access rendered views of the responses.
|
170
210
|
|
171
|
-
|
211
|
+
## Endpoints
|
172
212
|
|
173
|
-
|
213
|
+
You can also use the TokiCLI API in another app.
|
214
|
+
|
215
|
+
`require 'TokiCLI'`
|
216
|
+
|
217
|
+
Create a TokiCLI API instance:
|
218
|
+
|
219
|
+
`toki = TokiCLI::DBAPI.new`
|
174
220
|
|
175
221
|
Get the total time for an app, in seconds, given its exact bundle identifier:
|
176
222
|
|
data/TokiCLI.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = TokiCLI::VERSION
|
9
9
|
spec.authors = ["Eric Dejonckheere"]
|
10
10
|
spec.email = ["eric@aya.io"]
|
11
|
-
spec.summary = %q{Toki.app command-line client}
|
12
|
-
spec.description = %q{Toki.app command-line client: read your Toki data from the local database or from the App.net backup channel. Show the log for an app, the top apps, the grand total, usage by day or range of days, etc.}
|
11
|
+
spec.summary = %q{Toki.app command-line client and API server}
|
12
|
+
spec.description = %q{Toki.app command-line client: read your Toki data from the local database or from the App.net backup channel. Show the log for an app, the top apps, the grand total, usage by day or range of days, etc. Use the API in another app, or launch the local server.}
|
13
13
|
spec.homepage = "https://github.com/ericdke/TokiCLI"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -25,6 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency "amalgalite", "~> 1.3"
|
26
26
|
spec.add_dependency "terminal-table", "~> 1.4"
|
27
27
|
spec.add_dependency "CFPropertyList", "~> 2.2"
|
28
|
+
spec.add_dependency 'sinatra', '~> 1.4', '>= 1.4.5'
|
29
|
+
spec.add_dependency "thin", "~> 1.6"
|
30
|
+
spec.add_dependency 'sinatra-assetpack', "~> 0.3", '>= 0.3.2'
|
28
31
|
|
29
32
|
spec.add_development_dependency "bundler", "~> 1.6"
|
30
33
|
spec.add_development_dependency "rake"
|
data/lib/API/dbapi.rb
CHANGED
@@ -24,6 +24,7 @@ module TokiCLI
|
|
24
24
|
# Get the total time for an app given its exact bundle identifier
|
25
25
|
def bundle_total bundle_id, orig = nil
|
26
26
|
sec = (@db.execute("SELECT sum(totalSeconds) FROM #{@table} WHERE bundleIdentifier IS '#{bundle_id}'").flatten)[0]
|
27
|
+
sec = 0 if sec.nil?
|
27
28
|
args = if orig.nil?
|
28
29
|
[bundle_id]
|
29
30
|
else
|
@@ -57,6 +58,7 @@ module TokiCLI
|
|
57
58
|
# Get the total time for an app given its exact bundle identifier, since a specific day
|
58
59
|
def bundle_total_since bundle_id, day, orig = nil
|
59
60
|
since = (@db.execute("SELECT sum(totalSeconds) FROM #{@table} WHERE bundleIdentifier IS '#{bundle_id}' AND activeFrom >= #{Time.parse(day).to_i}").flatten)[0]
|
61
|
+
since = 0 if since.nil?
|
60
62
|
args = if orig.nil?
|
61
63
|
[bundle_id, day]
|
62
64
|
else
|
@@ -84,13 +86,14 @@ module TokiCLI
|
|
84
86
|
if bun['meta']['code'] == 200
|
85
87
|
bundle_total_since bun['data']['bundle'], day, name
|
86
88
|
else
|
87
|
-
|
89
|
+
return_422 'name_total_since', [name, day]
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
91
93
|
# Get the total time for an app given its exact bundle identifier, before a specific day
|
92
94
|
def bundle_total_before bundle_id, day, orig = nil
|
93
95
|
before = (@db.execute("SELECT sum(totalSeconds) FROM #{@table} WHERE bundleIdentifier IS '#{bundle_id}' AND activeFrom < #{Time.parse(day).to_i}").flatten)[0]
|
96
|
+
before = 0 if before.nil?
|
94
97
|
args = if orig.nil?
|
95
98
|
[bundle_id, day]
|
96
99
|
else
|
@@ -118,7 +121,7 @@ module TokiCLI
|
|
118
121
|
if bun['meta']['code'] == 200
|
119
122
|
bundle_total_before bun['data']['bundle'], day, name
|
120
123
|
else
|
121
|
-
|
124
|
+
return_422 'name_total_before', [name, day]
|
122
125
|
end
|
123
126
|
end
|
124
127
|
|
@@ -126,6 +129,8 @@ module TokiCLI
|
|
126
129
|
def bundle_total_split bundle_id, day, orig = nil
|
127
130
|
before = (@db.execute("SELECT sum(totalSeconds) FROM #{@table} WHERE bundleIdentifier IS '#{bundle_id}' AND activeFrom < #{Time.parse(day).to_i}").flatten)[0]
|
128
131
|
since = (@db.execute("SELECT sum(totalSeconds) FROM #{@table} WHERE bundleIdentifier IS '#{bundle_id}' AND activeFrom >= #{Time.parse(day).to_i}").flatten)[0]
|
132
|
+
before = 0 if before.nil?
|
133
|
+
since = 0 if since.nil?
|
129
134
|
args = if orig.nil?
|
130
135
|
[bundle_id, day]
|
131
136
|
else
|
@@ -159,7 +164,7 @@ module TokiCLI
|
|
159
164
|
if bun['meta']['code'] == 200
|
160
165
|
bundle_total_split bun['data']['bundle'], day, name
|
161
166
|
else
|
162
|
-
|
167
|
+
return_422 'name_total_split', [name, day]
|
163
168
|
end
|
164
169
|
end
|
165
170
|
|
@@ -171,25 +176,22 @@ module TokiCLI
|
|
171
176
|
else
|
172
177
|
[bundle_id, day1, day2, orig]
|
173
178
|
end
|
174
|
-
if total.nil?
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
seconds: total,
|
188
|
-
time: @helpers.sec_to_time(total)
|
189
|
-
}
|
179
|
+
total = 0 if total.nil?
|
180
|
+
{ meta: {
|
181
|
+
code: 200,
|
182
|
+
request: {command: 'bundle_total_range', args: args, processed_at: Time.now}
|
183
|
+
},
|
184
|
+
data: {
|
185
|
+
bundle: bundle_id,
|
186
|
+
name: @helpers.find_app_name(bundle_id),
|
187
|
+
from: day1,
|
188
|
+
to: day2,
|
189
|
+
total: {
|
190
|
+
seconds: total,
|
191
|
+
time: @helpers.sec_to_time(total)
|
190
192
|
}
|
191
|
-
}
|
192
|
-
|
193
|
+
}
|
194
|
+
}.to_json
|
193
195
|
end
|
194
196
|
|
195
197
|
# Get the total time for an app given a (partial) name, between two specific days
|
@@ -198,7 +200,7 @@ module TokiCLI
|
|
198
200
|
if bun['meta']['code'] == 200
|
199
201
|
bundle_total_range bun['data']['bundle'], day1, day2, name
|
200
202
|
else
|
201
|
-
|
203
|
+
return_422 'name_total_range', [name, day1, day2]
|
202
204
|
end
|
203
205
|
end
|
204
206
|
|
@@ -214,18 +216,22 @@ module TokiCLI
|
|
214
216
|
time: @helpers.sec_to_time(sec)
|
215
217
|
}}
|
216
218
|
}
|
217
|
-
result.
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
219
|
+
if result.empty?
|
220
|
+
return_422('apps_range', [day1, day2])
|
221
|
+
else
|
222
|
+
result.sort_by! {|obj| obj[:total][:seconds]}
|
223
|
+
{
|
224
|
+
meta: {
|
225
|
+
code: 200,
|
226
|
+
request: {command: 'apps_range', args: [day1, day2], processed_at: Time.now}
|
227
|
+
},
|
228
|
+
data: {
|
229
|
+
from: day1,
|
230
|
+
to: day2,
|
231
|
+
apps: result
|
232
|
+
}
|
233
|
+
}.to_json
|
234
|
+
end
|
229
235
|
end
|
230
236
|
|
231
237
|
# Get all apps used on a specific day
|
@@ -233,48 +239,60 @@ module TokiCLI
|
|
233
239
|
date = DateTime.strptime(day, '%Y-%m-%d')
|
234
240
|
response = @db.execute("SELECT bundleIdentifier,sum(totalSeconds) FROM #{@table} WHERE activeFrom >= #{date.to_time.to_i} AND activeFrom < #{date.next_day.to_time.to_i} GROUP BY bundleIdentifier")
|
235
241
|
result = make_apps response
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
242
|
+
if result.empty?
|
243
|
+
return_422 'apps_day', [day]
|
244
|
+
else
|
245
|
+
{
|
246
|
+
meta: {
|
247
|
+
code: 200,
|
248
|
+
request: {command: 'apps_day', args: [day], processed_at: Time.now}
|
249
|
+
},
|
250
|
+
data: {
|
251
|
+
date: day,
|
252
|
+
apps: result
|
253
|
+
}
|
254
|
+
}.to_json
|
255
|
+
end
|
246
256
|
end
|
247
257
|
|
248
258
|
def apps_since day
|
249
259
|
date = DateTime.strptime(day, '%Y-%m-%d')
|
250
260
|
response = @db.execute("SELECT bundleIdentifier,sum(totalSeconds) FROM #{@table} WHERE activeFrom >= #{date.to_time.to_i} GROUP BY bundleIdentifier")
|
251
261
|
result = make_apps response
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
+
if result.empty?
|
263
|
+
return_422 'apps_since', [day]
|
264
|
+
else
|
265
|
+
{
|
266
|
+
meta: {
|
267
|
+
code: 200,
|
268
|
+
request: {command: 'apps_since', args: [day], processed_at: Time.now}
|
269
|
+
},
|
270
|
+
data: {
|
271
|
+
since: day,
|
272
|
+
apps: result
|
273
|
+
}
|
274
|
+
}.to_json
|
275
|
+
end
|
262
276
|
end
|
263
277
|
|
264
278
|
def apps_before day
|
265
279
|
date = DateTime.strptime(day, '%Y-%m-%d')
|
266
280
|
response = @db.execute("SELECT bundleIdentifier,sum(totalSeconds) FROM #{@table} WHERE activeFrom < #{date.to_time.to_i} GROUP BY bundleIdentifier")
|
267
281
|
result = make_apps response
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
282
|
+
if result.empty?
|
283
|
+
return_422 'apps_before', [day]
|
284
|
+
else
|
285
|
+
{
|
286
|
+
meta: {
|
287
|
+
code: 200,
|
288
|
+
request: {command: 'apps_before', args: [day], processed_at: Time.now}
|
289
|
+
},
|
290
|
+
data: {
|
291
|
+
before: day,
|
292
|
+
apps: result
|
293
|
+
}
|
294
|
+
}.to_json
|
295
|
+
end
|
278
296
|
end
|
279
297
|
|
280
298
|
# Get totals of all tracked apps
|
@@ -294,14 +312,33 @@ module TokiCLI
|
|
294
312
|
# Get totals of top tracked apps
|
295
313
|
def apps_top number = 5
|
296
314
|
result = make_total
|
315
|
+
args = [number]
|
297
316
|
index = -number
|
317
|
+
apps = result[index..-1]
|
318
|
+
if apps.nil?
|
319
|
+
return_422 'apps_top', args
|
320
|
+
else
|
321
|
+
{
|
322
|
+
meta: {
|
323
|
+
code: 200,
|
324
|
+
request: {command: 'apps_top', args: args, processed_at: Time.now}
|
325
|
+
},
|
326
|
+
data: {
|
327
|
+
apps: apps
|
328
|
+
}
|
329
|
+
}.to_json
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
def return_422 command_name, args
|
298
334
|
{
|
299
335
|
meta: {
|
300
|
-
code:
|
301
|
-
request: {command:
|
336
|
+
code: 422,
|
337
|
+
request: {command: command_name, args: args, processed_at: Time.now},
|
338
|
+
message: 'No data returned by this request'
|
302
339
|
},
|
303
340
|
data: {
|
304
|
-
apps:
|
341
|
+
apps: []
|
305
342
|
}
|
306
343
|
}.to_json
|
307
344
|
end
|
data/lib/API/helpers.rb
CHANGED
@@ -37,7 +37,12 @@ module TokiCLI
|
|
37
37
|
|
38
38
|
def humanized_date epoch
|
39
39
|
human = seconds_to_time epoch
|
40
|
-
"#{human[:hours]}h #{human[:minutes]}m #{human[:seconds]}s"
|
40
|
+
"#{'%.2d' % human[:hours]}h #{'%.2d' % human[:minutes]}m #{'%.2d' % human[:seconds]}s"
|
41
|
+
end
|
42
|
+
|
43
|
+
def humanized_minutes_seconds epoch
|
44
|
+
human = seconds_to_time epoch
|
45
|
+
"#{'%.2d' % human[:minutes]}m #{'%.2d' % human[:seconds]}s"
|
41
46
|
end
|
42
47
|
|
43
48
|
def seconds_to_time epoch
|
@@ -54,7 +59,7 @@ module TokiCLI
|
|
54
59
|
def oops error
|
55
60
|
puts "\nOOPS! A gremlin crashed the app.\n\n"
|
56
61
|
puts "STACK: #{caller}\n\n"
|
57
|
-
|
62
|
+
puts "GREMLIN: #{error}\n\n"
|
58
63
|
end
|
59
64
|
|
60
65
|
def epoch_to_date epoch
|
@@ -74,12 +79,51 @@ module TokiCLI
|
|
74
79
|
bundle_ids
|
75
80
|
end
|
76
81
|
|
82
|
+
def scan_app_icons
|
83
|
+
@bundles.each do |k,v|
|
84
|
+
gs = v.gsub(' ', '\ ')
|
85
|
+
where = "/Applications/#{gs}.app/Contents/Resources/*.icns"
|
86
|
+
files = Dir.glob(where)
|
87
|
+
candidates = files.select {|f| File.basename(f) == "Icon.icns" || File.basename(f, ".icns").downcase =~ /#{v.downcase}/}
|
88
|
+
puts "#{v} => #{candidates}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
77
92
|
# Scan for names from bundle ids
|
78
93
|
def get_bundle_ids params = {}
|
79
94
|
@infos = {}
|
80
95
|
get_bundles(get_plists("/Applications/*/Contents/*"), params)
|
81
96
|
get_bundles(get_plists("/Applications/Utilities/*/Contents/*"), params)
|
82
97
|
get_bundles(get_plists("#{@home_path}/Applications/*/Contents/*"), params)
|
98
|
+
specials = {
|
99
|
+
'com.evernote.EvernoteHelper' => 'Evernote Helper',
|
100
|
+
'com.apple.finder' => 'Finder',
|
101
|
+
'com.apple.ReportPanic' => 'Kernel Panic',
|
102
|
+
'com.apple.coreservices.uiagent' => 'CoreServices UIAgent',
|
103
|
+
'com.apple.installer' => 'Apple Installer',
|
104
|
+
'com.apple.frameworks.diskimages.diuiagent' => 'Apple Disk Images Agent',
|
105
|
+
'com.mediaatelier.CheatSheet' => 'Cheat Sheet',
|
106
|
+
'com.vyprvpn.authorization' => 'VyprVPN',
|
107
|
+
'com.apple.WebKit.WebContent' => 'Safari module',
|
108
|
+
'com.apple.ProblemReporter' => 'Apple Problem Reporter',
|
109
|
+
'org.andymatuschak.sparkle.finish-installation' => 'Sparkle Install',
|
110
|
+
'com.noodlesoft.HazelHelper' => 'Hazel Helper',
|
111
|
+
'de.appsolute.MAMP' => 'MAMP',
|
112
|
+
'com.apple.KeyboardSetupAssistant' => 'Apple Keyboard Setup Assistant',
|
113
|
+
'com.apple.NetAuthAgent' => 'Apple Net Auth Agent',
|
114
|
+
'com.adobe.acc.AdobeCreativeCloud' => 'Adobe Creative Cloud',
|
115
|
+
'com.apple.iphonesimulator' => 'Apple iPhone Simulator',
|
116
|
+
'com.macromates.TextMate.preview' => 'TextMate',
|
117
|
+
'com.alfredapp.Alfred' => 'Alfred',
|
118
|
+
'com.runningwithcrayons.Alfred-Preferences' => 'Alfred Preferences',
|
119
|
+
'com.apple.WebKit.PluginProcess' => 'Safari Plugin',
|
120
|
+
'com.apple.ScreenSharing' => 'Apple Screen Sharing',
|
121
|
+
'org.virtualbox.app.VirtualBoxVM' => 'VirtualBox',
|
122
|
+
'2BUA8C4S2C.com.agilebits.onepassword-osx-helper' => '1Password Helper'
|
123
|
+
}
|
124
|
+
specials.each do |k, v|
|
125
|
+
@infos[k] = v
|
126
|
+
end
|
83
127
|
@infos
|
84
128
|
end
|
85
129
|
|
@@ -95,7 +139,7 @@ module TokiCLI
|
|
95
139
|
def meta_nodata
|
96
140
|
{
|
97
141
|
code: 404,
|
98
|
-
|
142
|
+
message: 'No data returned from the database'
|
99
143
|
}
|
100
144
|
end
|
101
145
|
|