├── .gitignore ├── .jshintrc ├── .npmignore ├── .travis.yml ├── CHANGELOG ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── bin └── rmt.js ├── docs ├── api.js ├── assets │ ├── css │ │ ├── external-small.png │ │ ├── logo.png │ │ └── main.css │ ├── favicon.ico │ ├── img │ │ └── spinner.gif │ ├── index.html │ ├── js │ │ ├── api-filter.js │ │ ├── api-list.js │ │ ├── api-search.js │ │ ├── apidocs.js │ │ └── yui-prettify.js │ └── vendor │ │ └── prettify │ │ ├── CHANGES.html │ │ ├── COPYING │ │ ├── README.html │ │ ├── prettify-min.css │ │ └── prettify-min.js ├── classes │ ├── Helpers.html │ ├── RmT.html │ └── index.html ├── data.json ├── files │ ├── index.html │ ├── lib_helpers.js.html │ └── lib_rmt.js.html ├── index.html └── modules │ └── index.html ├── lib ├── banner.js ├── banner.txt ├── debugger.js ├── helpers.js └── rmt.js ├── package.json ├── test └── rmt.spec.js └── yuidoc.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | temp 3 | *.log 4 | rmtConfig.json 5 | .idea 6 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "unused": true, 11 | "boss": true, 12 | "eqnull": true, 13 | "node": true, 14 | "globals": { 15 | "require": true, 16 | "module": true, 17 | "describe": true, 18 | "it": true, 19 | "define": true, 20 | "before": true, 21 | "after": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | temp 3 | docs 4 | rmtConfig.json 5 | *.log 6 | .idea 7 | 8 | 9 | # don't ignore .npmignore files 10 | !.npmignore 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10.26' 4 | - '0.10.36' -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | v0.1.0: 2 | date: 2015-3-21 3 | changes: 4 | - Initial release. -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to RmT 2 | 3 | Please take a moment to review this document in order to make the contribution 4 | process easy and effective for everyone involved. 5 | 6 | Following these guidelines helps to communicate that you respect the time of 7 | the developers managing and developing this open source project. In return, 8 | they should reciprocate that respect in addressing your issue or assessing 9 | patches and features. 10 | 11 | 12 | ## Using the issue tracker 13 | 14 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 15 | [features requests](#feature-requests) and [submitting pull 16 | requests](#pull-requests), but please respect the following restrictions: 17 | 18 | * Please **do not** use the issue tracker for personal support requests (use 19 | [Stack Overflow](http://stackoverflow.com) or IRC). 20 | 21 | * Please **do not** derail or troll issues. Keep the discussion on topic and 22 | respect the opinions of others. 23 | 24 | 25 | ## Bug reports 26 | 27 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 28 | Good bug reports are extremely helpful - thank you! 29 | 30 | Guidelines for bug reports: 31 | 32 | 1. **Use the GitHub issue search** — check if the issue has already been 33 | reported. 34 | 35 | 2. **Check if the issue has been fixed** — try to reproduce it using the 36 | latest `master` or development branch in the repository. 37 | 38 | 3. **Isolate the problem** — create a [reduced test 39 | case](http://css-tricks.com/6263-reduced-test-cases/) and a live example. 40 | 41 | A good bug report shouldn't leave others needing to chase you up for more 42 | information. Please try to be as detailed as possible in your report. What is 43 | your environment? What steps will reproduce the issue? What browser(s) and OS 44 | experience the problem? What would you expect to be the outcome? All these 45 | details will help people to fix any potential bugs. 46 | 47 | Example: 48 | 49 | > Short and descriptive example bug report title 50 | > 51 | > A summary of the issue and the browser/OS environment in which it occurs. If 52 | > suitable, include the steps required to reproduce the bug. 53 | > 54 | > 1. This is the first step 55 | > 2. This is the second step 56 | > 3. Further steps, etc. 57 | > 58 | > `` - a link to the reduced test case 59 | > 60 | > Any other information you want to share that is relevant to the issue being 61 | > reported. This might include the lines of code that you have identified as 62 | > causing the bug, and potential solutions (and your opinions on their 63 | > merits). 64 | 65 | 66 | ## Feature requests 67 | 68 | Feature requests are welcome. But take a moment to find out whether your idea 69 | fits with the scope and aims of the project. It's up to *you* to make a strong 70 | case to convince the project's developers of the merits of this feature. Please 71 | provide as much detail and context as possible. 72 | 73 | 74 | ## Pull requests 75 | 76 | Good pull requests - patches, improvements, new features - are a fantastic 77 | help. They should remain focused in scope and avoid containing unrelated 78 | commits. 79 | 80 | **Please ask first** before embarking on any significant pull request (e.g. 81 | implementing features, refactoring code, porting to a different language), 82 | otherwise you risk spending a lot of time working on something that the 83 | project's developers might not want to merge into the project. 84 | 85 | Please adhere to the coding conventions used throughout a project (indentation, 86 | accurate comments, etc.) and any other requirements (such as test coverage). 87 | 88 | Follow this process if you'd like your work considered for inclusion in the 89 | project: 90 | 91 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 92 | and configure the remotes: 93 | 94 | ```bash 95 | # Clone your fork of the repo into the current directory 96 | git clone https://github.com//rmt 97 | # Navigate to the newly cloned directory 98 | cd rmt 99 | # Assign the original repo to a remote called "upstream" 100 | git remote add upstream https://github.com/chrisenytc/rmt 101 | ``` 102 | 103 | 2. If you cloned a while ago, get the latest changes from upstream: 104 | 105 | ```bash 106 | git checkout 107 | git pull upstream 108 | ``` 109 | 110 | 3. Create a new topic branch (off the main project development branch) to 111 | contain your feature, change, or fix: 112 | 113 | ```bash 114 | git checkout -b 115 | ``` 116 | 117 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 118 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 119 | or your code is unlikely be merged into the main project. Use Git's 120 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 121 | feature to tidy up your commits before making them public. 122 | 123 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 124 | 125 | ```bash 126 | git pull [--rebase] upstream 127 | ``` 128 | 129 | 6. Push your topic branch up to your fork: 130 | 131 | ```bash 132 | git push origin 133 | ``` 134 | 135 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 136 | with a clear title and description. 137 | 138 | ## Conventions of commit messages 139 | 140 | Addding files on repo 141 | 142 | ```bash 143 | git commit -m "Add filename" 144 | ``` 145 | 146 | Updating files on repo 147 | 148 | ```bash 149 | git commit -m "Update filename, filename2, filename3" 150 | ``` 151 | 152 | Removing files on repo 153 | 154 | ```bash 155 | git commit -m "Remove filename" 156 | ``` 157 | 158 | Renaming files on repo 159 | 160 | ```bash 161 | git commit -m "Rename filename" 162 | ``` 163 | 164 | Fixing errors and issues on repo 165 | 166 | ```bash 167 | git commit -m "Fixed #issuenumber Message about this fix" 168 | ``` 169 | 170 | Adding features on repo 171 | 172 | ```bash 173 | git commit -m "Add Feature: nameoffeature Message about this feature" 174 | ``` 175 | 176 | Updating features on repo 177 | 178 | ```bash 179 | git commit -m "Update Feature: nameoffeature Message about this update" 180 | ``` 181 | 182 | Removing features on repo 183 | 184 | ```bash 185 | git commit -m "Remove Feature: nameoffeature Message about this" 186 | ``` 187 | 188 | Ignoring Travis CI build on repo 189 | 190 | ```bash 191 | git commit -m "Commit message here [ci-skip]" 192 | ``` 193 | 194 | **IMPORTANT**: By submitting a patch, you agree to allow the project owner to 195 | license your work under the same license as that used by the project. 196 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2015, Christopher EnyTC 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # rmt 2 | # https://github.com/chrisenytc/rmt 3 | # 4 | # Copyright (c) 2015, Christopher EnyTC 5 | # Licensed under the MIT license. 6 | 7 | 8 | test: 9 | 10 | @NODE_ENV=test ./node_modules/mocha/bin/mocha -R spec --ui bdd --colors --recursive -t 8000 ./test/*.spec.js 11 | 12 | .PHONY: test -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RmT [![Build Status](https://secure.travis-ci.org/chrisenytc/rmt.png?branch=master)](https://travis-ci.org/chrisenytc/rmt) [![NPM version](https://badge-me.herokuapp.com/api/npm/rmt.png)](http://badges.enytc.com/for/npm/rmt) 2 | 3 | > A CLI tool to remove all your tweets at once 4 | 5 | ## Getting Started 6 | Install the module with: 7 | 8 | ```bash 9 | $ npm install -g rmt 10 | ``` 11 | 12 | Example: 13 | 14 | 1º Enter your consumer key and consumer secret 15 | 16 | ```bash 17 | $ rmt setup 18 | ``` 19 | 20 | 2º Enter the PIN number provide by Twitter 21 | 22 | ```bash 23 | $ rmt login 24 | ``` 25 | 26 | ## Documentation 27 | 28 | #### setup 29 | 30 | The 'setup' action is responsible for save your consumer credentials 31 | 32 | How to use this action 33 | 34 | ```bash 35 | $ rmt setup 36 | 37 | _____ _______ 38 | | __ \ |__ __| 39 | | |__) | _ __ ___ | | 40 | | _ / | '_ ` _ \ | | 41 | | | \ \ | | | | | || | 42 | |_| \_\|_| |_| |_||_| 43 | 44 | RmT: A CLI tool to remove all your tweets at once 45 | 46 | Repo => https://github.com/chrisenytc/rmt 47 | Powered by => Christopher EnyTC 48 | 49 | [?] Enter your twitter consumerKey: uXChHM8h2Mn8NObUQHHAm758d 50 | [?] Enter your twitter consumerKey: 0nu8pesEslBITfVSGkBpRlnBPuoVt1pcPj2M8bSML8N8PAazCz 51 | 52 | [ Response ] ==> 53 | 54 | Settings updated successfully! 55 | ``` 56 | 57 | #### login 58 | 59 | The 'login' action is responsible for authorize RmT to access your account 60 | 61 | How to use this action 62 | 63 | ```bash 64 | $ rmt login 65 | 66 | _____ _______ 67 | | __ \ |__ __| 68 | | |__) | _ __ ___ | | 69 | | _ / | '_ ` _ \ | | 70 | | | \ \ | | | | | || | 71 | |_| \_\|_| |_| |_||_| 72 | 73 | RmT: A CLI tool to remove all your tweets at once 74 | 75 | Repo => https://github.com/chrisenytc/rmt 76 | Powered by => Christopher EnyTC 77 | 78 | In your browser, on the opened window by RmT, log in to your twitter account, click on "Authorize" button and enter the PIN number below. 79 | 80 | [?] Enter the pin number: 8038483 81 | 82 | [ Response ] ==> 83 | 84 | Logged successfully! 85 | ``` 86 | 87 | #### profile 88 | 89 | The 'profile' action is responsible for show your profile data 90 | 91 | How to use this action 92 | 93 | ```bash 94 | $ rmt profile 95 | 96 | _____ _______ 97 | | __ \ |__ __| 98 | | |__) | _ __ ___ | | 99 | | _ / | '_ ` _ \ | | 100 | | | \ \ | | | | | || | 101 | |_| \_\|_| |_| |_||_| 102 | 103 | RmT: A CLI tool to remove all your tweets at once 104 | 105 | Repo => https://github.com/chrisenytc/rmt 106 | Powered by => Christopher EnyTC 107 | 108 | [ Response ] ==> 109 | 110 | id: 382982819 111 | name: Christopher EnyTC 112 | username: chrisenytc 113 | location: Stockholm, Sweden 114 | followers: 4210 115 | tweets: 800 116 | createdAt: Mon Oct 17 18:49:56 +0000 2011 117 | ``` 118 | 119 | #### show [limit] 120 | 121 | **Parameter**: `limit` 122 | 123 | **Type**: `Number` 124 | 125 | **Example**: `8` 126 | 127 | The 'show' action is responsible for show your tweets 128 | 129 | How to use this action 130 | 131 | ```bash 132 | $ rmt show 2 133 | 134 | _____ _______ 135 | | __ \ |__ __| 136 | | |__) | _ __ ___ | | 137 | | _ / | '_ ` _ \ | | 138 | | | \ \ | | | | | || | 139 | |_| \_\|_| |_| |_||_| 140 | 141 | RmT: A CLI tool to remove all your tweets at once 142 | 143 | Repo => https://github.com/chrisenytc/rmt 144 | Powered by => Christopher EnyTC 145 | 146 | [ Response ] ==> 147 | 148 | \- New release of Slush Node with some improvements https://t.co/FB8nFdfiXq 149 | https://t.co/N4pxITWooc 150 | - A api wrapper to authenticate with twitter using the PIN-based authorization method. 151 | https://t.co/SbskpmzhYO 152 | https://t.co/2AtNGSqamC 153 | ``` 154 | 155 | #### remove 156 | 157 | The 'remove' action is responsible for remove all your tweets 158 | 159 | How to use this action to remove your last tweet 160 | 161 | ```bash 162 | $ rmt remove 163 | 164 | _____ _______ 165 | | __ \ |__ __| 166 | | |__) | _ __ ___ | | 167 | | _ / | '_ ` _ \ | | 168 | | | \ \ | | | | | || | 169 | |_| \_\|_| |_| |_||_| 170 | 171 | RmT: A CLI tool to remove all your tweets at once 172 | 173 | Repo => https://github.com/chrisenytc/rmt 174 | Powered by => Christopher EnyTC 175 | 176 | [ Response ] ==> 177 | 178 | [?] You really want to remove your last tweet? Yes 179 | 180 | Removing "Testing RmT 1" 181 | 182 | Tweet removed successfully! 183 | ``` 184 | 185 | How to use this action to remove all your tweets 186 | 187 | ```bash 188 | $ rmt remove --all 189 | 190 | _____ _______ 191 | | __ \ |__ __| 192 | | |__) | _ __ ___ | | 193 | | _ / | '_ ` _ \ | | 194 | | | \ \ | | | | | || | 195 | |_| \_\|_| |_| |_||_| 196 | 197 | RmT: A CLI tool to remove all your tweets at once 198 | 199 | Repo => https://github.com/chrisenytc/rmt 200 | Powered by => Christopher EnyTC 201 | 202 | [ Response ] ==> 203 | 204 | [?] You really want to remove all your tweets? Yes 205 | 206 | Removing "Testing RmT 8" 207 | 208 | Removing "Testing RmT 7" 209 | 210 | Removing "Testing RmT 6" 211 | 212 | Removing "Testing RmT 5" 213 | 214 | Removing "Testing RmT 4" 215 | 216 | Removing "Testing RmT 3" 217 | 218 | Removing "Testing RmT 2" 219 | 220 | Removing "Testing RmT 1" 221 | 222 | [ Response ] ==> 223 | 224 | All your tweets are deleted successfully! 225 | ``` 226 | 227 | ## Contributing 228 | 229 | See the [CONTRIBUTING Guidelines](https://github.com/chrisenytc/rmt/blob/master/CONTRIBUTING.md) 230 | 231 | ## Support 232 | If you have any problem or suggestion please open an issue [here](https://github.com/chrisenytc/rmt/issues). 233 | 234 | ## License 235 | 236 | The MIT License 237 | 238 | Copyright (c) 2015, Christopher EnyTC 239 | 240 | Permission is hereby granted, free of charge, to any person 241 | obtaining a copy of this software and associated documentation 242 | files (the "Software"), to deal in the Software without 243 | restriction, including without limitation the rights to use, 244 | copy, modify, merge, publish, distribute, sublicense, and/or sell 245 | copies of the Software, and to permit persons to whom the 246 | Software is furnished to do so, subject to the following 247 | conditions: 248 | 249 | The above copyright notice and this permission notice shall be 250 | included in all copies or substantial portions of the Software. 251 | 252 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 253 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 254 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 255 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 256 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 257 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 258 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 259 | OTHER DEALINGS IN THE SOFTWARE. 260 | 261 | -------------------------------------------------------------------------------- /bin/rmt.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | * rmt 5 | * https://github.com/chrisenytc/rmt 6 | * 7 | * Copyright (c) 2015, Christopher EnyTC 8 | * Licensed under the MIT license. 9 | */ 10 | 11 | /** 12 | * Module dependencies 13 | */ 14 | 15 | var program = require('commander'), 16 | updateNotifier = require('update-notifier'), 17 | Insight = require('insight'), 18 | pj = require('prettyjson').render, 19 | banner = require('../lib/banner.js'), 20 | RmT = require('..'), 21 | rmt, 22 | logged = false, 23 | path = require('path'), 24 | h = require('../lib/helpers.js'), 25 | debug = require('../lib/debugger.js'), 26 | pkg = require('../package.json'), 27 | configPath = path.join(__dirname, '..', 'lib', 'rmtConfig.json'); 28 | 29 | require('colors'); 30 | 31 | /* 32 | * RmT Insight 33 | */ 34 | 35 | var insight = new Insight({ 36 | trackingCode: 'UA-26025686-5', 37 | packageName: pkg.name, 38 | packageVersion: pkg.version 39 | }); 40 | 41 | // ask for permission the first time 42 | if (insight.optOut === undefined) { 43 | return insight.askPermission(); 44 | } 45 | 46 | insight.track('rmt', 'cli'); 47 | 48 | /* 49 | * RmT API 50 | */ 51 | 52 | if (h.exists(configPath)) { 53 | var config = require(configPath); 54 | rmt = new RmT(config.consumerKey, config.consumerSecret); 55 | if (config.accessTokenKey && config.accessTokenKey !== '' && config.accessTokenSecret && config.accessTokenSecret !== '') { 56 | logged = true; 57 | rmt.createClient(config.accessTokenKey, config.accessTokenSecret); 58 | } else { 59 | debug(' You need to login.\n Login now:\n \n $ rmt login', 'warning'); 60 | } 61 | } else { 62 | rmt = new RmT('consumerKey', 'consumerSecret'); 63 | debug(' To start using RmT you need add your credentials: \n $ rmt setup \n', 'info'); 64 | } 65 | 66 | /* 67 | * RmT Response 68 | */ 69 | 70 | function response(err, res, pureJson) { 71 | if (err) { 72 | console.log('\n[ ' + 'Error'.red.bold + ' ] ==> '); 73 | debug(err.message || ''); 74 | } 75 | if (res) { 76 | if (!pureJson) { 77 | console.log('\n[ ' + 'Response'.green.bold + ' ] ==> '); 78 | console.log(); 79 | console.log(pj(res)); 80 | } else { 81 | console.log(JSON.stringify(res, null, 4)); 82 | } 83 | } 84 | } 85 | 86 | /* 87 | * RmT Bootstrap 88 | */ 89 | 90 | program 91 | .version(pkg.version, '-v, --version') 92 | .usage('command [option]'.white); 93 | 94 | /* 95 | * RmT Options 96 | */ 97 | 98 | program 99 | .option('-j, --json', 'output as pure JSON'); 100 | 101 | program 102 | .option('-a, --all', 'remove all your tweets'); 103 | 104 | /* 105 | * RmT Setup 106 | */ 107 | 108 | program 109 | .command('setup') 110 | .description('Initial setup'.white) 111 | .action(function() { 112 | var prompts = [{ 113 | type: 'input', 114 | name: 'consumerKey', 115 | message: 'Enter your twitter consumerKey: ' 116 | }, { 117 | type: 'input', 118 | name: 'consumerSecret', 119 | message: 'Enter your twitter consumerKey: ' 120 | }]; 121 | //Ask 122 | rmt.prompt(prompts, function(answers) { 123 | rmt.setConfig(answers.consumerKey, answers.consumerSecret) 124 | .then(function(message) { 125 | response(null, message); 126 | }).catch(function(err) { 127 | response(err); 128 | }); 129 | }); 130 | }); 131 | 132 | /* 133 | * RmT Login 134 | */ 135 | 136 | program 137 | .command('login') 138 | .description('Authorize RmT to access your account'.white) 139 | .action(function() { 140 | rmt.login() 141 | .then(function(message) { 142 | response(null, message, program.json); 143 | }) 144 | .catch(function(err) { 145 | response(err); 146 | }); 147 | }); 148 | 149 | if (logged) { 150 | /* 151 | * RmT Logout 152 | */ 153 | program 154 | .command('logout') 155 | .description('Remove your twitter credentials'.white) 156 | .action(function() { 157 | var prompts = [{ 158 | type: 'confirm', 159 | name: 'logout', 160 | message: 'Are you sure you want to remove your twitter credentials?' 161 | }]; 162 | //Ask 163 | rmt.prompt(prompts, function(answers) { 164 | if (answers.logout) { 165 | rmt.logout() 166 | .then(function(message) { 167 | response(null, message, program.json); 168 | }) 169 | .catch(function(err) { 170 | response(err); 171 | }); 172 | } 173 | }); 174 | }); 175 | 176 | /* 177 | * RmT Profile 178 | */ 179 | program 180 | .command('profile') 181 | .description('Show profile data'.white) 182 | .action(function() { 183 | rmt.profile() 184 | .then(function(data) { 185 | response(null, data, program.json); 186 | }) 187 | .catch(function(err) { 188 | response(err); 189 | }); 190 | }); 191 | 192 | /* 193 | * RmT Show 194 | */ 195 | program 196 | .command('show [limit]') 197 | .description('Show your tweets'.white) 198 | .action(function(limit) { 199 | rmt.show(limit) 200 | .then(function(data) { 201 | response(null, data, program.json); 202 | }) 203 | .catch(function(err) { 204 | response(err); 205 | }); 206 | }); 207 | 208 | /* 209 | * RmT Remove 210 | */ 211 | program 212 | .command('remove') 213 | .description('Remove your tweets'.white) 214 | .action(function() { 215 | rmt.remove(program.all) 216 | .then(function(message) { 217 | response(null, message, program.json); 218 | }) 219 | .catch(function(err) { 220 | response(err); 221 | }); 222 | }); 223 | } 224 | 225 | /* 226 | * RmT on help ption show examples 227 | */ 228 | 229 | program.on('--help', function() { 230 | console.log(' Examples:'); 231 | console.log(''); 232 | console.log(' $ rmt setup'); 233 | console.log(' $ rmt login'); 234 | console.log(''); 235 | }); 236 | 237 | /* 238 | * RmT Banner 239 | */ 240 | 241 | if (process.argv.length === 3 && process.argv[2] === '--help') { 242 | banner(); 243 | } 244 | 245 | if (process.argv.length === 4 && process.argv[3] !== '--json') { 246 | banner(); 247 | } else { 248 | if (process.argv.length === 3 && process.argv[2] !== '--help') { 249 | banner(); 250 | } 251 | } 252 | 253 | /* 254 | * RmT Process Parser 255 | */ 256 | 257 | program.parse(process.argv); 258 | 259 | /* 260 | * RmT Default Action 261 | */ 262 | 263 | var notifier = updateNotifier({ 264 | packageName: pkg.name, 265 | packageVersion: pkg.version 266 | }); 267 | 268 | if (notifier.update) { 269 | notifier.notify(true); 270 | } 271 | 272 | if (process.argv.length === 2) { 273 | banner(); 274 | program.help(); 275 | } 276 | -------------------------------------------------------------------------------- /docs/api.js: -------------------------------------------------------------------------------- 1 | YUI.add("yuidoc-meta", function(Y) { 2 | Y.YUIDoc = { meta: { 3 | "classes": [ 4 | "Helpers", 5 | "RmT" 6 | ], 7 | "modules": [], 8 | "allModules": [] 9 | } }; 10 | }); -------------------------------------------------------------------------------- /docs/assets/css/external-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisenytc/rmt/850d04e9bf142a883f0bf94b1e8fd5b25b22b6c3/docs/assets/css/external-small.png -------------------------------------------------------------------------------- /docs/assets/css/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chrisenytc/rmt/850d04e9bf142a883f0bf94b1e8fd5b25b22b6c3/docs/assets/css/logo.png -------------------------------------------------------------------------------- /docs/assets/css/main.css: -------------------------------------------------------------------------------- 1 | /* 2 | Font sizes for all selectors other than the body are given in percentages, 3 | with 100% equal to 13px. To calculate a font size percentage, multiply the 4 | desired size in pixels by 7.6923076923. 5 | 6 | Here's a quick lookup table: 7 | 8 | 10px - 76.923% 9 | 11px - 84.615% 10 | 12px - 92.308% 11 | 13px - 100% 12 | 14px - 107.692% 13 | 15px - 115.385% 14 | 16px - 123.077% 15 | 17px - 130.769% 16 | 18px - 138.462% 17 | 19px - 146.154% 18 | 20px - 153.846% 19 | */ 20 | 21 | html { 22 | background: #fff; 23 | color: #333; 24 | overflow-y: scroll; 25 | } 26 | 27 | body { 28 | /*font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;*/ 29 | font: 13px/1.4 'Helvetica', 'Arial', sans-serif; 30 | margin: 0; 31 | padding: 0; 32 | } 33 | 34 | /* -- Links ----------------------------------------------------------------- */ 35 | a { 36 | color: #356de4; 37 | text-decoration: none; 38 | } 39 | 40 | .hidden { 41 | display: none; 42 | } 43 | 44 | a:hover { text-decoration: underline; } 45 | 46 | /* "Jump to Table of Contents" link is shown to assistive tools, but hidden from 47 | sight until it's focused. */ 48 | .jump { 49 | position: absolute; 50 | padding: 3px 6px; 51 | left: -99999px; 52 | top: 0; 53 | } 54 | 55 | .jump:focus { left: 40%; } 56 | 57 | /* -- Paragraphs ------------------------------------------------------------ */ 58 | p { margin: 1.3em 0; } 59 | dd p, td p { margin-bottom: 0; } 60 | dd p:first-child, td p:first-child { margin-top: 0; } 61 | 62 | /* -- Headings -------------------------------------------------------------- */ 63 | h1, h2, h3, h4, h5, h6 { 64 | color: #D98527;/*was #f80*/ 65 | font-family: 'Trebuchet MS', sans-serif; 66 | font-weight: bold; 67 | line-height: 1.1; 68 | margin: 1.1em 0 0.5em; 69 | } 70 | 71 | h1 { 72 | font-size: 184.6%; 73 | color: #30418C; 74 | margin: 0.75em 0 0.5em; 75 | } 76 | 77 | h2 { 78 | font-size: 153.846%; 79 | color: #E48A2B; 80 | } 81 | 82 | h3 { font-size: 138.462%; } 83 | 84 | h4 { 85 | border-bottom: 1px solid #DBDFEA; 86 | color: #E48A2B; 87 | font-size: 115.385%; 88 | font-weight: normal; 89 | padding-bottom: 2px; 90 | } 91 | 92 | h5, h6 { font-size: 107.692%; } 93 | 94 | /* -- Code and examples ----------------------------------------------------- */ 95 | code, kbd, pre, samp { 96 | font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; 97 | font-size: 92.308%; 98 | line-height: 1.35; 99 | } 100 | 101 | p code, p kbd, p samp, li code { 102 | background: #FCFBFA; 103 | border: 1px solid #EFEEED; 104 | padding: 0 3px; 105 | } 106 | 107 | a code, a kbd, a samp, 108 | pre code, pre kbd, pre samp, 109 | table code, table kbd, table samp, 110 | .intro code, .intro kbd, .intro samp, 111 | .toc code, .toc kbd, .toc samp { 112 | background: none; 113 | border: none; 114 | padding: 0; 115 | } 116 | 117 | pre.code, pre.terminal, pre.cmd { 118 | overflow-x: auto; 119 | *overflow-x: scroll; 120 | padding: 0.3em 0.6em; 121 | } 122 | 123 | pre.code { 124 | background: #FCFBFA; 125 | border: 1px solid #EFEEED; 126 | border-left-width: 5px; 127 | } 128 | 129 | pre.terminal, pre.cmd { 130 | background: #F0EFFC; 131 | border: 1px solid #D0CBFB; 132 | border-left: 5px solid #D0CBFB; 133 | } 134 | 135 | /* Don't reduce the font size of // elements inside
136 |    blocks. */
137 | pre code, pre kbd, pre samp { font-size: 100%; }
138 | 
139 | /* Used to denote text that shouldn't be selectable, such as line numbers or
140 |    shell prompts. Guess which browser this doesn't work in. */
141 | .noselect {
142 |     -moz-user-select: -moz-none;
143 |     -khtml-user-select: none;
144 |     -webkit-user-select: none;
145 |     -o-user-select: none;
146 |     user-select: none;
147 | }
148 | 
149 | /* -- Lists ----------------------------------------------------------------- */
150 | dd { margin: 0.2em 0 0.7em 1em; }
151 | dl { margin: 1em 0; }
152 | dt { font-weight: bold; }
153 | 
154 | /* -- Tables ---------------------------------------------------------------- */
155 | caption, th { text-align: left; }
156 | 
157 | table {
158 |     border-collapse: collapse;
159 |     width: 100%;
160 | }
161 | 
162 | td, th {
163 |     border: 1px solid #fff;
164 |     padding: 5px 12px;
165 |     vertical-align: top;
166 | }
167 | 
168 | td { background: #E6E9F5; }
169 | td dl { margin: 0; }
170 | td dl dl { margin: 1em 0; }
171 | td pre:first-child { margin-top: 0; }
172 | 
173 | th {
174 |     background: #D2D7E6;/*#97A0BF*/
175 |     border-bottom: none;
176 |     border-top: none;
177 |     color: #000;/*#FFF1D5*/
178 |     font-family: 'Trebuchet MS', sans-serif;
179 |     font-weight: bold;
180 |     line-height: 1.3;
181 |     white-space: nowrap;
182 | }
183 | 
184 | 
185 | /* -- Layout and Content ---------------------------------------------------- */
186 | #doc {
187 |     margin: auto;
188 |     min-width: 1024px;
189 | }
190 | 
191 | .content { padding: 0 20px 0 25px; }
192 | 
193 | .sidebar {
194 |     padding: 0 15px 0 10px;
195 | }
196 | #bd {
197 |     padding: 7px 0 130px;
198 |     position: relative;
199 |     width: 99%;
200 | }
201 | 
202 | /* -- Table of Contents ----------------------------------------------------- */
203 | 
204 | /* The #toc id refers to the single global table of contents, while the .toc
205 |    class refers to generic TOC lists that could be used throughout the page. */
206 | 
207 | .toc code, .toc kbd, .toc samp { font-size: 100%; }
208 | .toc li { font-weight: bold; }
209 | .toc li li { font-weight: normal; }
210 | 
211 | /* -- Intro and Example Boxes ----------------------------------------------- */
212 | /*
213 | .intro, .example { margin-bottom: 2em; }
214 | .example {
215 |     -moz-border-radius: 4px;
216 |     -webkit-border-radius: 4px;
217 |     border-radius: 4px;
218 |     -moz-box-shadow: 0 0 5px #bfbfbf;
219 |     -webkit-box-shadow: 0 0 5px #bfbfbf;
220 |     box-shadow: 0 0 5px #bfbfbf;
221 |     padding: 1em;
222 | }
223 | .intro {
224 |     background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
225 | }
226 | */
227 | 
228 | /* -- Other Styles ---------------------------------------------------------- */
229 | 
230 | /* These are probably YUI-specific, and should be moved out of Selleck's default
231 |    theme. */
232 | 
233 | .button {
234 |     border: 1px solid #dadada;
235 |     -moz-border-radius: 3px;
236 |     -webkit-border-radius: 3px;
237 |     border-radius: 3px;
238 |     color: #444;
239 |     display: inline-block;
240 |     font-family: Helvetica, Arial, sans-serif;
241 |     font-size: 92.308%;
242 |     font-weight: bold;
243 |     padding: 4px 13px 3px;
244 |     -moz-text-shadow: 1px 1px 0 #fff;
245 |     -webkit-text-shadow: 1px 1px 0 #fff;
246 |     text-shadow: 1px 1px 0 #fff;
247 |     white-space: nowrap;
248 | 
249 |     background: #EFEFEF; /* old browsers */
250 |     background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
251 |     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
252 |     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
253 | }
254 | 
255 | .button:hover {
256 |     border-color: #466899;
257 |     color: #fff;
258 |     text-decoration: none;
259 |     -moz-text-shadow: 1px 1px 0 #222;
260 |     -webkit-text-shadow: 1px 1px 0 #222;
261 |     text-shadow: 1px 1px 0 #222;
262 | 
263 |     background: #6396D8; /* old browsers */
264 |     background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
265 |     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
266 |     filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
267 | }
268 | 
269 | .newwindow { text-align: center; }
270 | 
271 | .header .version em {
272 |     display: block;
273 |     text-align: right;
274 | }
275 | 
276 | 
277 | #classdocs .item {
278 |     border-bottom: 1px solid #466899;
279 |     margin: 1em 0;
280 |     padding: 1.5em;
281 | }
282 | 
283 | #classdocs .item .params p,
284 |     #classdocs .item .returns p,{
285 |     display: inline;
286 | }
287 | 
288 | #classdocs .item em code, #classdocs .item em.comment {
289 |     color: green;
290 | }
291 | 
292 | #classdocs .item em.comment a {
293 |     color: green;
294 |     text-decoration: underline;
295 | }
296 | 
297 | #classdocs .foundat {
298 |     font-size: 11px;
299 |     font-style: normal;
300 | }
301 | 
302 | .attrs .emits {
303 |     margin-left: 2em;
304 |     padding: .5em;
305 |     border-left: 1px dashed #ccc;
306 | }
307 | 
308 | abbr {
309 |     border-bottom: 1px dashed #ccc;
310 |     font-size: 80%;
311 |     cursor: help;
312 | }
313 | 
314 | .prettyprint li.L0, 
315 | .prettyprint li.L1, 
316 | .prettyprint li.L2, 
317 | .prettyprint li.L3, 
318 | .prettyprint li.L5, 
319 | .prettyprint li.L6, 
320 | .prettyprint li.L7, 
321 | .prettyprint li.L8 {
322 |     list-style: decimal;
323 | }
324 | 
325 | ul li p {
326 |     margin-top: 0;
327 | }
328 | 
329 | .method .name {
330 |     font-size: 110%;
331 | }
332 | 
333 | .apidocs .methods .extends .method,
334 | .apidocs .properties .extends .property,
335 | .apidocs .attrs .extends .attr,
336 | .apidocs .events .extends .event {
337 |     font-weight: bold;
338 | }
339 | 
340 | .apidocs .methods .extends .inherited,
341 | .apidocs .properties .extends .inherited,
342 | .apidocs .attrs .extends .inherited,
343 | .apidocs .events .extends .inherited {
344 |     font-weight: normal;
345 | }
346 | 
347 | #hd {
348 |     background: whiteSmoke;
349 |     background: -moz-linear-gradient(top,#DCDBD9 0,#F6F5F3 100%);
350 |     background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#DCDBD9),color-stop(100%,#F6F5F3));
351 |     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dcdbd9',endColorstr='#F6F5F3',GradientType=0);
352 |     border-bottom: 1px solid #DFDFDF;
353 |     padding: 0 15px 1px 20px;
354 |     margin-bottom: 15px;
355 | }
356 | 
357 | #hd img {
358 |     margin-right: 10px;
359 |     vertical-align: middle;
360 | }
361 | 
362 | 
363 | /* -- API Docs CSS ---------------------------------------------------------- */
364 | 
365 | /*
366 | This file is organized so that more generic styles are nearer the top, and more
367 | specific styles are nearer the bottom of the file. This allows us to take full
368 | advantage of the cascade to avoid redundant style rules. Please respect this
369 | convention when making changes.
370 | */
371 | 
372 | /* -- Generic TabView styles ------------------------------------------------ */
373 | 
374 | /*
375 | These styles apply to all API doc tabviews. To change styles only for a
376 | specific tabview, see the other sections below.
377 | */
378 | 
379 | .yui3-js-enabled .apidocs .tabview {
380 |     visibility: hidden; /* Hide until the TabView finishes rendering. */
381 |     _visibility: visible;
382 | }
383 | 
384 | .apidocs .tabview.yui3-tabview-content { visibility: visible; }
385 | .apidocs .tabview .yui3-tabview-panel { background: #fff; }
386 | 
387 | /* -- Generic Content Styles ------------------------------------------------ */
388 | 
389 | /* Headings */
390 | h2, h3, h4, h5, h6 {
391 |     border: none;
392 |     color: #30418C;
393 |     font-weight: bold;
394 |     text-decoration: none;
395 | }
396 | 
397 | .link-docs {
398 |     float: right;
399 |     font-size: 15px;
400 |     margin: 4px 4px 6px;
401 |     padding: 6px 30px 5px;
402 | }
403 | 
404 | .apidocs { zoom: 1; }
405 | 
406 | /* Generic box styles. */
407 | .apidocs .box {
408 |     border: 1px solid;
409 |     border-radius: 3px;
410 |     margin: 1em 0;
411 |     padding: 0 1em;
412 | }
413 | 
414 | /* A flag is a compact, capsule-like indicator of some kind. It's used to
415 |    indicate private and protected items, item return types, etc. in an
416 |    attractive and unobtrusive way. */
417 | .apidocs .flag {
418 |     background: #bababa;
419 |     border-radius: 3px;
420 |     color: #fff;
421 |     font-size: 11px;
422 |     margin: 0 0.5em;
423 |     padding: 2px 4px 1px;
424 | }
425 | 
426 | /* Class/module metadata such as "Uses", "Extends", "Defined in", etc. */
427 | .apidocs .meta {
428 |     background: #f9f9f9;
429 |     border-color: #efefef;
430 |     color: #555;
431 |     font-size: 11px;
432 |     padding: 3px 6px;
433 | }
434 | 
435 | .apidocs .meta p { margin: 0; }
436 | 
437 | /* Deprecation warning. */
438 | .apidocs .box.deprecated,
439 | .apidocs .flag.deprecated {
440 |     background: #fdac9f;
441 |     border: 1px solid #fd7775;
442 | }
443 | 
444 | .apidocs .box.deprecated p { margin: 0.5em 0; }
445 | .apidocs .flag.deprecated { color: #333; }
446 | 
447 | /* Module/Class intro description. */
448 | .apidocs .intro {
449 |     background: #f0f1f8;
450 |     border-color: #d4d8eb;
451 | }
452 | 
453 | /* Loading spinners. */
454 | #bd.loading .apidocs,
455 | #api-list.loading .yui3-tabview-panel {
456 |     background: #fff url(../img/spinner.gif) no-repeat center 70px;
457 |     min-height: 150px;
458 | }
459 | 
460 | #bd.loading .apidocs .content,
461 | #api-list.loading .yui3-tabview-panel .apis {
462 |     display: none;
463 | }
464 | 
465 | .apidocs .no-visible-items { color: #666; }
466 | 
467 | /* Generic inline list. */
468 | .apidocs ul.inline {
469 |     display: inline;
470 |     list-style: none;
471 |     margin: 0;
472 |     padding: 0;
473 | }
474 | 
475 | .apidocs ul.inline li { display: inline; }
476 | 
477 | /* Comma-separated list. */
478 | .apidocs ul.commas li:after { content: ','; }
479 | .apidocs ul.commas li:last-child:after { content: ''; }
480 | 
481 | /* Keyboard shortcuts. */
482 | kbd .cmd { font-family: Monaco, Helvetica; }
483 | 
484 | /* -- Generic Access Level styles ------------------------------------------- */
485 | .apidocs .item.protected,
486 | .apidocs .item.private,
487 | .apidocs .index-item.protected,
488 | .apidocs .index-item.deprecated,
489 | .apidocs .index-item.private {
490 |     display: none;
491 | }
492 | 
493 | .show-deprecated .item.deprecated,
494 | .show-deprecated .index-item.deprecated,
495 | .show-protected .item.protected,
496 | .show-protected .index-item.protected,
497 | .show-private .item.private,
498 | .show-private .index-item.private {
499 |     display: block;
500 | }
501 | 
502 | .hide-inherited .item.inherited,
503 | .hide-inherited .index-item.inherited {
504 |     display: none;
505 | }
506 | 
507 | /* -- Generic Item Index styles --------------------------------------------- */
508 | .apidocs .index { margin: 1.5em 0 3em; }
509 | 
510 | .apidocs .index h3 {
511 |     border-bottom: 1px solid #efefef;
512 |     color: #333;
513 |     font-size: 13px;
514 |     margin: 2em 0 0.6em;
515 |     padding-bottom: 2px;
516 | }
517 | 
518 | .apidocs .index .no-visible-items { margin-top: 2em; }
519 | 
520 | .apidocs .index-list {
521 |     border-color: #efefef;
522 |     font-size: 12px;
523 |     list-style: none;
524 |     margin: 0;
525 |     padding: 0;
526 |     -moz-column-count: 4;
527 |     -moz-column-gap: 10px;
528 |     -moz-column-width: 170px;
529 |     -ms-column-count: 4;
530 |     -ms-column-gap: 10px;
531 |     -ms-column-width: 170px;
532 |     -o-column-count: 4;
533 |     -o-column-gap: 10px;
534 |     -o-column-width: 170px;
535 |     -webkit-column-count: 4;
536 |     -webkit-column-gap: 10px;
537 |     -webkit-column-width: 170px;
538 |     column-count: 4;
539 |     column-gap: 10px;
540 |     column-width: 170px;
541 | }
542 | 
543 | .apidocs .no-columns .index-list {
544 |     -moz-column-count: 1;
545 |     -ms-column-count: 1;
546 |     -o-column-count: 1;
547 |     -webkit-column-count: 1;
548 |     column-count: 1;
549 | }
550 | 
551 | .apidocs .index-item { white-space: nowrap; }
552 | 
553 | .apidocs .index-item .flag {
554 |     background: none;
555 |     border: none;
556 |     color: #afafaf;
557 |     display: inline;
558 |     margin: 0 0 0 0.2em;
559 |     padding: 0;
560 | }
561 | 
562 | /* -- Generic API item styles ----------------------------------------------- */
563 | .apidocs .args {
564 |     display: inline;
565 |     margin: 0 0.5em;
566 | }
567 | 
568 | .apidocs .flag.chainable { background: #46ca3b; }
569 | .apidocs .flag.protected { background: #9b86fc; }
570 | .apidocs .flag.private { background: #fd6b1b; }
571 | .apidocs .flag.async { background: #356de4; }
572 | .apidocs .flag.required { background: #e60923; }
573 | 
574 | .apidocs .item {
575 |     border-bottom: 1px solid #efefef;
576 |     margin: 1.5em 0 2em;
577 |     padding-bottom: 2em;
578 | }
579 | 
580 | .apidocs .item h4,
581 | .apidocs .item h5,
582 | .apidocs .item h6 {
583 |     color: #333;
584 |     font-family: inherit;
585 |     font-size: 100%;
586 | }
587 | 
588 | .apidocs .item .description p,
589 | .apidocs .item pre.code {
590 |     margin: 1em 0 0;
591 | }
592 | 
593 | .apidocs .item .meta {
594 |     background: none;
595 |     border: none;
596 |     padding: 0;
597 | }
598 | 
599 | .apidocs .item .name {
600 |     display: inline;
601 |     font-size: 14px;
602 | }
603 | 
604 | .apidocs .item .type,
605 | .apidocs .item .type a,
606 | .apidocs .returns-inline {
607 |     color: #555;
608 | }
609 | 
610 | .apidocs .item .type,
611 | .apidocs .returns-inline {
612 |     font-size: 11px;
613 |     margin: 0 0 0 0;
614 | }
615 | 
616 | .apidocs .item .type a { border-bottom: 1px dotted #afafaf; }
617 | .apidocs .item .type a:hover { border: none; }
618 | 
619 | /* -- Item Parameter List --------------------------------------------------- */
620 | .apidocs .params-list {
621 |     list-style: square;
622 |     margin: 1em 0 0 2em;
623 |     padding: 0;
624 | }
625 | 
626 | .apidocs .param { margin-bottom: 1em; }
627 | 
628 | .apidocs .param .type,
629 | .apidocs .param .type a {
630 |     color: #666;
631 | }
632 | 
633 | .apidocs .param .type {
634 |     margin: 0 0 0 0.5em;
635 |     *margin-left: 0.5em;
636 | }
637 | 
638 | .apidocs .param-name { font-weight: bold; }
639 | 
640 | /* -- Item "Emits" block ---------------------------------------------------- */
641 | .apidocs .item .emits {
642 |     background: #f9f9f9;
643 |     border-color: #eaeaea;
644 | }
645 | 
646 | /* -- Item "Returns" block -------------------------------------------------- */
647 | .apidocs .item .returns .type,
648 | .apidocs .item .returns .type a {
649 |     font-size: 100%;
650 |     margin: 0;
651 | }
652 | 
653 | /* -- Class Constructor block ----------------------------------------------- */
654 | .apidocs .constructor .item {
655 |     border: none;
656 |     padding-bottom: 0;
657 | }
658 | 
659 | /* -- File Source View ------------------------------------------------------ */
660 | .apidocs .file pre.code,
661 | #doc .apidocs .file pre.prettyprint {
662 |     background: inherit;
663 |     border: none;
664 |     overflow: visible;
665 |     padding: 0;
666 | }
667 | 
668 | .apidocs .L0,
669 | .apidocs .L1,
670 | .apidocs .L2,
671 | .apidocs .L3,
672 | .apidocs .L4,
673 | .apidocs .L5,
674 | .apidocs .L6,
675 | .apidocs .L7,
676 | .apidocs .L8,
677 | .apidocs .L9 {
678 |     background: inherit;
679 | }
680 | 
681 | /* -- Submodule List -------------------------------------------------------- */
682 | .apidocs .module-submodule-description {
683 |     font-size: 12px;
684 |     margin: 0.3em 0 1em;
685 | }
686 | 
687 | .apidocs .module-submodule-description p:first-child { margin-top: 0; }
688 | 
689 | /* -- Sidebar TabView ------------------------------------------------------- */
690 | #api-tabview { margin-top: 0.6em; }
691 | 
692 | #api-tabview-filter,
693 | #api-tabview-panel {
694 |     border: 1px solid #dfdfdf;
695 | }
696 | 
697 | #api-tabview-filter {
698 |     border-bottom: none;
699 |     border-top: none;
700 |     padding: 0.6em 10px 0 10px;
701 | }
702 | 
703 | #api-tabview-panel { border-top: none; }
704 | #api-filter { width: 97%; }
705 | 
706 | /* -- Content TabView ------------------------------------------------------- */
707 | #classdocs .yui3-tabview-panel { border: none; }
708 | 
709 | /* -- Source File Contents -------------------------------------------------- */
710 | .prettyprint li.L0,
711 | .prettyprint li.L1,
712 | .prettyprint li.L2,
713 | .prettyprint li.L3,
714 | .prettyprint li.L5,
715 | .prettyprint li.L6,
716 | .prettyprint li.L7,
717 | .prettyprint li.L8 {
718 |     list-style: decimal;
719 | }
720 | 
721 | /* -- API options ----------------------------------------------------------- */
722 | #api-options {
723 |     font-size: 11px;
724 |     margin-top: 2.2em;
725 |     position: absolute;
726 |     right: 1.5em;
727 | }
728 | 
729 | /*#api-options label { margin-right: 0.6em; }*/
730 | 
731 | /* -- API list -------------------------------------------------------------- */
732 | #api-list {
733 |     margin-top: 1.5em;
734 |     *zoom: 1;
735 | }
736 | 
737 | .apis {
738 |     font-size: 12px;
739 |     line-height: 1.4;
740 |     list-style: none;
741 |     margin: 0;
742 |     padding: 0.5em 0 0.5em 0.4em;
743 | }
744 | 
745 | .apis a {
746 |     border: 1px solid transparent;
747 |     display: block;
748 |     margin: 0 0 0 -4px;
749 |     padding: 1px 4px 0;
750 |     text-decoration: none;
751 |     _border: none;
752 |     _display: inline;
753 | }
754 | 
755 | .apis a:hover,
756 | .apis a:focus {
757 |     background: #E8EDFC;
758 |     background: -moz-linear-gradient(top, #e8edfc 0%, #becef7 100%);
759 |     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E8EDFC), color-stop(100%,#BECEF7));
760 |     border-color: #AAC0FA;
761 |     border-radius: 3px;
762 |     color: #333;
763 |     outline: none;
764 | }
765 | 
766 | .api-list-item a:hover,
767 | .api-list-item a:focus {
768 |     font-weight: bold;
769 |     text-shadow: 1px 1px 1px #fff;
770 | }
771 | 
772 | .apis .message { color: #888; }
773 | .apis .result a { padding: 3px 5px 2px; }
774 | 
775 | .apis .result .type {
776 |     right: 4px;
777 |     top: 7px;
778 | }
779 | 
780 | .api-list-item .yui3-highlight {
781 |     font-weight: bold;
782 | }
783 | 
784 | 


--------------------------------------------------------------------------------
/docs/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chrisenytc/rmt/850d04e9bf142a883f0bf94b1e8fd5b25b22b6c3/docs/assets/favicon.ico


--------------------------------------------------------------------------------
/docs/assets/img/spinner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chrisenytc/rmt/850d04e9bf142a883f0bf94b1e8fd5b25b22b6c3/docs/assets/img/spinner.gif


--------------------------------------------------------------------------------
/docs/assets/index.html:
--------------------------------------------------------------------------------
 1 | 
 2 | 
 3 |     
 4 |         Redirector
 5 |         
 6 |     
 7 |     
 8 |         Click here to redirect
 9 |     
10 | 
11 | 


--------------------------------------------------------------------------------
/docs/assets/js/api-filter.js:
--------------------------------------------------------------------------------
 1 | YUI.add('api-filter', function (Y) {
 2 | 
 3 | Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], {
 4 |     // -- Initializer ----------------------------------------------------------
 5 |     initializer: function () {
 6 |         this._bindUIACBase();
 7 |         this._syncUIACBase();
 8 |     },
 9 |     getDisplayName: function(name) {
10 | 
11 |         Y.each(Y.YUIDoc.meta.allModules, function(i) {
12 |             if (i.name === name && i.displayName) {
13 |                 name = i.displayName;
14 |             }
15 |         });
16 | 
17 |         return name;
18 |     }
19 | 
20 | }, {
21 |     // -- Attributes -----------------------------------------------------------
22 |     ATTRS: {
23 |         resultHighlighter: {
24 |             value: 'phraseMatch'
25 |         },
26 | 
27 |         // May be set to "classes" or "modules".
28 |         queryType: {
29 |             value: 'classes'
30 |         },
31 | 
32 |         source: {
33 |             valueFn: function() {
34 |                 var self = this;
35 |                 return function(q) {
36 |                     var data = Y.YUIDoc.meta[self.get('queryType')],
37 |                         out = [];
38 |                     Y.each(data, function(v) {
39 |                         if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
40 |                             out.push(v);
41 |                         }
42 |                     });
43 |                     return out;
44 |                 };
45 |             }
46 |         }
47 |     }
48 | });
49 | 
50 | }, '3.4.0', {requires: [
51 |     'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources'
52 | ]});
53 | 


--------------------------------------------------------------------------------
/docs/assets/js/api-list.js:
--------------------------------------------------------------------------------
  1 | YUI.add('api-list', function (Y) {
  2 | 
  3 | var Lang   = Y.Lang,
  4 |     YArray = Y.Array,
  5 | 
  6 |     APIList = Y.namespace('APIList'),
  7 | 
  8 |     classesNode    = Y.one('#api-classes'),
  9 |     inputNode      = Y.one('#api-filter'),
 10 |     modulesNode    = Y.one('#api-modules'),
 11 |     tabviewNode    = Y.one('#api-tabview'),
 12 | 
 13 |     tabs = APIList.tabs = {},
 14 | 
 15 |     filter = APIList.filter = new Y.APIFilter({
 16 |         inputNode : inputNode,
 17 |         maxResults: 1000,
 18 | 
 19 |         on: {
 20 |             results: onFilterResults
 21 |         }
 22 |     }),
 23 | 
 24 |     search = APIList.search = new Y.APISearch({
 25 |         inputNode : inputNode,
 26 |         maxResults: 100,
 27 | 
 28 |         on: {
 29 |             clear  : onSearchClear,
 30 |             results: onSearchResults
 31 |         }
 32 |     }),
 33 | 
 34 |     tabview = APIList.tabview = new Y.TabView({
 35 |         srcNode  : tabviewNode,
 36 |         panelNode: '#api-tabview-panel',
 37 |         render   : true,
 38 | 
 39 |         on: {
 40 |             selectionChange: onTabSelectionChange
 41 |         }
 42 |     }),
 43 | 
 44 |     focusManager = APIList.focusManager = tabviewNode.plug(Y.Plugin.NodeFocusManager, {
 45 |         circular   : true,
 46 |         descendants: '#api-filter, .yui3-tab-panel-selected .api-list-item a, .yui3-tab-panel-selected .result a',
 47 |         keys       : {next: 'down:40', previous: 'down:38'}
 48 |     }).focusManager,
 49 | 
 50 |     LIST_ITEM_TEMPLATE =
 51 |         '
  • ' + 52 | '{displayName}' + 53 | '
  • '; 54 | 55 | // -- Init --------------------------------------------------------------------- 56 | 57 | // Duckpunch FocusManager's key event handling to prevent it from handling key 58 | // events when a modifier is pressed. 59 | Y.before(function (e, activeDescendant) { 60 | if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { 61 | return new Y.Do.Prevent(); 62 | } 63 | }, focusManager, '_focusPrevious', focusManager); 64 | 65 | Y.before(function (e, activeDescendant) { 66 | if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { 67 | return new Y.Do.Prevent(); 68 | } 69 | }, focusManager, '_focusNext', focusManager); 70 | 71 | // Create a mapping of tabs in the tabview so we can refer to them easily later. 72 | tabview.each(function (tab, index) { 73 | var name = tab.get('label').toLowerCase(); 74 | 75 | tabs[name] = { 76 | index: index, 77 | name : name, 78 | tab : tab 79 | }; 80 | }); 81 | 82 | // Switch tabs on Ctrl/Cmd-Left/Right arrows. 83 | tabviewNode.on('key', onTabSwitchKey, 'down:37,39'); 84 | 85 | // Focus the filter input when the `/` key is pressed. 86 | Y.one(Y.config.doc).on('key', onSearchKey, 'down:83'); 87 | 88 | // Keep the Focus Manager up to date. 89 | inputNode.on('focus', function () { 90 | focusManager.set('activeDescendant', inputNode); 91 | }); 92 | 93 | // Update all tabview links to resolved URLs. 94 | tabview.get('panelNode').all('a').each(function (link) { 95 | link.setAttribute('href', link.get('href')); 96 | }); 97 | 98 | // -- Private Functions -------------------------------------------------------- 99 | function getFilterResultNode() { 100 | return filter.get('queryType') === 'classes' ? classesNode : modulesNode; 101 | } 102 | 103 | // -- Event Handlers ----------------------------------------------------------- 104 | function onFilterResults(e) { 105 | var frag = Y.one(Y.config.doc.createDocumentFragment()), 106 | resultNode = getFilterResultNode(), 107 | typePlural = filter.get('queryType'), 108 | typeSingular = typePlural === 'classes' ? 'class' : 'module'; 109 | 110 | if (e.results.length) { 111 | YArray.each(e.results, function (result) { 112 | frag.append(Lang.sub(LIST_ITEM_TEMPLATE, { 113 | rootPath : APIList.rootPath, 114 | displayName : filter.getDisplayName(result.highlighted), 115 | name : result.text, 116 | typePlural : typePlural, 117 | typeSingular: typeSingular 118 | })); 119 | }); 120 | } else { 121 | frag.append( 122 | '
  • ' + 123 | 'No ' + typePlural + ' found.' + 124 | '
  • ' 125 | ); 126 | } 127 | 128 | resultNode.empty(true); 129 | resultNode.append(frag); 130 | 131 | focusManager.refresh(); 132 | } 133 | 134 | function onSearchClear(e) { 135 | 136 | focusManager.refresh(); 137 | } 138 | 139 | function onSearchKey(e) { 140 | var target = e.target; 141 | 142 | if (target.test('input,select,textarea') 143 | || target.get('isContentEditable')) { 144 | return; 145 | } 146 | 147 | e.preventDefault(); 148 | 149 | inputNode.focus(); 150 | focusManager.refresh(); 151 | } 152 | 153 | function onSearchResults(e) { 154 | var frag = Y.one(Y.config.doc.createDocumentFragment()); 155 | 156 | if (e.results.length) { 157 | YArray.each(e.results, function (result) { 158 | frag.append(result.display); 159 | }); 160 | } else { 161 | frag.append( 162 | '
  • ' + 163 | 'No results found. Maybe you\'ll have better luck with a ' + 164 | 'different query?' + 165 | '
  • ' 166 | ); 167 | } 168 | 169 | 170 | focusManager.refresh(); 171 | } 172 | 173 | function onTabSelectionChange(e) { 174 | var tab = e.newVal, 175 | name = tab.get('label').toLowerCase(); 176 | 177 | tabs.selected = { 178 | index: tab.get('index'), 179 | name : name, 180 | tab : tab 181 | }; 182 | 183 | switch (name) { 184 | case 'classes': // fallthru 185 | case 'modules': 186 | filter.setAttrs({ 187 | minQueryLength: 0, 188 | queryType : name 189 | }); 190 | 191 | search.set('minQueryLength', -1); 192 | 193 | // Only send a request if this isn't the initially-selected tab. 194 | if (e.prevVal) { 195 | filter.sendRequest(filter.get('value')); 196 | } 197 | break; 198 | 199 | case 'everything': 200 | filter.set('minQueryLength', -1); 201 | search.set('minQueryLength', 1); 202 | 203 | if (search.get('value')) { 204 | search.sendRequest(search.get('value')); 205 | } else { 206 | inputNode.focus(); 207 | } 208 | break; 209 | 210 | default: 211 | // WTF? We shouldn't be here! 212 | filter.set('minQueryLength', -1); 213 | search.set('minQueryLength', -1); 214 | } 215 | 216 | if (focusManager) { 217 | setTimeout(function () { 218 | focusManager.refresh(); 219 | }, 1); 220 | } 221 | } 222 | 223 | function onTabSwitchKey(e) { 224 | var currentTabIndex = tabs.selected.index; 225 | 226 | if (!(e.ctrlKey || e.metaKey)) { 227 | return; 228 | } 229 | 230 | e.preventDefault(); 231 | 232 | switch (e.keyCode) { 233 | case 37: // left arrow 234 | if (currentTabIndex > 0) { 235 | tabview.selectChild(currentTabIndex - 1); 236 | inputNode.focus(); 237 | } 238 | break; 239 | 240 | case 39: // right arrow 241 | if (currentTabIndex < (Y.Object.size(tabs) - 2)) { 242 | tabview.selectChild(currentTabIndex + 1); 243 | inputNode.focus(); 244 | } 245 | break; 246 | } 247 | } 248 | 249 | }, '3.4.0', {requires: [ 250 | 'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview' 251 | ]}); 252 | -------------------------------------------------------------------------------- /docs/assets/js/api-search.js: -------------------------------------------------------------------------------- 1 | YUI.add('api-search', function (Y) { 2 | 3 | var Lang = Y.Lang, 4 | Node = Y.Node, 5 | YArray = Y.Array; 6 | 7 | Y.APISearch = Y.Base.create('apiSearch', Y.Base, [Y.AutoCompleteBase], { 8 | // -- Public Properties ---------------------------------------------------- 9 | RESULT_TEMPLATE: 10 | '
  • ' + 11 | '' + 12 | '

    {name}

    ' + 13 | '{resultType}' + 14 | '
    {description}
    ' + 15 | '{class}' + 16 | '
    ' + 17 | '
  • ', 18 | 19 | // -- Initializer ---------------------------------------------------------- 20 | initializer: function () { 21 | this._bindUIACBase(); 22 | this._syncUIACBase(); 23 | }, 24 | 25 | // -- Protected Methods ---------------------------------------------------- 26 | _apiResultFilter: function (query, results) { 27 | // Filter components out of the results. 28 | return YArray.filter(results, function (result) { 29 | return result.raw.resultType === 'component' ? false : result; 30 | }); 31 | }, 32 | 33 | _apiResultFormatter: function (query, results) { 34 | return YArray.map(results, function (result) { 35 | var raw = Y.merge(result.raw), // create a copy 36 | desc = raw.description || ''; 37 | 38 | // Convert description to text and truncate it if necessary. 39 | desc = Node.create('
    ' + desc + '
    ').get('text'); 40 | 41 | if (desc.length > 65) { 42 | desc = Y.Escape.html(desc.substr(0, 65)) + ' …'; 43 | } else { 44 | desc = Y.Escape.html(desc); 45 | } 46 | 47 | raw['class'] || (raw['class'] = ''); 48 | raw.description = desc; 49 | 50 | // Use the highlighted result name. 51 | raw.name = result.highlighted; 52 | 53 | return Lang.sub(this.RESULT_TEMPLATE, raw); 54 | }, this); 55 | }, 56 | 57 | _apiTextLocator: function (result) { 58 | return result.displayName || result.name; 59 | } 60 | }, { 61 | // -- Attributes ----------------------------------------------------------- 62 | ATTRS: { 63 | resultFormatter: { 64 | valueFn: function () { 65 | return this._apiResultFormatter; 66 | } 67 | }, 68 | 69 | resultFilters: { 70 | valueFn: function () { 71 | return this._apiResultFilter; 72 | } 73 | }, 74 | 75 | resultHighlighter: { 76 | value: 'phraseMatch' 77 | }, 78 | 79 | resultListLocator: { 80 | value: 'data.results' 81 | }, 82 | 83 | resultTextLocator: { 84 | valueFn: function () { 85 | return this._apiTextLocator; 86 | } 87 | }, 88 | 89 | source: { 90 | value: '/api/v1/search?q={query}&count={maxResults}' 91 | } 92 | } 93 | }); 94 | 95 | }, '3.4.0', {requires: [ 96 | 'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources', 97 | 'escape' 98 | ]}); 99 | -------------------------------------------------------------------------------- /docs/assets/js/apidocs.js: -------------------------------------------------------------------------------- 1 | YUI().use( 2 | 'yuidoc-meta', 3 | 'api-list', 'history-hash', 'node-screen', 'node-style', 'pjax', 4 | function (Y) { 5 | 6 | var win = Y.config.win, 7 | localStorage = win.localStorage, 8 | 9 | bdNode = Y.one('#bd'), 10 | 11 | pjax, 12 | defaultRoute, 13 | 14 | classTabView, 15 | selectedTab; 16 | 17 | // Kill pjax functionality unless serving over HTTP. 18 | if (!Y.getLocation().protocol.match(/^https?\:/)) { 19 | Y.Router.html5 = false; 20 | } 21 | 22 | // Create the default route with middleware which enables syntax highlighting 23 | // on the loaded content. 24 | defaultRoute = Y.Pjax.defaultRoute.concat(function (req, res, next) { 25 | prettyPrint(); 26 | bdNode.removeClass('loading'); 27 | 28 | next(); 29 | }); 30 | 31 | pjax = new Y.Pjax({ 32 | container : '#docs-main', 33 | contentSelector: '#docs-main > .content', 34 | linkSelector : '#bd a', 35 | titleSelector : '#xhr-title', 36 | 37 | navigateOnHash: true, 38 | root : '/', 39 | routes : [ 40 | // -- / ---------------------------------------------------------------- 41 | { 42 | path : '/(index.html)?', 43 | callbacks: defaultRoute 44 | }, 45 | 46 | // -- /classes/* ------------------------------------------------------- 47 | { 48 | path : '/classes/:class.html*', 49 | callbacks: [defaultRoute, 'handleClasses'] 50 | }, 51 | 52 | // -- /files/* --------------------------------------------------------- 53 | { 54 | path : '/files/*file', 55 | callbacks: [defaultRoute, 'handleFiles'] 56 | }, 57 | 58 | // -- /modules/* ------------------------------------------------------- 59 | { 60 | path : '/modules/:module.html*', 61 | callbacks: defaultRoute 62 | } 63 | ] 64 | }); 65 | 66 | // -- Utility Functions -------------------------------------------------------- 67 | 68 | pjax.checkVisibility = function (tab) { 69 | tab || (tab = selectedTab); 70 | 71 | if (!tab) { return; } 72 | 73 | var panelNode = tab.get('panelNode'), 74 | visibleItems; 75 | 76 | // If no items are visible in the tab panel due to the current visibility 77 | // settings, display a message to that effect. 78 | visibleItems = panelNode.all('.item,.index-item').some(function (itemNode) { 79 | if (itemNode.getComputedStyle('display') !== 'none') { 80 | return true; 81 | } 82 | }); 83 | 84 | panelNode.all('.no-visible-items').remove(); 85 | 86 | if (!visibleItems) { 87 | if (Y.one('#index .index-item')) { 88 | panelNode.append( 89 | '
    ' + 90 | '

    ' + 91 | 'Some items are not shown due to the current visibility ' + 92 | 'settings. Use the checkboxes at the upper right of this ' + 93 | 'page to change the visibility settings.' + 94 | '

    ' + 95 | '
    ' 96 | ); 97 | } else { 98 | panelNode.append( 99 | '
    ' + 100 | '

    ' + 101 | 'This class doesn\'t provide any methods, properties, ' + 102 | 'attributes, or events.' + 103 | '

    ' + 104 | '
    ' 105 | ); 106 | } 107 | } 108 | 109 | // Hide index sections without any visible items. 110 | Y.all('.index-section').each(function (section) { 111 | var items = 0, 112 | visibleItems = 0; 113 | 114 | section.all('.index-item').each(function (itemNode) { 115 | items += 1; 116 | 117 | if (itemNode.getComputedStyle('display') !== 'none') { 118 | visibleItems += 1; 119 | } 120 | }); 121 | 122 | section.toggleClass('hidden', !visibleItems); 123 | section.toggleClass('no-columns', visibleItems < 4); 124 | }); 125 | }; 126 | 127 | pjax.initClassTabView = function () { 128 | if (!Y.all('#classdocs .api-class-tab').size()) { 129 | return; 130 | } 131 | 132 | if (classTabView) { 133 | classTabView.destroy(); 134 | selectedTab = null; 135 | } 136 | 137 | classTabView = new Y.TabView({ 138 | srcNode: '#classdocs', 139 | 140 | on: { 141 | selectionChange: pjax.onTabSelectionChange 142 | } 143 | }); 144 | 145 | pjax.updateTabState(); 146 | classTabView.render(); 147 | }; 148 | 149 | pjax.initLineNumbers = function () { 150 | var hash = win.location.hash.substring(1), 151 | container = pjax.get('container'), 152 | hasLines, node; 153 | 154 | // Add ids for each line number in the file source view. 155 | container.all('.linenums>li').each(function (lineNode, index) { 156 | lineNode.set('id', 'l' + (index + 1)); 157 | lineNode.addClass('file-line'); 158 | hasLines = true; 159 | }); 160 | 161 | // Scroll to the desired line. 162 | if (hasLines && /^l\d+$/.test(hash)) { 163 | if ((node = container.getById(hash))) { 164 | win.scroll(0, node.getY()); 165 | } 166 | } 167 | }; 168 | 169 | pjax.initRoot = function () { 170 | var terminators = /^(?:classes|files|modules)$/, 171 | parts = pjax._getPathRoot().split('/'), 172 | root = [], 173 | i, len, part; 174 | 175 | for (i = 0, len = parts.length; i < len; i += 1) { 176 | part = parts[i]; 177 | 178 | if (part.match(terminators)) { 179 | // Makes sure the path will end with a "/". 180 | root.push(''); 181 | break; 182 | } 183 | 184 | root.push(part); 185 | } 186 | 187 | pjax.set('root', root.join('/')); 188 | }; 189 | 190 | pjax.updateTabState = function (src) { 191 | var hash = win.location.hash.substring(1), 192 | defaultTab, node, tab, tabPanel; 193 | 194 | function scrollToNode() { 195 | if (node.hasClass('protected')) { 196 | Y.one('#api-show-protected').set('checked', true); 197 | pjax.updateVisibility(); 198 | } 199 | 200 | if (node.hasClass('private')) { 201 | Y.one('#api-show-private').set('checked', true); 202 | pjax.updateVisibility(); 203 | } 204 | 205 | setTimeout(function () { 206 | // For some reason, unless we re-get the node instance here, 207 | // getY() always returns 0. 208 | var node = Y.one('#classdocs').getById(hash); 209 | win.scrollTo(0, node.getY() - 70); 210 | }, 1); 211 | } 212 | 213 | if (!classTabView) { 214 | return; 215 | } 216 | 217 | if (src === 'hashchange' && !hash) { 218 | defaultTab = 'index'; 219 | } else { 220 | if (localStorage) { 221 | defaultTab = localStorage.getItem('tab_' + pjax.getPath()) || 222 | 'index'; 223 | } else { 224 | defaultTab = 'index'; 225 | } 226 | } 227 | 228 | if (hash && (node = Y.one('#classdocs').getById(hash))) { 229 | if ((tabPanel = node.ancestor('.api-class-tabpanel', true))) { 230 | if ((tab = Y.one('#classdocs .api-class-tab.' + tabPanel.get('id')))) { 231 | if (classTabView.get('rendered')) { 232 | Y.Widget.getByNode(tab).set('selected', 1); 233 | } else { 234 | tab.addClass('yui3-tab-selected'); 235 | } 236 | } 237 | } 238 | 239 | // Scroll to the desired element if this is a hash URL. 240 | if (node) { 241 | if (classTabView.get('rendered')) { 242 | scrollToNode(); 243 | } else { 244 | classTabView.once('renderedChange', scrollToNode); 245 | } 246 | } 247 | } else { 248 | tab = Y.one('#classdocs .api-class-tab.' + defaultTab); 249 | 250 | // When the `defaultTab` node isn't found, `localStorage` is stale. 251 | if (!tab && defaultTab !== 'index') { 252 | tab = Y.one('#classdocs .api-class-tab.index'); 253 | } 254 | 255 | if (classTabView.get('rendered')) { 256 | Y.Widget.getByNode(tab).set('selected', 1); 257 | } else { 258 | tab.addClass('yui3-tab-selected'); 259 | } 260 | } 261 | }; 262 | 263 | pjax.updateVisibility = function () { 264 | var container = pjax.get('container'); 265 | 266 | container.toggleClass('hide-inherited', 267 | !Y.one('#api-show-inherited').get('checked')); 268 | 269 | container.toggleClass('show-deprecated', 270 | Y.one('#api-show-deprecated').get('checked')); 271 | 272 | container.toggleClass('show-protected', 273 | Y.one('#api-show-protected').get('checked')); 274 | 275 | container.toggleClass('show-private', 276 | Y.one('#api-show-private').get('checked')); 277 | 278 | pjax.checkVisibility(); 279 | }; 280 | 281 | // -- Route Handlers ----------------------------------------------------------- 282 | 283 | pjax.handleClasses = function (req, res, next) { 284 | var status = res.ioResponse.status; 285 | 286 | // Handles success and local filesystem XHRs. 287 | if (res.ioResponse.readyState === 4 && (!status || (status >= 200 && status < 300))) { 288 | pjax.initClassTabView(); 289 | } 290 | 291 | next(); 292 | }; 293 | 294 | pjax.handleFiles = function (req, res, next) { 295 | var status = res.ioResponse.status; 296 | 297 | // Handles success and local filesystem XHRs. 298 | if (res.ioResponse.readyState === 4 && (!status || (status >= 200 && status < 300))) { 299 | pjax.initLineNumbers(); 300 | } 301 | 302 | next(); 303 | }; 304 | 305 | // -- Event Handlers ----------------------------------------------------------- 306 | 307 | pjax.onNavigate = function (e) { 308 | var hash = e.hash, 309 | originTarget = e.originEvent && e.originEvent.target, 310 | tab; 311 | 312 | if (hash) { 313 | tab = originTarget && originTarget.ancestor('.yui3-tab', true); 314 | 315 | if (hash === win.location.hash) { 316 | pjax.updateTabState('hashchange'); 317 | } else if (!tab) { 318 | win.location.hash = hash; 319 | } 320 | 321 | e.preventDefault(); 322 | return; 323 | } 324 | 325 | // Only scroll to the top of the page when the URL doesn't have a hash. 326 | this.set('scrollToTop', !e.url.match(/#.+$/)); 327 | 328 | bdNode.addClass('loading'); 329 | }; 330 | 331 | pjax.onOptionClick = function (e) { 332 | pjax.updateVisibility(); 333 | }; 334 | 335 | pjax.onTabSelectionChange = function (e) { 336 | var tab = e.newVal, 337 | tabId = tab.get('contentBox').getAttribute('href').substring(1); 338 | 339 | selectedTab = tab; 340 | 341 | // If switching from a previous tab (i.e., this is not the default tab), 342 | // replace the history entry with a hash URL that will cause this tab to 343 | // be selected if the user navigates away and then returns using the back 344 | // or forward buttons. 345 | if (e.prevVal && localStorage) { 346 | localStorage.setItem('tab_' + pjax.getPath(), tabId); 347 | } 348 | 349 | pjax.checkVisibility(tab); 350 | }; 351 | 352 | // -- Init --------------------------------------------------------------------- 353 | 354 | pjax.on('navigate', pjax.onNavigate); 355 | 356 | pjax.initRoot(); 357 | pjax.upgrade(); 358 | pjax.initClassTabView(); 359 | pjax.initLineNumbers(); 360 | pjax.updateVisibility(); 361 | 362 | Y.APIList.rootPath = pjax.get('root'); 363 | 364 | Y.one('#api-options').delegate('click', pjax.onOptionClick, 'input'); 365 | 366 | Y.on('hashchange', function (e) { 367 | pjax.updateTabState('hashchange'); 368 | }, win); 369 | 370 | }); 371 | -------------------------------------------------------------------------------- /docs/assets/js/yui-prettify.js: -------------------------------------------------------------------------------- 1 | YUI().use('node', function(Y) { 2 | var code = Y.all('.prettyprint.linenums'); 3 | if (code.size()) { 4 | code.each(function(c) { 5 | var lis = c.all('ol li'), 6 | l = 1; 7 | lis.each(function(n) { 8 | n.prepend(''); 9 | l++; 10 | }); 11 | }); 12 | var h = location.hash; 13 | location.hash = ''; 14 | h = h.replace('LINE_', 'LINENUM_'); 15 | location.hash = h; 16 | } 17 | }); 18 | -------------------------------------------------------------------------------- /docs/assets/vendor/prettify/CHANGES.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Change Log 5 | 6 | 7 | README 8 | 9 |

    Known Issues

    10 |
      11 |
    • Perl formatting is really crappy. Partly because the author is lazy and 12 | partly because Perl is 13 | hard to parse. 14 |
    • On some browsers, <code> elements with newlines in the text 15 | which use CSS to specify white-space:pre will have the newlines 16 | improperly stripped if the element is not attached to the document at the time 17 | the stripping is done. Also, on IE 6, all newlines will be stripped from 18 | <code> elements because of the way IE6 produces 19 | innerHTML. Workaround: use <pre> for code with 20 | newlines. 21 |
    22 | 23 |

    Change Log

    24 |

    29 March 2007

    25 |
      26 |
    • Added tests for PHP support 27 | to address 28 | issue 3. 30 |
    • Fixed 31 | bug: prettyPrintOne was not halting. This was not 33 | reachable through the normal entry point. 34 |
    • Fixed 35 | bug: recursing into a script block or PHP tag that was not properly 37 | closed would not silently drop the content. 38 | (test) 39 |
    • Fixed 40 | bug: was eating tabs 42 | (test) 43 |
    • Fixed entity handling so that the caveat 44 |
      45 |

      Caveats: please properly escape less-thans. x&lt;y 46 | instead of x<y, and use " instead of 47 | &quot; for string delimiters.

      48 |
      49 | is no longer applicable. 50 |
    • Added noisefree's C# 51 | patch 53 |
    • Added a distribution that has comments and 54 | whitespace removed to reduce download size from 45.5kB to 12.8kB. 55 |
    56 |

    4 Jul 2008

    57 |
      58 |
    • Added language specific formatters that are triggered by the presence 59 | of a lang-<language-file-extension>
    • 60 |
    • Fixed bug: python handling of '''string''' 61 |
    • Fixed bug: / in regex [charsets] should not end regex 62 |
    63 |

    5 Jul 2008

    64 |
      65 |
    • Defined language extensions for Lisp and Lua 66 |
    67 |

    14 Jul 2008

    68 |
      69 |
    • Language handlers for F#, OCAML, SQL 70 |
    • Support for nocode spans to allow embedding of line 71 | numbers and code annotations which should not be styled or otherwise 72 | affect the tokenization of prettified code. 73 | See the issue 22 74 | testcase. 75 |
    76 |

    6 Jan 2009

    77 |
      78 |
    • Language handlers for Visual Basic, Haskell, CSS, and WikiText
    • 79 |
    • Added .mxml extension to the markup style handler for 80 | Flex MXML files. See 81 | issue 37. 84 |
    • Added .m extension to the C style handler so that Objective 85 | C source files properly highlight. See 86 | issue 58. 89 |
    • Changed HTML lexer to use the same embedded source mechanism as the 90 | wiki language handler, and changed to use the registered 91 | CSS handler for STYLE element content. 92 |
    93 |

    21 May 2009

    94 |
      95 |
    • Rewrote to improve performance on large files. 96 | See benchmarks.
    • 97 |
    • Fixed bugs with highlighting of Haskell line comments, Lisp 98 | number literals, Lua strings, C preprocessor directives, 99 | newlines in Wiki code on Windows, and newlines in IE6.
    • 100 |
    101 |

    14 August 2009

    102 |
      103 |
    • Fixed prettifying of <code> blocks with embedded newlines. 104 |
    105 |

    3 October 2009

    106 |
      107 |
    • Fixed prettifying of XML/HTML tags that contain uppercase letters. 108 |
    109 |

    19 July 2010

    110 |
      111 |
    • Added support for line numbers. Bug 112 | 22
    • 114 |
    • Added YAML support. Bug 115 | 123
    • 117 |
    • Added VHDL support courtesy Le Poussin.
    • 118 |
    • IE performance improvements. Bug 119 | 102 courtesy jacobly.
    • 121 |
    • A variety of markup formatting fixes courtesy smain and thezbyg.
    • 122 |
    • Fixed copy and paste in IE[678]. 123 |
    • Changed output to use &#160; instead of 124 | &nbsp; so that the output works when embedded in XML. 125 | Bug 126 | 108.
    • 128 |
    129 | 130 | 131 | -------------------------------------------------------------------------------- /docs/assets/vendor/prettify/COPYING: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /docs/assets/vendor/prettify/README.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Javascript code prettifier 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | Languages : CH 20 |

    Javascript code prettifier

    21 | 22 |

    Setup

    23 |
      24 |
    1. Download a distribution 25 |
    2. Include the script and stylesheets in your document 26 | (you will need to make sure the css and js file are on your server, and 27 | adjust the paths in the script and link tag) 28 |
       29 | <link href="prettify.css" type="text/css" rel="stylesheet" />
       30 | <script type="text/javascript" src="prettify.js"></script>
      31 |
    3. Add onload="prettyPrint()" to your 32 | document's body tag. 33 |
    4. Modify the stylesheet to get the coloring you prefer
    5. 34 |
    35 | 36 |

    Usage

    37 |

    Put code snippets in 38 | <pre class="prettyprint">...</pre> 39 | or <code class="prettyprint">...</code> 40 | and it will automatically be pretty printed. 41 | 42 | 43 | 44 | 47 |
    The original 45 | Prettier 46 |
    class Voila {
     49 | public:
     50 |   // Voila
     51 |   static const string VOILA = "Voila";
     52 | 
     53 |   // will not interfere with embedded tags.
     54 | }
    55 | 56 |
    class Voila {
     57 | public:
     58 |   // Voila
     59 |   static const string VOILA = "Voila";
     60 | 
     61 |   // will not interfere with embedded tags.
     62 | }
    63 |
    64 | 65 |

    FAQ

    66 |

    Which languages does it work for?

    67 |

    The comments in prettify.js are authoritative but the lexer 68 | should work on a number of languages including C and friends, 69 | Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. 70 | It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl 71 | and Ruby, but, because of commenting conventions, doesn't work on 72 | Smalltalk, or CAML-like languages.

    73 | 74 |

    LISPy languages are supported via an extension: 75 | lang-lisp.js.

    77 |

    And similarly for 78 | CSS, 80 | Haskell, 82 | Lua, 84 | OCAML, SML, F#, 86 | Visual Basic, 88 | SQL, 90 | Protocol Buffers, and 92 | WikiText.. 94 | 95 |

    If you'd like to add an extension for your favorite language, please 96 | look at src/lang-lisp.js and file an 97 | issue including your language extension, and a testcase.

    99 | 100 |

    How do I specify which language my code is in?

    101 |

    You don't need to specify the language since prettyprint() 102 | will guess. You can specify a language by specifying the language extension 103 | along with the prettyprint class like so:

    104 |
    <pre class="prettyprint lang-html">
    106 |   The lang-* class specifies the language file extensions.
    107 |   File extensions supported by default include
    108 |     "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
    109 |     "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
    110 |     "xhtml", "xml", "xsl".
    111 | </pre>
    112 | 113 |

    It doesn't work on <obfuscated code sample>?

    114 |

    Yes. Prettifying obfuscated code is like putting lipstick on a pig 115 | — i.e. outside the scope of this tool.

    116 | 117 |

    Which browsers does it work with?

    118 |

    It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. 119 | Look at the test page to see if it 120 | works in your browser.

    121 | 122 |

    What's changed?

    123 |

    See the change log

    124 | 125 |

    Why doesn't Prettyprinting of strings work on WordPress?

    126 |

    Apparently wordpress does "smart quoting" which changes close quotes. 127 | This causes end quotes to not match up with open quotes. 128 |

    This breaks prettifying as well as copying and pasting of code samples. 129 | See 130 | WordPress's help center for info on how to stop smart quoting of code 132 | snippets.

    133 | 134 |

    How do I put line numbers in my code?

    135 |

    You can use the linenums class to turn on line 136 | numbering. If your code doesn't start at line number 1, you can 137 | add a colon and a line number to the end of that class as in 138 | linenums:52. 139 | 140 |

    For example 141 |

    <pre class="prettyprint linenums:4"
    142 | >// This is line 4.
    143 | foo();
    144 | bar();
    145 | baz();
    146 | boo();
    147 | far();
    148 | faz();
    149 | <pre>
    150 | produces 151 |
    // This is line 4.
    153 | foo();
    154 | bar();
    155 | baz();
    156 | boo();
    157 | far();
    158 | faz();
    159 | 
    160 | 161 |

    How do I prevent a portion of markup from being marked as code?

    162 |

    You can use the nocode class to identify a span of markup 163 | that is not code. 164 |

    <pre class=prettyprint>
    165 | int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
    166 |   Continuation of comment */
    167 | int y = bar();
    168 | </pre>
    169 | produces 170 |
    171 | int x = foo();  /* This is a comment  This is not code
    172 |   Continuation of comment */
    173 | int y = bar();
    174 | 
    175 | 176 |

    For a more complete example see the issue22 177 | testcase.

    178 | 179 |

    I get an error message "a is not a function" or "opt_whenDone is not a function"

    180 |

    If you are calling prettyPrint via an event handler, wrap it in a function. 181 | Instead of doing 182 |

    183 | addEventListener('load', prettyPrint, false); 185 |
    186 | wrap it in a closure like 187 |
    188 | addEventListener('load', function (event) { prettyPrint() }, false); 190 |
    191 | so that the browser does not pass an event object to prettyPrint which 192 | will confuse it. 193 | 194 |


    195 | 196 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /docs/assets/vendor/prettify/prettify-min.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} -------------------------------------------------------------------------------- /docs/assets/vendor/prettify/prettify-min.js: -------------------------------------------------------------------------------- 1 | window.PR_SHOULD_USE_CONTINUATION=true;var prettyPrintOne;var prettyPrint;(function(){var O=window;var j=["break,continue,do,else,for,if,return,while"];var v=[j,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var q=[v,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var m=[q,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var y=[q,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var T=[y,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"];var s="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes";var x=[q,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var t="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var J=[j,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var g=[j,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var I=[j,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var B=[m,T,x,t+J,g,I];var f=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;var D="str";var A="kwd";var k="com";var Q="typ";var H="lit";var M="pun";var G="pln";var n="tag";var F="dec";var K="src";var R="atn";var o="atv";var P="nocode";var N="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function l(ab){var af=0;var U=false;var ae=false;for(var X=0,W=ab.length;X122)){if(!(am<65||ai>90)){ah.push([Math.max(65,ai)|32,Math.min(am,90)|32])}if(!(am<97||ai>122)){ah.push([Math.max(97,ai)&~32,Math.min(am,122)&~32])}}}}ah.sort(function(aw,av){return(aw[0]-av[0])||(av[1]-aw[1])});var ak=[];var aq=[];for(var at=0;atau[0]){if(au[1]+1>au[0]){ao.push("-")}ao.push(V(au[1]))}}ao.push("]");return ao.join("")}function Y(an){var al=an.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var aj=al.length;var ap=[];for(var am=0,ao=0;am=2&&ak==="["){al[am]=Z(ai)}else{if(ak!=="\\"){al[am]=ai.replace(/[a-zA-Z]/g,function(aq){var ar=aq.charCodeAt(0);return"["+String.fromCharCode(ar&~32,ar|32)+"]"})}}}}return al.join("")}var ac=[];for(var X=0,W=ab.length;X=0;){U[ae.charAt(ag)]=aa}}var ah=aa[1];var ac=""+ah;if(!ai.hasOwnProperty(ac)){aj.push(ah);ai[ac]=null}}aj.push(/[\0-\uffff]/);X=l(aj)})();var Z=V.length;var Y=function(aj){var ab=aj.sourceCode,aa=aj.basePos;var af=[aa,G];var ah=0;var ap=ab.match(X)||[];var al={};for(var ag=0,at=ap.length;ag=5&&"lang-"===ar.substring(0,5);if(ao&&!(ak&&typeof ak[1]==="string")){ao=false;ar=K}if(!ao){al[ai]=ar}}var ad=ah;ah+=ai.length;if(!ao){af.push(aa+ad,ar)}else{var an=ak[1];var am=ai.indexOf(an);var ae=am+an.length;if(ak[2]){ae=ai.length-ak[2].length;am=ae-an.length}var au=ar.substring(5);C(aa+ad,ai.substring(0,am),Y,af);C(aa+ad+am,an,r(au,an),af);C(aa+ad+ae,ai.substring(ae),Y,af)}}aj.decorations=af};return Y}function i(V){var Y=[],U=[];if(V.tripleQuotedStrings){Y.push([D,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(V.multiLineStrings){Y.push([D,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{Y.push([D,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(V.verbatimStrings){U.push([D,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var ab=V.hashComments;if(ab){if(V.cStyleComments){if(ab>1){Y.push([k,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{Y.push([k,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}U.push([D,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])}else{Y.push([k,/^#[^\r\n]*/,null,"#"])}}if(V.cStyleComments){U.push([k,/^\/\/[^\r\n]*/,null]);U.push([k,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(V.regexLiterals){var aa=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");U.push(["lang-regex",new RegExp("^"+N+"("+aa+")")])}var X=V.types;if(X){U.push([Q,X])}var W=(""+V.keywords).replace(/^ | $/g,"");if(W.length){U.push([A,new RegExp("^(?:"+W.replace(/[\s,]+/g,"|")+")\\b"),null])}Y.push([G,/^\s+/,null," \r\n\t\xA0"]);var Z=/^.[^\s\w\.$@\'\"\`\/\\]*/;U.push([H,/^@[a-z_$][a-z_$@0-9]*/i,null],[Q,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[G,/^[a-z_$][a-z_$@0-9]*/i,null],[H,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[G,/^\\[\s\S]?/,null],[M,Z,null]);return h(Y,U)}var L=i({keywords:B,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function S(W,ah,aa){var V=/(?:^|\s)nocode(?:\s|$)/;var ac=/\r\n?|\n/;var ad=W.ownerDocument;var ag=ad.createElement("li");while(W.firstChild){ag.appendChild(W.firstChild)}var X=[ag];function af(am){switch(am.nodeType){case 1:if(V.test(am.className)){break}if("br"===am.nodeName){ae(am);if(am.parentNode){am.parentNode.removeChild(am)}}else{for(var ao=am.firstChild;ao;ao=ao.nextSibling){af(ao)}}break;case 3:case 4:if(aa){var an=am.nodeValue;var ak=an.match(ac);if(ak){var aj=an.substring(0,ak.index);am.nodeValue=aj;var ai=an.substring(ak.index+ak[0].length);if(ai){var al=am.parentNode;al.insertBefore(ad.createTextNode(ai),am.nextSibling)}ae(am);if(!aj){am.parentNode.removeChild(am)}}}break}}function ae(al){while(!al.nextSibling){al=al.parentNode;if(!al){return}}function aj(am,at){var ar=at?am.cloneNode(false):am;var ap=am.parentNode;if(ap){var aq=aj(ap,1);var ao=am.nextSibling;aq.appendChild(ar);for(var an=ao;an;an=ao){ao=an.nextSibling;aq.appendChild(an)}}return ar}var ai=aj(al.nextSibling,0);for(var ak;(ak=ai.parentNode)&&ak.nodeType===1;){ai=ak}X.push(ai)}for(var Z=0;Z=U){aj+=2}if(Y>=ar){ac+=2}}}finally{if(au){au.style.display=ak}}}var u={};function d(W,X){for(var U=X.length;--U>=0;){var V=X[U];if(!u.hasOwnProperty(V)){u[V]=W}else{if(O.console){console.warn("cannot override language handler %s",V)}}}}function r(V,U){if(!(V&&u.hasOwnProperty(V))){V=/^\s*]*(?:>|$)/],[k,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[M,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);d(h([[G,/^[\s]+/,null," \t\r\n"],[o,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[n,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[M,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);d(h([],[[o,/^[\s\S]+/]]),["uq.val"]);d(i({keywords:m,hashComments:true,cStyleComments:true,types:f}),["c","cc","cpp","cxx","cyc","m"]);d(i({keywords:"null,true,false"}),["json"]);d(i({keywords:T,hashComments:true,cStyleComments:true,verbatimStrings:true,types:f}),["cs"]);d(i({keywords:y,cStyleComments:true}),["java"]);d(i({keywords:I,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);d(i({keywords:J,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);d(i({keywords:t,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);d(i({keywords:g,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);d(i({keywords:x,cStyleComments:true,regexLiterals:true}),["js"]);d(i({keywords:s,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);d(h([],[[D,/^[\s\S]+/]]),["regex"]);function e(X){var W=X.langExtension;try{var U=b(X.sourceNode,X.pre);var V=U.sourceCode;X.sourceCode=V;X.spans=U.spans;X.basePos=0;r(W,V)(X);E(X)}catch(Y){if(O.console){console.log(Y&&Y.stack?Y.stack:Y)}}}function z(Y,X,W){var U=document.createElement("pre");U.innerHTML=Y;if(W){S(U,W,true)}var V={langExtension:X,numberLines:W,sourceNode:U,pre:1};e(V);return U.innerHTML}function c(aj){function ab(al){return document.getElementsByTagName(al)}var ah=[ab("pre"),ab("code"),ab("xmp")];var V=[];for(var ae=0;ae]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); -------------------------------------------------------------------------------- /docs/classes/Helpers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Helpers - RmT 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    18 |
    19 |
    20 | API Docs for: 0.1.0 21 |
    22 |
    23 |
    24 | 25 |
    26 | 51 |
    52 |
    53 |
    54 | Show: 55 | 59 | 60 | 64 | 65 | 69 | 73 | 74 |
    75 | 76 |
    77 |
    78 |
    79 |

    Helpers Class

    80 |
    81 | 82 | 83 |
    84 | Defined in: lib/helpers.js:18 85 |
    86 | 87 | 88 |
    89 | 90 | 91 |
    92 | 93 |
    94 | 95 | 96 |
    97 | 102 | 103 |
    104 |
    105 |

    Item Index

    106 | 107 |
    108 |

    Methods

    109 | 110 |
      111 |
    • 112 | exists 113 | 114 |
    • 115 |
    • 116 | isDir 117 | 118 |
    • 119 |
    • 120 | isFile 121 | 122 |
    • 123 |
    • 124 | read 125 | 126 |
    • 127 |
    • 128 | remove 129 | 130 |
    • 131 |
    • 132 | rm 133 | 134 |
    • 135 |
    • 136 | write 137 | 138 |
    • 139 |
    140 |
    141 | 142 | 143 | 144 |
    145 | 146 |
    147 |

    Methods

    148 | 149 |
    150 |

    exists

    151 | 152 |
    153 | (
      154 |
    • 155 | path 156 |
    • 157 |
    ) 158 |
    159 | 160 | 161 | String 162 | 163 | 164 | 165 | public 166 | 167 | 168 | 169 | 170 | 171 |
    172 |

    173 | Defined in 174 | lib/helpers.js:26 175 |

    176 | 177 | 178 | 179 |
    180 | 181 |
    182 |

    Method responsible for check if path exists

    183 | 184 |
    185 | 186 |
    187 |

    Parameters:

    188 | 189 |
      190 |
    • 191 | path 192 | String 193 | 194 | 195 |
      196 |

      File path of archive

      197 | 198 |
      199 | 200 |
    • 201 |
    202 |
    203 | 204 |
    205 |

    Returns:

    206 | 207 |
    208 | String: 209 |

    Returns true if file exists

    210 | 211 |
    212 |
    213 | 214 | 215 |
    216 |

    Example:

    217 | 218 |
    219 |
    helpers.exists('./rmt');
    220 | 221 |
    222 |
    223 |
    224 |
    225 |

    isDir

    226 | 227 |
    228 | (
      229 |
    • 230 | path 231 |
    • 232 |
    ) 233 |
    234 | 235 | 236 | String 237 | 238 | 239 | 240 | public 241 | 242 | 243 | 244 | 245 | 246 |
    247 |

    248 | Defined in 249 | lib/helpers.js:146 250 |

    251 | 252 | 253 | 254 |
    255 | 256 |
    257 |

    Method responsible for check if path is a directory

    258 | 259 |
    260 | 261 |
    262 |

    Parameters:

    263 | 264 |
      265 |
    • 266 | path 267 | String 268 | 269 | 270 |
      271 |

      File path of archive

      272 | 273 |
      274 | 275 |
    • 276 |
    277 |
    278 | 279 |
    280 |

    Returns:

    281 | 282 |
    283 | String: 284 |

    Returns true if path is directory

    285 | 286 |
    287 |
    288 | 289 | 290 |
    291 |

    Example:

    292 | 293 |
    294 |
    helpers.isDir('./rmt');
    295 | 296 |
    297 |
    298 |
    299 |
    300 |

    isFile

    301 | 302 |
    303 | (
      304 |
    • 305 | path 306 |
    • 307 |
    ) 308 |
    309 | 310 | 311 | String 312 | 313 | 314 | 315 | public 316 | 317 | 318 | 319 | 320 | 321 |
    322 |

    323 | Defined in 324 | lib/helpers.js:128 325 |

    326 | 327 | 328 | 329 |
    330 | 331 |
    332 |

    Method responsible for check if path is a file

    333 | 334 |
    335 | 336 |
    337 |

    Parameters:

    338 | 339 |
      340 |
    • 341 | path 342 | String 343 | 344 | 345 |
      346 |

      File path of archive

      347 | 348 |
      349 | 350 |
    • 351 |
    352 |
    353 | 354 |
    355 |

    Returns:

    356 | 357 |
    358 | String: 359 |

    Returns true if path is file

    360 | 361 |
    362 |
    363 | 364 | 365 |
    366 |

    Example:

    367 | 368 |
    369 |
    helpers.isFile('./rmt');
    370 | 371 |
    372 |
    373 |
    374 |
    375 |

    read

    376 | 377 |
    378 | (
      379 |
    • 380 | fillepath 381 |
    • 382 |
    ) 383 |
    384 | 385 | 386 | String 387 | 388 | 389 | 390 | public 391 | 392 | 393 | 394 | 395 | 396 |
    397 |

    398 | Defined in 399 | lib/helpers.js:43 400 |

    401 | 402 | 403 | 404 |
    405 | 406 |
    407 |

    Method responsible for reading files and get content

    408 | 409 |
    410 | 411 |
    412 |

    Parameters:

    413 | 414 |
      415 |
    • 416 | fillepath 417 | String 418 | 419 | 420 |
      421 |

      File path of archive

      422 | 423 |
      424 | 425 |
    • 426 |
    427 |
    428 | 429 |
    430 |

    Returns:

    431 | 432 |
    433 | String: 434 |

    Returns file content

    435 | 436 |
    437 |
    438 | 439 | 440 |
    441 |

    Example:

    442 | 443 |
    444 |
    helpers.read('./rmt');
    445 | 446 |
    447 |
    448 |
    449 |
    450 |

    remove

    451 | 452 |
    453 | (
      454 |
    • 455 | path 456 |
    • 457 |
    ) 458 |
    459 | 460 | 461 | 462 | public 463 | 464 | 465 | 466 | 467 | 468 |
    469 |

    470 | Defined in 471 | lib/helpers.js:86 472 |

    473 | 474 | 475 | 476 |
    477 | 478 |
    479 |

    Method responsible for demove files

    480 | 481 |
    482 | 483 |
    484 |

    Parameters:

    485 | 486 |
      487 |
    • 488 | path 489 | String 490 | 491 | 492 |
      493 |

      File path of archive

      494 | 495 |
      496 | 497 |
    • 498 |
    499 |
    500 | 501 | 502 | 503 |
    504 |

    Example:

    505 | 506 |
    507 |
    helpers.remove('./rmt');
    508 | 509 |
    510 |
    511 |
    512 |
    513 |

    rm

    514 | 515 |
    516 | (
      517 |
    • 518 | path 519 |
    • 520 |
    ) 521 |
    522 | 523 | 524 | 525 | public 526 | 527 | 528 | 529 | 530 | 531 |
    532 |

    533 | Defined in 534 | lib/helpers.js:102 535 |

    536 | 537 | 538 | 539 |
    540 | 541 |
    542 |

    Method responsible for demove directories

    543 | 544 |
    545 | 546 |
    547 |

    Parameters:

    548 | 549 |
      550 |
    • 551 | path 552 | String 553 | 554 | 555 |
      556 |

      File path of directory

      557 | 558 |
      559 | 560 |
    • 561 |
    562 |
    563 | 564 | 565 | 566 |
    567 |

    Example:

    568 | 569 |
    570 |
    helpers.rm('./rmt');
    571 | 572 |
    573 |
    574 |
    575 |
    576 |

    write

    577 | 578 |
    579 | (
      580 |
    • 581 | fillePath 582 |
    • 583 |
    • 584 | data 585 |
    • 586 |
    ) 587 |
    588 | 589 | 590 | 591 | public 592 | 593 | 594 | 595 | 596 | 597 |
    598 |

    599 | Defined in 600 | lib/helpers.js:61 601 |

    602 | 603 | 604 | 605 |
    606 | 607 |
    608 |

    Method responsible for writing files

    609 | 610 |
    611 | 612 |
    613 |

    Parameters:

    614 | 615 |
      616 |
    • 617 | fillePath 618 | String 619 | 620 | 621 |
      622 |

      File path of archive

      623 | 624 |
      625 | 626 |
    • 627 |
    • 628 | data 629 | String 630 | 631 | 632 |
      633 |

      Data of file

      634 | 635 |
      636 | 637 |
    • 638 |
    639 |
    640 | 641 | 642 | 643 |
    644 |

    Example:

    645 | 646 |
    647 |
    helpers.write('./rmt', 'string data');
    648 | 649 |
    650 |
    651 |
    652 |
    653 | 654 | 655 | 656 |
    657 |
    658 |
    659 |
    660 |
    661 |
    662 |
    663 |
    664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | -------------------------------------------------------------------------------- /docs/classes/RmT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RmT - RmT 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    18 |
    19 |
    20 | API Docs for: 0.1.0 21 |
    22 |
    23 |
    24 | 25 |
    26 | 51 |
    52 |
    53 |
    54 | Show: 55 | 59 | 60 | 64 | 65 | 69 | 73 | 74 |
    75 | 76 |
    77 |
    78 |
    79 |

    RmT Class

    80 |
    81 | 82 | 83 |
    84 | Defined in: lib/rmt.js:28 85 |
    86 | 87 | 88 |
    89 | 90 | 91 |
    92 | 93 |
    94 | 95 |
    96 |

    Constructor

    97 |
    98 |

    RmT

    99 | 100 |
    101 | (
      102 |
    • 103 | consumerKey 104 |
    • 105 |
    • 106 | consumerSecret 107 |
    • 108 |
    ) 109 |
    110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 |
    119 |

    120 | Defined in 121 | lib/rmt.js:28 122 |

    123 | 124 | 125 | 126 |
    127 | 128 |
    129 | 130 |
    131 | 132 |
    133 |

    Parameters:

    134 | 135 |
      136 |
    • 137 | consumerKey 138 | String 139 | 140 | 141 |
      142 |

      The twitter consumer key

      143 | 144 |
      145 | 146 |
    • 147 |
    • 148 | consumerSecret 149 | String 150 | 151 | 152 |
      153 |

      The twitter consumer secret

      154 | 155 |
      156 | 157 |
    • 158 |
    159 |
    160 | 161 | 162 | 163 |
    164 |

    Example:

    165 | 166 |
    167 |
    var api = new RmT('consumerKey', 'consumerSecret');
    168 | 169 |
    170 |
    171 |
    172 |
    173 | 174 |
    175 | 180 | 181 |
    182 |
    183 |

    Item Index

    184 | 185 |
    186 |

    Methods

    187 | 188 | 222 |
    223 | 224 | 225 | 226 |
    227 | 228 |
    229 |

    Methods

    230 | 231 |
    232 |

    createClient

    233 | 234 |
    235 | (
      236 |
    • 237 | accessTokenKey 238 |
    • 239 |
    • 240 | accessTokenSecret 241 |
    • 242 |
    ) 243 |
    244 | 245 | 246 | 247 | public 248 | 249 | 250 | 251 | 252 | 253 |
    254 |

    255 | Defined in 256 | lib/rmt.js:75 257 |

    258 | 259 | 260 | 261 |
    262 | 263 |
    264 |

    Method responsible for create twitter client instance

    265 | 266 |
    267 | 268 |
    269 |

    Parameters:

    270 | 271 |
      272 |
    • 273 | accessTokenKey 274 | String 275 | 276 | 277 |
      278 |

      The twitter access token key

      279 | 280 |
      281 | 282 |
    • 283 |
    • 284 | accessTokenSecret 285 | String 286 | 287 | 288 |
      289 |

      The twitter access token secret

      290 | 291 |
      292 | 293 |
    • 294 |
    295 |
    296 | 297 | 298 | 299 |
    300 |

    Example:

    301 | 302 |
    303 |
    api.createClient('accessTokenKey', 'accessTokenSecret');
    304 | 305 |
    306 |
    307 |
    308 |
    309 |

    login

    310 | 311 |
    312 | (
      313 |
    • 314 | cb 315 |
    • 316 |
    ) 317 |
    318 | 319 | 320 | 321 | public 322 | 323 | 324 | 325 | 326 | 327 |
    328 |

    329 | Defined in 330 | lib/rmt.js:128 331 |

    332 | 333 | 334 | 335 |
    336 | 337 |
    338 |

    Method responsible for login

    339 | 340 |
    341 | 342 |
    343 |

    Parameters:

    344 | 345 |
      346 |
    • 347 | cb 348 | Function 349 | 350 | 351 |
      352 |

      A callback with error and api response

      353 | 354 |
      355 | 356 |
    • 357 |
    358 |
    359 | 360 | 361 | 362 |
    363 |

    Example:

    364 | 365 |
    366 |
    api.login(function(err, data) {
    367 |      console.log(data);
    368 | });
    369 | 370 |
    371 |
    372 |
    373 |
    374 |

    logout

    375 | 376 |
    377 | (
      378 |
    • 379 | cb 380 |
    • 381 |
    ) 382 |
    383 | 384 | 385 | 386 | public 387 | 388 | 389 | 390 | 391 | 392 |
    393 |

    394 | Defined in 395 | lib/rmt.js:180 396 |

    397 | 398 | 399 | 400 |
    401 | 402 |
    403 |

    Method responsible for remove twitter credentials

    404 | 405 |
    406 | 407 |
    408 |

    Parameters:

    409 | 410 |
      411 |
    • 412 | cb 413 | Function 414 | 415 | 416 |
      417 |

      A callback with error and api response

      418 | 419 |
      420 | 421 |
    • 422 |
    423 |
    424 | 425 | 426 | 427 |
    428 |

    Example:

    429 | 430 |
    431 |
    api.logout(function(err, message) {
    432 |      console.log(message);
    433 | });
    434 | 435 |
    436 |
    437 |
    438 |
    439 |

    profile

    440 | 441 |
    442 | (
      443 |
    • 444 | cb 445 |
    • 446 |
    ) 447 |
    448 | 449 | 450 | 451 | public 452 | 453 | 454 | 455 | 456 | 457 |
    458 |

    459 | Defined in 460 | lib/rmt.js:205 461 |

    462 | 463 | 464 | 465 |
    466 | 467 |
    468 |

    Method responsible for showing the user profile

    469 | 470 |
    471 | 472 |
    473 |

    Parameters:

    474 | 475 |
      476 |
    • 477 | cb 478 | Function 479 | 480 | 481 |
      482 |

      A callback with error and api response

      483 | 484 |
      485 | 486 |
    • 487 |
    488 |
    489 | 490 | 491 | 492 |
    493 |

    Example:

    494 | 495 |
    496 |
    api.profile();
    497 | 498 |
    499 |
    500 |
    501 |
    502 |

    prompt

    503 | 504 |
    505 | (
      506 |
    • 507 | prompts 508 |
    • 509 |
    • 510 | cb 511 |
    • 512 |
    ) 513 |
    514 | 515 | 516 | 517 | public 518 | 519 | 520 | 521 | 522 | 523 |
    524 |

    525 | Defined in 526 | lib/rmt.js:56 527 |

    528 | 529 | 530 | 531 |
    532 | 533 |
    534 |

    Method responsible for asking questions

    535 | 536 |
    537 | 538 |
    539 |

    Parameters:

    540 | 541 |
      542 |
    • 543 | prompts 544 | Object 545 | 546 | 547 |
      548 |

      Array of prompt options

      549 | 550 |
      551 | 552 |
    • 553 |
    • 554 | cb 555 | Function 556 | 557 | 558 |
      559 |

      A callback

      560 | 561 |
      562 | 563 |
    • 564 |
    565 |
    566 | 567 | 568 | 569 |
    570 |

    Example:

    571 | 572 |
    573 |
    api.prompt(prompts, cb);
    574 | 575 |
    576 |
    577 |
    578 |
    579 |

    remove

    580 | 581 |
    582 | (
      583 |
    • 584 | removeAll 585 |
    • 586 |
    • 587 | cb 588 |
    • 589 |
    ) 590 |
    591 | 592 | 593 | 594 | public 595 | 596 | 597 | 598 | 599 | 600 |
    601 |

    602 | Defined in 603 | lib/rmt.js:273 604 |

    605 | 606 | 607 | 608 |
    609 | 610 |
    611 |

    Method responsible for delete all tweets

    612 | 613 |
    614 | 615 |
    616 |

    Parameters:

    617 | 618 |
      619 |
    • 620 | removeAll 621 | Boolean 622 | 623 | 624 |
      625 |

      A boolean to enable to remove all tweets

      626 | 627 |
      628 | 629 |
    • 630 |
    • 631 | cb 632 | Function 633 | 634 | 635 |
      636 |

      A callback with error and api response

      637 | 638 |
      639 | 640 |
    • 641 |
    642 |
    643 | 644 | 645 | 646 |
    647 |

    Example:

    648 | 649 |
    650 |
    api.remove();
    651 | 652 |
    653 |
    654 |
    655 |
    656 |

    setConfig

    657 | 658 |
    659 | (
      660 |
    • 661 | consumerKey 662 |
    • 663 |
    • 664 | consumerSecret 665 |
    • 666 |
    • 667 | cb 668 |
    • 669 |
    ) 670 |
    671 | 672 | 673 | 674 | public 675 | 676 | 677 | 678 | 679 | 680 |
    681 |

    682 | Defined in 683 | lib/rmt.js:97 684 |

    685 | 686 | 687 | 688 |
    689 | 690 |
    691 |

    Method responsible for save consumer credentials

    692 | 693 |
    694 | 695 |
    696 |

    Parameters:

    697 | 698 |
      699 |
    • 700 | consumerKey 701 | String 702 | 703 | 704 |
      705 |

      The twitter consumer key

      706 | 707 |
      708 | 709 |
    • 710 |
    • 711 | consumerSecret 712 | String 713 | 714 | 715 |
      716 |

      The twitter consumer secret

      717 | 718 |
      719 | 720 |
    • 721 |
    • 722 | cb 723 | Function 724 | 725 | 726 |
      727 |

      A callback with error and api response

      728 | 729 |
      730 | 731 |
    • 732 |
    733 |
    734 | 735 | 736 | 737 |
    738 |

    Example:

    739 | 740 |
    741 |
    api.setConfig('consumerKey', 'consumerSecret', function(err, data) {
    742 |      console.log(data);
    743 | });
    744 | 745 |
    746 |
    747 |
    748 |
    749 |

    show

    750 | 751 |
    752 | (
      753 |
    • 754 | limit 755 |
    • 756 |
    • 757 | cb 758 |
    • 759 |
    ) 760 |
    761 | 762 | 763 | 764 | public 765 | 766 | 767 | 768 | 769 | 770 |
    771 |

    772 | Defined in 773 | lib/rmt.js:238 774 |

    775 | 776 | 777 | 778 |
    779 | 780 |
    781 |

    Method responsible for show your all tweets

    782 | 783 |
    784 | 785 |
    786 |

    Parameters:

    787 | 788 |
      789 |
    • 790 | limit 791 | Number 792 | 793 | 794 |
      795 |

      A number to limit the number of tweets returned

      796 | 797 |
      798 | 799 |
    • 800 |
    • 801 | cb 802 | Function 803 | 804 | 805 |
      806 |

      A callback with error and api response

      807 | 808 |
      809 | 810 |
    • 811 |
    812 |
    813 | 814 | 815 | 816 |
    817 |

    Example:

    818 | 819 |
    820 |
    api.show();
    821 | 822 |
    823 |
    824 |
    825 |
    826 | 827 | 828 | 829 |
    830 |
    831 |
    832 |
    833 |
    834 |
    835 |
    836 |
    837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | -------------------------------------------------------------------------------- /docs/classes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirector 5 | 6 | 7 | 8 | Click here to redirect 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": { 3 | "name": "RmT", 4 | "description": "RmT: A CLI tool to remove all your tweets at once", 5 | "version": "0.1.0", 6 | "url": "https://github.com/chrisenytc/rmt" 7 | }, 8 | "files": { 9 | "lib/helpers.js": { 10 | "name": "lib/helpers.js", 11 | "modules": {}, 12 | "classes": { 13 | "Helpers": 1 14 | }, 15 | "fors": {}, 16 | "namespaces": {} 17 | }, 18 | "lib/rmt.js": { 19 | "name": "lib/rmt.js", 20 | "modules": {}, 21 | "classes": { 22 | "RmT": 1 23 | }, 24 | "fors": {}, 25 | "namespaces": {} 26 | } 27 | }, 28 | "modules": {}, 29 | "classes": { 30 | "Helpers": { 31 | "name": "Helpers", 32 | "shortname": "Helpers", 33 | "classitems": [], 34 | "plugins": [], 35 | "extensions": [], 36 | "plugin_for": [], 37 | "extension_for": [], 38 | "file": "lib/helpers.js", 39 | "line": 18 40 | }, 41 | "RmT": { 42 | "name": "RmT", 43 | "shortname": "RmT", 44 | "classitems": [], 45 | "plugins": [], 46 | "extensions": [], 47 | "plugin_for": [], 48 | "extension_for": [], 49 | "file": "lib/rmt.js", 50 | "line": 28, 51 | "is_constructor": 1, 52 | "example": [ 53 | "\n\n var api = new RmT('consumerKey', 'consumerSecret');" 54 | ], 55 | "params": [ 56 | { 57 | "name": "consumerKey", 58 | "description": "The twitter consumer key", 59 | "type": "String" 60 | }, 61 | { 62 | "name": "consumerSecret", 63 | "description": "The twitter consumer secret", 64 | "type": "String" 65 | } 66 | ] 67 | } 68 | }, 69 | "classitems": [ 70 | { 71 | "file": "lib/helpers.js", 72 | "line": 26, 73 | "description": "Method responsible for check if path exists", 74 | "example": [ 75 | "\n\n helpers.exists('./rmt');" 76 | ], 77 | "itemtype": "method", 78 | "name": "exists", 79 | "access": "public", 80 | "tagname": "", 81 | "params": [ 82 | { 83 | "name": "path", 84 | "description": "File path of archive", 85 | "type": "String" 86 | } 87 | ], 88 | "return": { 89 | "description": "Returns true if file exists", 90 | "type": "String" 91 | }, 92 | "class": "Helpers" 93 | }, 94 | { 95 | "file": "lib/helpers.js", 96 | "line": 43, 97 | "description": "Method responsible for reading files and get content", 98 | "example": [ 99 | "\n\n helpers.read('./rmt');" 100 | ], 101 | "itemtype": "method", 102 | "name": "read", 103 | "access": "public", 104 | "tagname": "", 105 | "params": [ 106 | { 107 | "name": "fillepath", 108 | "description": "File path of archive", 109 | "type": "String" 110 | } 111 | ], 112 | "return": { 113 | "description": "Returns file content", 114 | "type": "String" 115 | }, 116 | "class": "Helpers" 117 | }, 118 | { 119 | "file": "lib/helpers.js", 120 | "line": 61, 121 | "description": "Method responsible for writing files", 122 | "example": [ 123 | "\n\n helpers.write('./rmt', 'string data');" 124 | ], 125 | "itemtype": "method", 126 | "name": "write", 127 | "access": "public", 128 | "tagname": "", 129 | "params": [ 130 | { 131 | "name": "fillePath", 132 | "description": "File path of archive", 133 | "type": "String" 134 | }, 135 | { 136 | "name": "data", 137 | "description": "Data of file", 138 | "type": "String" 139 | } 140 | ], 141 | "class": "Helpers" 142 | }, 143 | { 144 | "file": "lib/helpers.js", 145 | "line": 86, 146 | "description": "Method responsible for demove files", 147 | "example": [ 148 | "\n\n helpers.remove('./rmt');" 149 | ], 150 | "itemtype": "method", 151 | "name": "remove", 152 | "access": "public", 153 | "tagname": "", 154 | "params": [ 155 | { 156 | "name": "path", 157 | "description": "File path of archive", 158 | "type": "String" 159 | } 160 | ], 161 | "class": "Helpers" 162 | }, 163 | { 164 | "file": "lib/helpers.js", 165 | "line": 102, 166 | "description": "Method responsible for demove directories", 167 | "example": [ 168 | "\n\n helpers.rm('./rmt');" 169 | ], 170 | "itemtype": "method", 171 | "name": "rm", 172 | "access": "public", 173 | "tagname": "", 174 | "params": [ 175 | { 176 | "name": "path", 177 | "description": "File path of directory", 178 | "type": "String" 179 | } 180 | ], 181 | "class": "Helpers" 182 | }, 183 | { 184 | "file": "lib/helpers.js", 185 | "line": 128, 186 | "description": "Method responsible for check if path is a file", 187 | "example": [ 188 | "\n\n helpers.isFile('./rmt');" 189 | ], 190 | "itemtype": "method", 191 | "name": "isFile", 192 | "access": "public", 193 | "tagname": "", 194 | "params": [ 195 | { 196 | "name": "path", 197 | "description": "File path of archive", 198 | "type": "String" 199 | } 200 | ], 201 | "return": { 202 | "description": "Returns true if path is file", 203 | "type": "String" 204 | }, 205 | "class": "Helpers" 206 | }, 207 | { 208 | "file": "lib/helpers.js", 209 | "line": 146, 210 | "description": "Method responsible for check if path is a directory", 211 | "example": [ 212 | "\n\n helpers.isDir('./rmt');" 213 | ], 214 | "itemtype": "method", 215 | "name": "isDir", 216 | "access": "public", 217 | "tagname": "", 218 | "params": [ 219 | { 220 | "name": "path", 221 | "description": "File path of archive", 222 | "type": "String" 223 | } 224 | ], 225 | "return": { 226 | "description": "Returns true if path is directory", 227 | "type": "String" 228 | }, 229 | "class": "Helpers" 230 | }, 231 | { 232 | "file": "lib/rmt.js", 233 | "line": 11, 234 | "description": "Module Dependencies", 235 | "class": "RmT" 236 | }, 237 | { 238 | "file": "lib/rmt.js", 239 | "line": 56, 240 | "description": "Method responsible for asking questions", 241 | "example": [ 242 | "\n\n api.prompt(prompts, cb);" 243 | ], 244 | "itemtype": "method", 245 | "name": "prompt", 246 | "access": "public", 247 | "tagname": "", 248 | "params": [ 249 | { 250 | "name": "prompts", 251 | "description": "Array of prompt options", 252 | "type": "Object" 253 | }, 254 | { 255 | "name": "cb", 256 | "description": "A callback", 257 | "type": "Function" 258 | } 259 | ], 260 | "class": "RmT" 261 | }, 262 | { 263 | "file": "lib/rmt.js", 264 | "line": 75, 265 | "description": "Method responsible for create twitter client instance", 266 | "example": [ 267 | "\n\n api.createClient('accessTokenKey', 'accessTokenSecret');" 268 | ], 269 | "itemtype": "method", 270 | "name": "createClient", 271 | "access": "public", 272 | "tagname": "", 273 | "params": [ 274 | { 275 | "name": "accessTokenKey", 276 | "description": "The twitter access token key", 277 | "type": "String" 278 | }, 279 | { 280 | "name": "accessTokenSecret", 281 | "description": "The twitter access token secret", 282 | "type": "String" 283 | } 284 | ], 285 | "class": "RmT" 286 | }, 287 | { 288 | "file": "lib/rmt.js", 289 | "line": 97, 290 | "description": "Method responsible for save consumer credentials", 291 | "example": [ 292 | "\n\n api.setConfig('consumerKey', 'consumerSecret', function(err, data) {\n console.log(data);\n });" 293 | ], 294 | "itemtype": "method", 295 | "name": "setConfig", 296 | "access": "public", 297 | "tagname": "", 298 | "params": [ 299 | { 300 | "name": "consumerKey", 301 | "description": "The twitter consumer key", 302 | "type": "String" 303 | }, 304 | { 305 | "name": "consumerSecret", 306 | "description": "The twitter consumer secret", 307 | "type": "String" 308 | }, 309 | { 310 | "name": "cb", 311 | "description": "A callback with error and api response", 312 | "type": "Function" 313 | } 314 | ], 315 | "class": "RmT" 316 | }, 317 | { 318 | "file": "lib/rmt.js", 319 | "line": 128, 320 | "description": "Method responsible for login", 321 | "example": [ 322 | "\n\n api.login(function(err, data) {\n console.log(data);\n });" 323 | ], 324 | "itemtype": "method", 325 | "name": "login", 326 | "access": "public", 327 | "tagname": "", 328 | "params": [ 329 | { 330 | "name": "cb", 331 | "description": "A callback with error and api response", 332 | "type": "Function" 333 | } 334 | ], 335 | "class": "RmT" 336 | }, 337 | { 338 | "file": "lib/rmt.js", 339 | "line": 180, 340 | "description": "Method responsible for remove twitter credentials", 341 | "example": [ 342 | "\n\n api.logout(function(err, message) {\n console.log(message);\n });" 343 | ], 344 | "itemtype": "method", 345 | "name": "logout", 346 | "access": "public", 347 | "tagname": "", 348 | "params": [ 349 | { 350 | "name": "cb", 351 | "description": "A callback with error and api response", 352 | "type": "Function" 353 | } 354 | ], 355 | "class": "RmT" 356 | }, 357 | { 358 | "file": "lib/rmt.js", 359 | "line": 205, 360 | "description": "Method responsible for showing the user profile", 361 | "example": [ 362 | "\n\n api.profile();" 363 | ], 364 | "itemtype": "method", 365 | "name": "profile", 366 | "access": "public", 367 | "tagname": "", 368 | "params": [ 369 | { 370 | "name": "cb", 371 | "description": "A callback with error and api response", 372 | "type": "Function" 373 | } 374 | ], 375 | "class": "RmT" 376 | }, 377 | { 378 | "file": "lib/rmt.js", 379 | "line": 238, 380 | "description": "Method responsible for show your all tweets", 381 | "example": [ 382 | "\n\n api.show();" 383 | ], 384 | "itemtype": "method", 385 | "name": "show", 386 | "access": "public", 387 | "tagname": "", 388 | "params": [ 389 | { 390 | "name": "limit", 391 | "description": "A number to limit the number of tweets returned", 392 | "type": "Number" 393 | }, 394 | { 395 | "name": "cb", 396 | "description": "A callback with error and api response", 397 | "type": "Function" 398 | } 399 | ], 400 | "class": "RmT" 401 | }, 402 | { 403 | "file": "lib/rmt.js", 404 | "line": 273, 405 | "description": "Method responsible for delete all tweets", 406 | "example": [ 407 | "\n\n api.remove();" 408 | ], 409 | "itemtype": "method", 410 | "name": "remove", 411 | "access": "public", 412 | "tagname": "", 413 | "params": [ 414 | { 415 | "name": "removeAll", 416 | "description": "A boolean to enable to remove all tweets", 417 | "type": "Boolean" 418 | }, 419 | { 420 | "name": "cb", 421 | "description": "A callback with error and api response", 422 | "type": "Function" 423 | } 424 | ], 425 | "class": "RmT" 426 | } 427 | ], 428 | "warnings": [ 429 | { 430 | "message": "Missing item type\nModule Dependencies", 431 | "line": " lib/rmt.js:11" 432 | } 433 | ] 434 | } -------------------------------------------------------------------------------- /docs/files/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirector 5 | 6 | 7 | 8 | Click here to redirect 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/files/lib_helpers.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | lib/helpers.js - RmT 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    18 |
    19 |
    20 | API Docs for: 0.1.0 21 |
    22 |
    23 |
    24 | 25 |
    26 | 51 |
    52 |
    53 |
    54 | Show: 55 | 59 | 60 | 64 | 65 | 69 | 73 | 74 |
    75 | 76 |
    77 |
    78 |
    79 |

    File: lib/helpers.js

    80 | 81 |
    82 |
     83 | /*
     84 |  * rmt
     85 |  * https://github.com/chrisenytc/rmt
     86 |  *
     87 |  * Copyright (c) 2015, Christopher EnyTC
     88 |  * Licensed under the MIT license.
     89 |  */
     90 | 
     91 | 'use strict';
     92 | 
     93 | /*
     94 |  * Module Dependencies
     95 |  */
     96 | 
     97 | var fs = require('fs'),
     98 |     _ = require('underscore');
     99 | 
    100 | /**
    101 | @class Helpers
    102 |  */
    103 | 
    104 | /*
    105 |  * Public Methods
    106 |  */
    107 | 
    108 | /**
    109 |  * Method responsible for check if path exists
    110 |  *
    111 |  * @example
    112 |  *
    113 |  *     helpers.exists('./rmt');
    114 |  *
    115 |  * @method exists
    116 |  * @public
    117 |  * @param {String} path File path of archive
    118 |  * @return {String} Returns true if file exists
    119 |  */
    120 | 
    121 | exports.exists = function exists(path) {
    122 |     return fs.existsSync(path);
    123 | };
    124 | 
    125 | /**
    126 |  * Method responsible for reading files and get content
    127 |  *
    128 |  * @example
    129 |  *
    130 |  *     helpers.read('./rmt');
    131 |  *
    132 |  * @method read
    133 |  * @public
    134 |  * @param {String} fillepath File path of archive
    135 |  * @return {String} Returns file content
    136 |  */
    137 | 
    138 | exports.read = function readFile(filepath) {
    139 |     //Read and return this file content
    140 |     return fs.readFileSync(filepath, 'utf-8');
    141 | };
    142 | 
    143 | /**
    144 |  * Method responsible for writing files
    145 |  *
    146 |  * @example
    147 |  *
    148 |  *     helpers.write('./rmt', 'string data');
    149 |  *
    150 |  * @method write
    151 |  * @public
    152 |  * @param {String} fillePath File path of archive
    153 |  * @param {String} data Data of file
    154 |  */
    155 | 
    156 | exports.write = function writeFile(filePath, data) {
    157 |     //Read and return this file content
    158 |     if (exports.exists(filePath)) {
    159 |         var objData = require(filePath);
    160 |         _.extend(objData, data);
    161 |         //Write
    162 |         fs.writeFileSync(filePath, JSON.stringify(objData, null, 4));
    163 |     } else {
    164 |         fs.writeFileSync(filePath, JSON.stringify(data, null, 4));
    165 |     }
    166 | };
    167 | 
    168 | /**
    169 |  * Method responsible for demove files
    170 |  *
    171 |  * @example
    172 |  *
    173 |  *     helpers.remove('./rmt');
    174 |  *
    175 |  * @method remove
    176 |  * @public
    177 |  * @param {String} path File path of archive
    178 |  */
    179 | 
    180 | exports.remove = function remove(path) {
    181 |     fs.unlinkSync(path);
    182 | };
    183 | 
    184 | /**
    185 |  * Method responsible for demove directories
    186 |  *
    187 |  * @example
    188 |  *
    189 |  *     helpers.rm('./rmt');
    190 |  *
    191 |  * @method rm
    192 |  * @public
    193 |  * @param {String} path File path of directory
    194 |  */
    195 | 
    196 | exports.rm = function rm(path) {
    197 |     if (fs.existsSync(path)) {
    198 |         fs.readdirSync(path).forEach(function(file) {
    199 |             var curPath = path + '/' + file;
    200 |             if (fs.statSync(curPath).isDirectory()) { // recurse
    201 |                 exports.rm(curPath);
    202 |             } else { // delete file
    203 |                 fs.unlinkSync(curPath);
    204 |             }
    205 |         });
    206 |         fs.rmdirSync(path);
    207 |     }
    208 | };
    209 | 
    210 | /**
    211 |  * Method responsible for check if path is a file
    212 |  *
    213 |  * @example
    214 |  *
    215 |  *     helpers.isFile('./rmt');
    216 |  *
    217 |  * @method isFile
    218 |  * @public
    219 |  * @param {String} path File path of archive
    220 |  * @return {String} Returns true if path is file
    221 |  */
    222 | 
    223 | exports.isFile = function isFile(path) {
    224 |     var f = fs.stat(path);
    225 |     return f.isFile();
    226 | };
    227 | 
    228 | /**
    229 |  * Method responsible for check if path is a directory
    230 |  *
    231 |  * @example
    232 |  *
    233 |  *     helpers.isDir('./rmt');
    234 |  *
    235 |  * @method isDir
    236 |  * @public
    237 |  * @param {String} path File path of archive
    238 |  * @return {String} Returns true if path is directory
    239 |  */
    240 | 
    241 | exports.isDir = function isDir(path) {
    242 |     var f = fs.stat(path);
    243 |     return f.isDirectory();
    244 | };
    245 | 
    246 |     
    247 |
    248 |
    249 |
    250 |
    251 |
    252 |
    253 |
    254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | -------------------------------------------------------------------------------- /docs/files/lib_rmt.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | lib/rmt.js - RmT 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    18 |
    19 |
    20 | API Docs for: 0.1.0 21 |
    22 |
    23 |
    24 | 25 |
    26 | 51 |
    52 |
    53 |
    54 | Show: 55 | 59 | 60 | 64 | 65 | 69 | 73 | 74 |
    75 | 76 |
    77 |
    78 |
    79 |

    File: lib/rmt.js

    80 | 81 |
    82 |
     83 | /*
     84 |  * rmt
     85 |  * https://github.com/chrisenytc/rmt
     86 |  *
     87 |  * Copyright (c) 2015, Christopher EnyTC
     88 |  * Licensed under the MIT license.
     89 |  */
     90 | 
     91 | 'use strict';
     92 | 
     93 | /**
     94 |  * Module Dependencies
     95 |  */
     96 | 
     97 | var inquirer = require('inquirer'),
     98 |     Twitter = require('twitter'),
     99 |     TwitterPinAuth = require('twitter-pin-auth'),
    100 |     P = require('bluebird'),
    101 |     _ = require('underscore'),
    102 |     async = require('async'),
    103 |     open = require('open'),
    104 |     join = require('path').join,
    105 |     debug = require('./debugger.js'),
    106 |     h = require('./helpers.js');
    107 | 
    108 | require('colors');
    109 | 
    110 | /**
    111 |  * @class RmT
    112 |  *
    113 |  * @constructor
    114 |  *
    115 |  * Constructor responsible for provide twitter authorization
    116 |  *
    117 |  * @example
    118 |  *
    119 |  *     var api = new RmT('consumerKey', 'consumerSecret');
    120 |  *
    121 |  * @param {String} consumerKey The twitter consumer key
    122 |  * @param {String} consumerSecret The twitter consumer secret
    123 |  */
    124 | 
    125 | var RmT = module.exports = function RmT(consumerKey, consumerSecret) {
    126 |     this.consumerKey = consumerKey;
    127 |     this.consumerSecret = consumerSecret;
    128 |     this.accessTokenKey = '';
    129 |     this.accessTokenSecret = '';
    130 |     this.tpa = new TwitterPinAuth(this.consumerKey, this.consumerSecret);
    131 |     this.client = null;
    132 | };
    133 | 
    134 | /*
    135 |  * Public Methods
    136 |  */
    137 | 
    138 | /**
    139 |  * Method responsible for asking questions
    140 |  *
    141 |  * @example
    142 |  *
    143 |  *     api.prompt(prompts, cb);
    144 |  *
    145 |  * @method prompt
    146 |  * @public
    147 |  * @param {Object} prompts Array of prompt options
    148 |  * @param {Function} cb A callback
    149 |  */
    150 | 
    151 | RmT.prototype.prompt = function prompt(prompts, cb) {
    152 |     inquirer.prompt(prompts, function(answers) {
    153 |         cb(answers);
    154 |     });
    155 | };
    156 | 
    157 | /**
    158 |  * Method responsible for create twitter client instance
    159 |  *
    160 |  * @example
    161 |  *
    162 |  *     api.createClient('accessTokenKey', 'accessTokenSecret');
    163 |  *
    164 |  * @method createClient
    165 |  * @public
    166 |  * @param {String} accessTokenKey The twitter access token key
    167 |  * @param {String} accessTokenSecret The twitter access token secret
    168 |  */
    169 | 
    170 | RmT.prototype.createClient = function createClient(accessTokenKey, accessTokenSecret) {
    171 |     this.client = new Twitter({
    172 |         consumer_key: this.consumerKey,
    173 |         consumer_secret: this.consumerSecret,
    174 |         access_token_key: accessTokenKey,
    175 |         access_token_secret: accessTokenSecret
    176 |     });
    177 | };
    178 | 
    179 | /**
    180 |  * Method responsible for save consumer credentials
    181 |  *
    182 |  * @example
    183 |  *
    184 |  *     api.setConfig('consumerKey', 'consumerSecret', function(err, data) {
    185 |  *          console.log(data);
    186 |  *     });
    187 |  *
    188 |  * @method setConfig
    189 |  * @public
    190 |  * @param {String} consumerKey The twitter consumer key
    191 |  * @param {String} consumerSecret The twitter consumer secret
    192 |  * @param {Function} cb A callback with error and api response
    193 |  */
    194 | 
    195 | RmT.prototype.setConfig = function setConfig(consumerKey, consumerSecret, cb) {
    196 |     return new P(function(resolve, reject) {
    197 |         //Write config
    198 |         if (consumerKey && consumerKey !== '' && consumerSecret && consumerSecret !== '') {
    199 |             h.write(join(__dirname, 'rmtConfig.json'), {
    200 |                 consumerKey: consumerKey,
    201 |                 consumerSecret: consumerSecret
    202 |             });
    203 |             resolve('Settings updated successfully!');
    204 |         } else {
    205 |             reject(new Error('Setup failed. Try again!'));
    206 |         }
    207 |     }).nodeify(cb);
    208 | };
    209 | 
    210 | /**
    211 |  * Method responsible for login
    212 |  *
    213 |  * @example
    214 |  *
    215 |  *     api.login(function(err, data) {
    216 |  *          console.log(data);
    217 |  *     });
    218 |  *
    219 |  * @method login
    220 |  * @public
    221 |  * @param {Function} cb A callback with error and api response
    222 |  */
    223 | 
    224 | RmT.prototype.login = function login(cb) {
    225 |     var that = this;
    226 |     return new P(function(resolve, reject) {
    227 |         //Get authUrl
    228 |         that.tpa.requestAuthUrl()
    229 |             .then(function(url) {
    230 |                 debug('In your browser, on the opened window by RmT, log in to your twitter account, click on "Authorize" button and enter the PIN number below.', 'info');
    231 |                 console.log();
    232 |                 //Open authorize url
    233 |                 open(url);
    234 |                 //Ask
    235 |                 that.prompt([{
    236 |                     type: 'input',
    237 |                     name: 'pin',
    238 |                     message: 'Enter the pin number: '
    239 |                 }], function(answers) {
    240 |                     that.tpa.authorize(answers.pin)
    241 |                         .then(function(data) {
    242 |                             //Write config
    243 |                             if (data.accessTokenKey && data.accessTokenKey !== '' && data.accessTokenSecret && data.accessTokenSecret !== '') {
    244 |                                 h.write(join(__dirname, 'rmtConfig.json'), {
    245 |                                     accessTokenKey: data.accessTokenKey,
    246 |                                     accessTokenSecret: data.accessTokenSecret
    247 |                                 });
    248 |                                 resolve('Logged successfully!');
    249 |                             } else {
    250 |                                 reject(new Error('Login failed. Try again!'));
    251 |                             }
    252 |                         }).catch(function(err) {
    253 |                             reject(err);
    254 |                         });
    255 |                 });
    256 |             }).catch(function(err) {
    257 |                 reject(err);
    258 |             });
    259 |     }).nodeify(cb);
    260 | };
    261 | 
    262 | /**
    263 |  * Method responsible for remove twitter credentials
    264 |  *
    265 |  * @example
    266 |  *
    267 |  *     api.logout(function(err, message) {
    268 |  *          console.log(message);
    269 |  *     });
    270 |  *
    271 |  * @method logout
    272 |  * @public
    273 |  * @param {Function} cb A callback with error and api response
    274 |  */
    275 | 
    276 | RmT.prototype.logout = function logout(cb) {
    277 |     return new P(function(resolve) {
    278 |         //Write config
    279 |         h.write(join(__dirname, 'rmtConfig.json'), {
    280 |             accessTokenKey: '',
    281 |             accessTokenSecret: ''
    282 |         });
    283 |         resolve('Your twitter credentials has been removed successfully!');
    284 |     }).nodeify(cb);
    285 | };
    286 | 
    287 | /**
    288 |  * Method responsible for showing the user profile
    289 |  *
    290 |  * @example
    291 |  *
    292 |  *     api.profile();
    293 |  *
    294 |  * @method profile
    295 |  * @public
    296 |  * @param {Function} cb A callback with error and api response
    297 |  */
    298 | 
    299 | RmT.prototype.profile = function profile(cb) {
    300 |     var that = this;
    301 |     return new P(function(resolve, reject) {
    302 |         that.client.get('account/verify_credentials', function(err, data) {
    303 |             if (err) {
    304 |                 reject(new Error(err[0].message));
    305 |             } else {
    306 |                 resolve({
    307 |                     id: data.id_str,
    308 |                     name: data.name,
    309 |                     username: data.screen_name,
    310 |                     location: data.location,
    311 |                     followers: data.followers_count,
    312 |                     tweets: data.statuses_count,
    313 |                     createdAt: data.created_at
    314 |                 });
    315 |             }
    316 |         });
    317 |     }).nodeify(cb);
    318 | };
    319 | 
    320 | /**
    321 |  * Method responsible for show your all tweets
    322 |  *
    323 |  * @example
    324 |  *
    325 |  *     api.show();
    326 |  *
    327 |  * @method show
    328 |  * @public
    329 |  * @param {Number} limit A number to limit the number of tweets returned
    330 |  * @param {Function} cb A callback with error and api response
    331 |  */
    332 | 
    333 | RmT.prototype.show = function show(limit, cb) {
    334 |     var that = this;
    335 |     return new P(function(resolve, reject) {
    336 |         that.client.get('statuses/user_timeline', {
    337 |             count: limit
    338 |         }, function(err, tweets) {
    339 |             if (err) {
    340 |                 reject(new Error(err[0].message));
    341 |             } else {
    342 |                 if (limit) {
    343 |                     var tweetsList = _.map(tweets, function(tweet) {
    344 |                         return tweet.text;
    345 |                     });
    346 |                     resolve(tweetsList);
    347 |                 } else {
    348 |                     resolve(tweets[0].text);
    349 |                 }
    350 |             }
    351 |         });
    352 |     }).nodeify(cb);
    353 | };
    354 | 
    355 | /**
    356 |  * Method responsible for delete all tweets
    357 |  *
    358 |  * @example
    359 |  *
    360 |  *     api.remove();
    361 |  *
    362 |  * @method remove
    363 |  * @public
    364 |  * @param {Boolean} removeAll A boolean to enable to remove all tweets
    365 |  * @param {Function} cb A callback with error and api response
    366 |  */
    367 | 
    368 | RmT.prototype.remove = function remove(removeAll, cb) {
    369 |     var that = this;
    370 |     return new P(function(resolve, reject) {
    371 |         that.client.get('statuses/user_timeline', {
    372 |             include_rts: true
    373 |         }, function(err, tweets) {
    374 |             if (err) {
    375 |                 reject(new Error(err[0].message));
    376 |             } else {
    377 |                 var msg;
    378 |                 if (removeAll) {
    379 |                     msg = 'You really want to remove all your tweets?';
    380 |                 } else {
    381 |                     msg = 'You really want to remove your last tweet?';
    382 |                 }
    383 |                 that.prompt([{
    384 |                     type: 'confirm',
    385 |                     name: 'remove',
    386 |                     message: msg
    387 |                 }], function(answers) {
    388 |                     if (answers.remove) {
    389 |                         if (removeAll) {
    390 |                             async.eachSeries(tweets, function(tweet, callback) {
    391 |                                 debug('Removing ' + ' "'.red + tweet.text.white + '"'.red, 'error');
    392 |                                 that.client.post('statuses/destroy/' + tweet.id_str, function(err) {
    393 |                                     if (err) {
    394 |                                         callback(new Error(err[0].message));
    395 |                                     } else {
    396 |                                         callback();
    397 |                                     }
    398 |                                 });
    399 |                             }, function(err) {
    400 |                                 if (err) {
    401 |                                     reject(err);
    402 |                                 } else {
    403 |                                     resolve('All your tweets are deleted successfully!');
    404 |                                 }
    405 |                             });
    406 |                         } else {
    407 |                             debug('Removing ' + ' "'.red + tweets[0].text.white + '"'.red, 'error');
    408 |                             that.client.post('statuses/destroy/' + tweets[0].id_str, function(err) {
    409 |                                 if (err) {
    410 |                                     reject(new Error(err[0].message));
    411 |                                 } else {
    412 |                                     resolve('Tweet removed successfully!');
    413 |                                 }
    414 |                             });
    415 |                         }
    416 |                     } else {
    417 |                         process.exit(1);
    418 |                     }
    419 |                 });
    420 |             }
    421 |         });
    422 |     }).nodeify(cb);
    423 | };
    424 | 
    425 |     
    426 |
    427 |
    428 |
    429 |
    430 |
    431 |
    432 |
    433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RmT 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 |
    17 |

    18 |
    19 |
    20 | API Docs for: 0.1.0 21 |
    22 |
    23 |
    24 | 25 |
    26 | 51 |
    52 |
    53 |
    54 | Show: 55 | 59 | 60 | 64 | 65 | 69 | 73 | 74 |
    75 | 76 |
    77 |
    78 |
    79 |
    80 |
    81 |

    82 | Browse to a module or class using the sidebar to view its API documentation. 83 |

    84 | 85 |

    Keyboard Shortcuts

    86 | 87 |
      88 |
    • Press s to focus the API search box.

    • 89 | 90 |
    • Use Up and Down to select classes, modules, and search results.

    • 91 | 92 |
    • With the API search box or sidebar focused, use -Left or -Right to switch sidebar tabs.

    • 93 | 94 |
    • With the API search box or sidebar focused, use Ctrl+Left and Ctrl+Right to switch sidebar tabs.

    • 95 |
    96 |
    97 |
    98 | 99 | 100 |
    101 |
    102 |
    103 |
    104 |
    105 |
    106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirector 5 | 6 | 7 | 8 | Click here to redirect 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/banner.js: -------------------------------------------------------------------------------- 1 | /* 2 | * rmt 3 | * https://github.com/chrisenytc/rmt 4 | * 5 | * Copyright (c) 2015, Christopher EnyTC 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /* 12 | * Module Dependencies 13 | */ 14 | 15 | var fs = require('fs'), 16 | banner = fs.readFileSync(__dirname + '/banner.txt', 'utf-8'); 17 | 18 | require('colors'); 19 | 20 | module.exports = function() { 21 | console.log(); 22 | console.log(banner.white.bold); 23 | console.log(); 24 | console.log(' RmT: A CLI tool to remove all your tweets at once'); 25 | console.log(); 26 | console.log(' Repo => '.bold.white + 'https://github.com/chrisenytc/rmt'.white); 27 | console.log(' Powered by => '.bold.white + 'Christopher EnyTC'.white); 28 | console.log(); 29 | 30 | }; 31 | -------------------------------------------------------------------------------- /lib/banner.txt: -------------------------------------------------------------------------------- 1 | _____ _______ 2 | | __ \ |__ __| 3 | | |__) | _ __ ___ | | 4 | | _ / | '_ ` _ \ | | 5 | | | \ \ | | | | | || | 6 | |_| \_\|_| |_| |_||_| -------------------------------------------------------------------------------- /lib/debugger.js: -------------------------------------------------------------------------------- 1 | /* 2 | * rmt 3 | * https://github.com/chrisenytc/rmt 4 | * 5 | * Copyright (c) 2015, Christopher EnyTC 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /* 12 | * Module Dependencies 13 | */ 14 | 15 | require('colors'); 16 | 17 | 18 | module.exports = function(msg, type) { 19 | msg = msg || ''; 20 | switch (type) { 21 | case 'error': 22 | console.log(); 23 | console.log(msg.bold.red); 24 | break; 25 | case 'warning': 26 | console.log(); 27 | console.log(msg.bold.yellow); 28 | break; 29 | case 'info': 30 | console.log(); 31 | console.log(msg.bold.cyan); 32 | break; 33 | case 'success': 34 | console.log(); 35 | console.log(msg.bold.green); 36 | break; 37 | default: 38 | console.log(); 39 | console.log(msg.bold); 40 | break; 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /lib/helpers.js: -------------------------------------------------------------------------------- 1 | /* 2 | * rmt 3 | * https://github.com/chrisenytc/rmt 4 | * 5 | * Copyright (c) 2015, Christopher EnyTC 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /* 12 | * Module Dependencies 13 | */ 14 | 15 | var fs = require('fs'), 16 | _ = require('underscore'); 17 | 18 | /** 19 | @class Helpers 20 | */ 21 | 22 | /* 23 | * Public Methods 24 | */ 25 | 26 | /** 27 | * Method responsible for check if path exists 28 | * 29 | * @example 30 | * 31 | * helpers.exists('./rmt'); 32 | * 33 | * @method exists 34 | * @public 35 | * @param {String} path File path of archive 36 | * @return {String} Returns true if file exists 37 | */ 38 | 39 | exports.exists = function exists(path) { 40 | return fs.existsSync(path); 41 | }; 42 | 43 | /** 44 | * Method responsible for reading files and get content 45 | * 46 | * @example 47 | * 48 | * helpers.read('./rmt'); 49 | * 50 | * @method read 51 | * @public 52 | * @param {String} fillepath File path of archive 53 | * @return {String} Returns file content 54 | */ 55 | 56 | exports.read = function readFile(filepath) { 57 | //Read and return this file content 58 | return fs.readFileSync(filepath, 'utf-8'); 59 | }; 60 | 61 | /** 62 | * Method responsible for writing files 63 | * 64 | * @example 65 | * 66 | * helpers.write('./rmt', 'string data'); 67 | * 68 | * @method write 69 | * @public 70 | * @param {String} fillePath File path of archive 71 | * @param {String} data Data of file 72 | */ 73 | 74 | exports.write = function writeFile(filePath, data) { 75 | //Read and return this file content 76 | if (exports.exists(filePath)) { 77 | var objData = require(filePath); 78 | _.extend(objData, data); 79 | //Write 80 | fs.writeFileSync(filePath, JSON.stringify(objData, null, 4)); 81 | } else { 82 | fs.writeFileSync(filePath, JSON.stringify(data, null, 4)); 83 | } 84 | }; 85 | 86 | /** 87 | * Method responsible for demove files 88 | * 89 | * @example 90 | * 91 | * helpers.remove('./rmt'); 92 | * 93 | * @method remove 94 | * @public 95 | * @param {String} path File path of archive 96 | */ 97 | 98 | exports.remove = function remove(path) { 99 | fs.unlinkSync(path); 100 | }; 101 | 102 | /** 103 | * Method responsible for demove directories 104 | * 105 | * @example 106 | * 107 | * helpers.rm('./rmt'); 108 | * 109 | * @method rm 110 | * @public 111 | * @param {String} path File path of directory 112 | */ 113 | 114 | exports.rm = function rm(path) { 115 | if (fs.existsSync(path)) { 116 | fs.readdirSync(path).forEach(function(file) { 117 | var curPath = path + '/' + file; 118 | if (fs.statSync(curPath).isDirectory()) { // recurse 119 | exports.rm(curPath); 120 | } else { // delete file 121 | fs.unlinkSync(curPath); 122 | } 123 | }); 124 | fs.rmdirSync(path); 125 | } 126 | }; 127 | 128 | /** 129 | * Method responsible for check if path is a file 130 | * 131 | * @example 132 | * 133 | * helpers.isFile('./rmt'); 134 | * 135 | * @method isFile 136 | * @public 137 | * @param {String} path File path of archive 138 | * @return {String} Returns true if path is file 139 | */ 140 | 141 | exports.isFile = function isFile(path) { 142 | var f = fs.stat(path); 143 | return f.isFile(); 144 | }; 145 | 146 | /** 147 | * Method responsible for check if path is a directory 148 | * 149 | * @example 150 | * 151 | * helpers.isDir('./rmt'); 152 | * 153 | * @method isDir 154 | * @public 155 | * @param {String} path File path of archive 156 | * @return {String} Returns true if path is directory 157 | */ 158 | 159 | exports.isDir = function isDir(path) { 160 | var f = fs.stat(path); 161 | return f.isDirectory(); 162 | }; 163 | -------------------------------------------------------------------------------- /lib/rmt.js: -------------------------------------------------------------------------------- 1 | /* 2 | * rmt 3 | * https://github.com/chrisenytc/rmt 4 | * 5 | * Copyright (c) 2015, Christopher EnyTC 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /** 12 | * Module Dependencies 13 | */ 14 | 15 | var inquirer = require('inquirer'), 16 | Twitter = require('twitter'), 17 | TwitterPinAuth = require('twitter-pin-auth'), 18 | P = require('bluebird'), 19 | _ = require('underscore'), 20 | async = require('async'), 21 | open = require('open'), 22 | join = require('path').join, 23 | debug = require('./debugger.js'), 24 | h = require('./helpers.js'); 25 | 26 | require('colors'); 27 | 28 | /** 29 | * @class RmT 30 | * 31 | * @constructor 32 | * 33 | * Constructor responsible for provide twitter authorization 34 | * 35 | * @example 36 | * 37 | * var api = new RmT('consumerKey', 'consumerSecret'); 38 | * 39 | * @param {String} consumerKey The twitter consumer key 40 | * @param {String} consumerSecret The twitter consumer secret 41 | */ 42 | 43 | var RmT = module.exports = function RmT(consumerKey, consumerSecret) { 44 | this.consumerKey = consumerKey; 45 | this.consumerSecret = consumerSecret; 46 | this.accessTokenKey = ''; 47 | this.accessTokenSecret = ''; 48 | this.tpa = new TwitterPinAuth(this.consumerKey, this.consumerSecret); 49 | this.client = null; 50 | }; 51 | 52 | /* 53 | * Public Methods 54 | */ 55 | 56 | /** 57 | * Method responsible for asking questions 58 | * 59 | * @example 60 | * 61 | * api.prompt(prompts, cb); 62 | * 63 | * @method prompt 64 | * @public 65 | * @param {Object} prompts Array of prompt options 66 | * @param {Function} cb A callback 67 | */ 68 | 69 | RmT.prototype.prompt = function prompt(prompts, cb) { 70 | inquirer.prompt(prompts, function(answers) { 71 | cb(answers); 72 | }); 73 | }; 74 | 75 | /** 76 | * Method responsible for create twitter client instance 77 | * 78 | * @example 79 | * 80 | * api.createClient('accessTokenKey', 'accessTokenSecret'); 81 | * 82 | * @method createClient 83 | * @public 84 | * @param {String} accessTokenKey The twitter access token key 85 | * @param {String} accessTokenSecret The twitter access token secret 86 | */ 87 | 88 | RmT.prototype.createClient = function createClient(accessTokenKey, accessTokenSecret) { 89 | this.client = new Twitter({ 90 | consumer_key: this.consumerKey, 91 | consumer_secret: this.consumerSecret, 92 | access_token_key: accessTokenKey, 93 | access_token_secret: accessTokenSecret 94 | }); 95 | }; 96 | 97 | /** 98 | * Method responsible for save consumer credentials 99 | * 100 | * @example 101 | * 102 | * api.setConfig('consumerKey', 'consumerSecret', function(err, data) { 103 | * console.log(data); 104 | * }); 105 | * 106 | * @method setConfig 107 | * @public 108 | * @param {String} consumerKey The twitter consumer key 109 | * @param {String} consumerSecret The twitter consumer secret 110 | * @param {Function} cb A callback with error and api response 111 | */ 112 | 113 | RmT.prototype.setConfig = function setConfig(consumerKey, consumerSecret, cb) { 114 | return new P(function(resolve, reject) { 115 | //Write config 116 | if (consumerKey && consumerKey !== '' && consumerSecret && consumerSecret !== '') { 117 | h.write(join(__dirname, 'rmtConfig.json'), { 118 | consumerKey: consumerKey, 119 | consumerSecret: consumerSecret 120 | }); 121 | resolve('Settings updated successfully!'); 122 | } else { 123 | reject(new Error('Setup failed. Try again!')); 124 | } 125 | }).nodeify(cb); 126 | }; 127 | 128 | /** 129 | * Method responsible for login 130 | * 131 | * @example 132 | * 133 | * api.login(function(err, data) { 134 | * console.log(data); 135 | * }); 136 | * 137 | * @method login 138 | * @public 139 | * @param {Function} cb A callback with error and api response 140 | */ 141 | 142 | RmT.prototype.login = function login(cb) { 143 | var that = this; 144 | return new P(function(resolve, reject) { 145 | //Get authUrl 146 | that.tpa.requestAuthUrl() 147 | .then(function(url) { 148 | debug('In your browser, on the opened window by RmT, log in to your twitter account, click on "Authorize" button and enter the PIN number below.', 'info'); 149 | console.log(); 150 | //Open authorize url 151 | open(url); 152 | //Ask 153 | that.prompt([{ 154 | type: 'input', 155 | name: 'pin', 156 | message: 'Enter the pin number: ' 157 | }], function(answers) { 158 | that.tpa.authorize(answers.pin) 159 | .then(function(data) { 160 | //Write config 161 | if (data.accessTokenKey && data.accessTokenKey !== '' && data.accessTokenSecret && data.accessTokenSecret !== '') { 162 | h.write(join(__dirname, 'rmtConfig.json'), { 163 | accessTokenKey: data.accessTokenKey, 164 | accessTokenSecret: data.accessTokenSecret 165 | }); 166 | resolve('Logged successfully!'); 167 | } else { 168 | reject(new Error('Login failed. Try again!')); 169 | } 170 | }).catch(function(err) { 171 | reject(err); 172 | }); 173 | }); 174 | }).catch(function(err) { 175 | reject(err); 176 | }); 177 | }).nodeify(cb); 178 | }; 179 | 180 | /** 181 | * Method responsible for remove twitter credentials 182 | * 183 | * @example 184 | * 185 | * api.logout(function(err, message) { 186 | * console.log(message); 187 | * }); 188 | * 189 | * @method logout 190 | * @public 191 | * @param {Function} cb A callback with error and api response 192 | */ 193 | 194 | RmT.prototype.logout = function logout(cb) { 195 | return new P(function(resolve) { 196 | //Write config 197 | h.write(join(__dirname, 'rmtConfig.json'), { 198 | accessTokenKey: '', 199 | accessTokenSecret: '' 200 | }); 201 | resolve('Your twitter credentials has been removed successfully!'); 202 | }).nodeify(cb); 203 | }; 204 | 205 | /** 206 | * Method responsible for showing the user profile 207 | * 208 | * @example 209 | * 210 | * api.profile(); 211 | * 212 | * @method profile 213 | * @public 214 | * @param {Function} cb A callback with error and api response 215 | */ 216 | 217 | RmT.prototype.profile = function profile(cb) { 218 | var that = this; 219 | return new P(function(resolve, reject) { 220 | that.client.get('account/verify_credentials', function(err, data) { 221 | if (err) { 222 | reject(new Error(err[0].message)); 223 | } else { 224 | resolve({ 225 | id: data.id_str, 226 | name: data.name, 227 | username: data.screen_name, 228 | location: data.location, 229 | followers: data.followers_count, 230 | tweets: data.statuses_count, 231 | createdAt: data.created_at 232 | }); 233 | } 234 | }); 235 | }).nodeify(cb); 236 | }; 237 | 238 | /** 239 | * Method responsible for show your all tweets 240 | * 241 | * @example 242 | * 243 | * api.show(); 244 | * 245 | * @method show 246 | * @public 247 | * @param {Number} limit A number to limit the number of tweets returned 248 | * @param {Function} cb A callback with error and api response 249 | */ 250 | 251 | RmT.prototype.show = function show(limit, cb) { 252 | var that = this; 253 | return new P(function(resolve, reject) { 254 | that.client.get('statuses/user_timeline', { 255 | count: limit 256 | }, function(err, tweets) { 257 | if (err) { 258 | reject(new Error(err[0].message)); 259 | } else { 260 | if (limit) { 261 | var tweetsList = _.map(tweets, function(tweet) { 262 | return tweet.text; 263 | }); 264 | resolve(tweetsList); 265 | } else { 266 | resolve(tweets[0].text); 267 | } 268 | } 269 | }); 270 | }).nodeify(cb); 271 | }; 272 | 273 | /** 274 | * Method responsible for delete all tweets 275 | * 276 | * @example 277 | * 278 | * api.remove(); 279 | * 280 | * @method remove 281 | * @public 282 | * @param {Boolean} removeAll A boolean to enable to remove all tweets 283 | * @param {Function} cb A callback with error and api response 284 | */ 285 | 286 | RmT.prototype.remove = function remove(removeAll, cb) { 287 | var that = this; 288 | return new P(function(resolve, reject) { 289 | that.client.get('statuses/user_timeline', { 290 | include_rts: true 291 | }, function(err, tweets) { 292 | if (err) { 293 | reject(new Error(err[0].message)); 294 | } else { 295 | var msg; 296 | if (removeAll) { 297 | msg = 'You really want to remove all your tweets?'; 298 | } else { 299 | msg = 'You really want to remove your last tweet?'; 300 | } 301 | that.prompt([{ 302 | type: 'confirm', 303 | name: 'remove', 304 | message: msg 305 | }], function(answers) { 306 | if (answers.remove) { 307 | if (removeAll) { 308 | async.eachSeries(tweets, function(tweet, callback) { 309 | debug('Removing ' + ' "'.red + tweet.text.white + '"'.red, 'error'); 310 | that.client.post('statuses/destroy/' + tweet.id_str, function(err) { 311 | if (err) { 312 | callback(new Error(err[0].message)); 313 | } else { 314 | callback(); 315 | } 316 | }); 317 | }, function(err) { 318 | if (err) { 319 | reject(err); 320 | } else { 321 | resolve('All your tweets are deleted successfully!'); 322 | } 323 | }); 324 | } else { 325 | debug('Removing ' + ' "'.red + tweets[0].text.white + '"'.red, 'error'); 326 | that.client.post('statuses/destroy/' + tweets[0].id_str, function(err) { 327 | if (err) { 328 | reject(new Error(err[0].message)); 329 | } else { 330 | resolve('Tweet removed successfully!'); 331 | } 332 | }); 333 | } 334 | } else { 335 | process.exit(1); 336 | } 337 | }); 338 | } 339 | }); 340 | }).nodeify(cb); 341 | }; 342 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rmt", 3 | "description": "A CLI tool to remove all your tweets at once", 4 | "version": "0.1.0", 5 | "homepage": "https://github.com/chrisenytc/rmt", 6 | "author": { 7 | "name": "Christopher EnyTC", 8 | "email": "chrisenytc@gmail.com" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/chrisenytc/rmt.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/chrisenytc/rmt/issues" 16 | }, 17 | "licenses": [ 18 | { 19 | "type": "MIT", 20 | "url": "https://github.com/chrisenytc/rmt/blob/master/LICENSE" 21 | } 22 | ], 23 | "main": "lib/rmt", 24 | "bin": { 25 | "rmt": "bin/rmt.js" 26 | }, 27 | "engines": { 28 | "node": ">= 0.10.36" 29 | }, 30 | "scripts": { 31 | "test": "make test" 32 | }, 33 | "dependencies": { 34 | "async": "^0.9.0", 35 | "bluebird": "^2.9.14", 36 | "colors": "~0.6.2", 37 | "commander": "~2.1.0", 38 | "inquirer": "~0.4.1", 39 | "insight": "~0.3.1", 40 | "open": "0.0.5", 41 | "prettyjson": "^0.11.1", 42 | "twitter": "~1.2.5", 43 | "twitter-pin-auth": "~0.1.2", 44 | "underscore": "~1.5.2", 45 | "update-notifier": "~0.1.7" 46 | }, 47 | "devDependencies": { 48 | "chai": "~2.1.2", 49 | "mocha": "~2.2.1" 50 | }, 51 | "keywords": [ 52 | "cli", 53 | "tool", 54 | "twitter", 55 | "remove", 56 | "delete", 57 | "tweets" 58 | ] 59 | } 60 | -------------------------------------------------------------------------------- /test/rmt.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * rmt 3 | * https://github.com/chrisenytc/rmt 4 | * 5 | * Copyright (c) 2015, Christopher EnyTC 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /** 12 | * Module dependencies 13 | */ 14 | 15 | var chai = require('chai'), 16 | expect = chai.expect; 17 | 18 | chai.should(); 19 | 20 | var Api = require('../lib/rmt.js'); 21 | var api = new Api('consumerKey', 'consumerSecret'); 22 | 23 | describe('rmt module', function() { 24 | describe('#constructor()', function() { 25 | it('should be a function', function() { 26 | expect(Api).to.be.a("function"); 27 | }); 28 | }); 29 | describe('#instance()', function() { 30 | it('should be a object', function() { 31 | expect(api).to.be.a("object"); 32 | }); 33 | }); 34 | }); 35 | 36 | -------------------------------------------------------------------------------- /yuidoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RmT", 3 | "description": "RmT: A CLI tool to remove all your tweets at once", 4 | "version": "0.1.0", 5 | "url": "https://github.com/chrisenytc/rmt", 6 | "options": { 7 | "outdir": "./docs", 8 | "paths": "./lib" 9 | } 10 | } 11 | --------------------------------------------------------------------------------