diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 76f8c8d20..79f287a87 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,9 +1,11 @@ # Contributing +Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE). + This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to uphold this. **NOTE**: GitHub no longer accepts new services. If you'd like to integrate -your application or service with GitHub, you should use [webhooks][webhooks] which will `POST` a payload to your server for each event or request to join the [GitHub Integrations Directory](https://github.com/integrations). +your application or service with GitHub, you should use [webhooks][webhooks] which will `POST` a payload to your server for each event or request to join the [GitHub Marketplace][github-marketplace]. ## Updating an existing service @@ -13,3 +15,4 @@ All pull requests will be reviewed by multiple GitHub staff members before being [code-of-conduct]: http://todogroup.org/opencodeofconduct/#GitHub%20Services/opensource@github.com [webhooks]: https://developer.github.com/webhooks/ +[github-marketplace]: https://github.com/marketplace diff --git a/.gitignore b/.gitignore index 482a03e0e..cd770bf1b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ tmp pkg .iml Gemfile.lock + +github-services*.gem diff --git a/.ruby-version b/.ruby-version index 04b10b4f1..197c4d5c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.7 +2.4.0 diff --git a/.travis.yml b/.travis.yml index 4e01263b8..4d14cdc45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: - - 2.1.7 + - 2.4.0 install: script/bootstrap script: bundle exec rake test sudo: false diff --git a/README.md b/README.md index e27689300..e6e708a00 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ + +🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 + +**_GitHub Services has been deprecated_. No more contributions will be accepted. Please see our [blog post](https://developer.github.com/changes/2018-04-25-github-services-deprecation/) for more information.** + +🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 + GitHub Services =============== diff --git a/docs/agilezen b/docs/agilezen deleted file mode 100644 index 81eb1d0a7..000000000 --- a/docs/agilezen +++ /dev/null @@ -1,17 +0,0 @@ -AgileZen is a simple and easy to use project management tool that helps you collaborate with your team and visualize all your work in progress. - -Integrating with GitHub will allow you to associate Git commits to specific story cards. If you add a story number to your commit message, AgileZen will associate the commit with the story, making it visible on the board and story focus screen. For example, if you add the text `#123` to your commit message, AgileZen will attach the commit to story card 123. - -This allows your team to stay up to date on the latest development work and view a history of commits for each story. - -Install Notes -------------- - -1. **API Key** - This is your AgileZen API key. -2. **Project ID** - This is the project's numeric ID (the number in the project's URL on AgileZen) to associate with the repository. -3. **Branches** - This is an optional space-separated list of branches to watch commits for. Commits to other branches will not be notified to AgileZen. If no branches are specified, AgileZen will be notified of all commits. - -Need Help? ----------- - -Check out our [step by step instructions](http://help.agilezen.com/kb/integrations/github). diff --git a/docs/awsopsworks b/docs/awsopsworks index e89da0b53..4d7420a36 100644 --- a/docs/awsopsworks +++ b/docs/awsopsworks @@ -27,5 +27,6 @@ Install Notes 3. **Branch Name** (required) - "Branch/Revision" configured for that app in the AWS OpsWorks Console or see `Revision` at http://docs.aws.amazon.com/opsworks/latest/APIReference/API_Source.html 4. **Aws Access Key Id** (required) - Access key id of an AWS IAM user having the permission for the `opsworks:CreateDeployment` action. 5. **Aws Secret Access Key** (required) - Corresponding secret access key of the AWS IAM user. +6. **Endpoint Region** (Optional) - The API endpoint region for your stack. Defaults to us-east-1 (classic) 6. **GitHub Token** (Optional) - A GitHub personal access token with `repo` scope to for OAuth cloning and deployment statuses for the GitHub API. 7. **GitHub API Url** (Optional) - The URL for the GitHub API. Override this for enterprise. e.g. `https://enterprise.myorg.com`. diff --git a/docs/basecamp b/docs/basecamp index f626951a9..87ef55f8a 100644 --- a/docs/basecamp +++ b/docs/basecamp @@ -1,9 +1,6 @@ Install Notes ------------- - 1. **Url** should be your Basecamp url - 2. **Username** should be the username or API token of the user that you want to use to post messages into your Basecamp - you can setup a user just for this purpose - 3. **Password** should be the password of the user that you want to use to post the messages. If username is an API token, set password to 'x'. - 4. **Project** should be the name of the project that you want to post the message into (not the id) - 5. **Category** should be the name of the category that you want to post the message using (not the id) - 6. **SSL** should be enabled for accounts that need SSL. + 1. project_url is the URL of your Basecamp project: https://basecamp.com/1234/projects/5678 + 2. email_address is the email you sign in to Basecamp with. This person must have access to the project. To add events on behalf of other people, make the person an admin on the project. + 3. password is the password you sign in to Basecamp with. diff --git a/docs/bcx b/docs/bcx deleted file mode 100644 index 679b45409..000000000 --- a/docs/bcx +++ /dev/null @@ -1,7 +0,0 @@ -Install Notes -------------- - - 1. project_url is the URL of your Basecamp project: https://basecamp.com/1234/projects/5678 - 2. email_address is the email you sign in to Basecamp with. This person must have access to the project. To add events on behalf of other people, make the person an admin on the project. - 3. password is the password you sign in to Basecamp with. - diff --git a/docs/boxcar b/docs/boxcar deleted file mode 100644 index 4584be2c3..000000000 --- a/docs/boxcar +++ /dev/null @@ -1,10 +0,0 @@ -Install Notes -------------- - -Send your commits to Boxcar, a messaging platform. Get instant commit messages on your desktop and mobile devices. - -1. Download and install Boxcar from - -2. Type in the Boxcar e-mail addresses of the users wanting to be notified of commits to this repository (comma separated). - -3. If the user does not yet have Boxcar, we'll send them an e-mail to let them know where they can get it. \ No newline at end of file diff --git a/docs/circleci b/docs/circleci deleted file mode 100644 index 5325514b6..000000000 --- a/docs/circleci +++ /dev/null @@ -1,10 +0,0 @@ -[CircleCI](https://circleci.com) will add these hooks automatically to projects which you test using CircleCI. By enabling all the events GitHub offers it allows tighter integration between GitHub and CircleCI. To sign up, go to https://circleci.com, sign in, and start testing! - -Install Notes -------------- - -1. Sign up at https://circleci.com with your GitHub credentials -2. Follow your repository -3. You're done! - -For more details about CircleCI go to https://circleci.com diff --git a/docs/codeportingcsharp2java b/docs/codeportingcsharp2java deleted file mode 100644 index b989bbcb6..000000000 --- a/docs/codeportingcsharp2java +++ /dev/null @@ -1,10 +0,0 @@ -Allows you to setup a GitHub repository to port C# code to Java on git commit. - -Install Notes -------------- - -1. Enter name for your project (It will be used to organize target repository structure) -2. Enter name for your source repository, the one which contains CSharp code. -3. Enter name for your target repository, the one which will contain the Java ported code (the target repository must be git initialized first). -4. Signup for a CodePorting account at https://apps.codeporting.com/signup and add your CodePorting username/password above. -5. Authorize CodePorting to use your GitHub account and enter GitHub access token above on service settings page. diff --git a/docs/codeship b/docs/codeship index 63d6af028..960ea7e7a 100644 --- a/docs/codeship +++ b/docs/codeship @@ -1,17 +1,19 @@ -Codeship offers continuous integration and deployment for Ruby, PHP, Python, Go and Java applications. +Codeship offers continuous integration and deployment for a variety of applications including Ruby, Node, PHP, Python, Java and Go. -This service hook will inform Codeship every time you push to GitHub. On every push Codeship tests the current version of your application. If all tests succeed, Codeship deploys your application, otherwise it informs you about the failures. +This service hook will inform Codeship every time you push to GitHub. On every push Codeship tests the current version of your application. If all tests succeed, Codeship can also deploy your application, otherwise it informs you about the failures. Install Notes ------------- Codeship will install this hook automatically on sign up. However, if creating the service didn't succeed or you accidentally deleted it, you can also install it manually. -1. Sign up at https://www.codeship.io/ (you can sign in with GitHub) -2. If the service wasn't set: Go to your project's settings and copy the project uuid. -3. Paste the project uuid into the text field below. -4. Make sure the "Active" checkbox is ticked, and click "Update service". -5. Click on the "Codeship" service name and then click the "Test service" link. -6. Now there should be a running build on your Codeship dashboard. +1. Sign up at [codeship.com](https://codeship.com) +2. Go to your project's settings, find the General section and copy the project UUID +3. Paste the project UUID into the text field below +4. Make sure the "Active" checkbox is ticked and click "Update service" +5. Click on the "Codeship" service name and then click "Test service" +6. Now there should be a running build on your Codeship dashboard -Check out more details on Codeship at https://www.codeship.io/. +Learn more by visiting [codeship.com](https://codeship.com) and our [documentation](https://documentation.codeship.com). + +[Contact us](https://helpdesk.codeship.com) if you need further assistance. diff --git a/docs/coffeedocinfo b/docs/coffeedocinfo deleted file mode 100644 index 470cbd8d5..000000000 --- a/docs/coffeedocinfo +++ /dev/null @@ -1,2 +0,0 @@ -This service allows you to auto-publish documentation for your CoffeeScript library. -The resulting documentation will be hosted for you at http://coffeedoc.info/github/your-name/your-project diff --git a/docs/commandoio b/docs/commandoio index a2167c210..6ebef16ac 100644 --- a/docs/commandoio +++ b/docs/commandoio @@ -7,6 +7,6 @@ Install Notes * **Account alias** - Your account alias is simply the subdomain that you access Commando.io with. For example the account alias of `https://foo.commando.io` is `foo`. * **Recipe** - The recipe you wish to execute. You may find recipe ids in the in the Commando.io web interface. * **Server** - A single server id. You may find server ids in the modal popup when clicking a server in the Commando.io web interface. - * **Groups** - A list of group ids seperated by commas. You may find group ids in the modal popup when clicking a group in the Commando.io web interface. + * **Groups** - A list of group ids separated by commas. You may find group ids in the modal popup when clicking a group in the Commando.io web interface. * **Notes** _(Optional)_ - Notes and comments you wish to attach to this execution. Markdown is supported. * **Halt on stderr** _(Optional)_ - If a server returns stderr during execution, halt and prevent the remaining servers from executing the recipe. diff --git a/docs/conductor b/docs/conductor index 608c0282a..d675c3d68 100644 --- a/docs/conductor +++ b/docs/conductor @@ -1,5 +1,5 @@ Install Notes ------------- - 1. **API Key** is from within the Conductor project. + 1. **API Key** is from within the Conductor project. (https://conductor-app.com/) 2. This service will post back all pushes, regardless of whether or not they contain ticket annotations. 3. Annotations will be parsed for [#xxx] content, where xxx denotes a valid ticket number in the relevant Conductor project diff --git a/docs/coop b/docs/coop deleted file mode 100644 index 6a30dcad0..000000000 --- a/docs/coop +++ /dev/null @@ -1,8 +0,0 @@ -Install Notes -------------- - - 1. group_id is in the URL for your group, for example if your URL is "http://coopapp.com/groups/1066", your group_id is 1066 - - 2. token is your API token. You can find this token in the group management panel as the group administrator, eg: "http://coopapp.com/groups/1066/edit" - - 3. Commit messages show up as being from Cobot, the Co-op message robot \ No newline at end of file diff --git a/docs/cube b/docs/cube deleted file mode 100644 index 8e01ef25e..000000000 --- a/docs/cube +++ /dev/null @@ -1,6 +0,0 @@ -Install Notes -------------- - - 1. **Domain** should be the company domain for Google Apps account or user email address for individual accounts. - 2. **Project** should be your project name. - 3. **Token** should be the project integration token as seen in the project's Settings tab. \ No newline at end of file diff --git a/docs/depending b/docs/depending deleted file mode 100644 index 10e233a29..000000000 --- a/docs/depending +++ /dev/null @@ -1,7 +0,0 @@ -Install Notes -------------- - -1. Create an account at http://depending.in -2. Enter your Token (see instructions below) - -To get your Token: Log into your Depending account, click the carret icon at the top-right, then click the setting tab. \ No newline at end of file diff --git a/docs/distiller b/docs/distiller deleted file mode 100644 index fbe70bf3a..000000000 --- a/docs/distiller +++ /dev/null @@ -1,14 +0,0 @@ -Distiller is a hosted continuous integration service. - -If you already connected this repository to Distiller we've probably already set up a webhook for this repository - check this list of webhooks above. - -If you haven't connected this project but want to: - -1. Go to http://distiller.io/ and sign up with your GitHub credentials. -2. Create a New Project and add the GitHub repository. -3. Configure the project. -4. We'll add a webhook - you're done! - -If you or someone else has connected this repository to Distiller but wasn't able to configure the webhook (if, for example, they weren't an administrator for this repository), simply check β€œActive” to enable the hook and Distiller will automatically build this repository when you push. - -Learn more at http://distiller.io. \ No newline at end of file diff --git a/docs/divecloud b/docs/divecloud index 29ad01fcd..3275eedbf 100644 --- a/docs/divecloud +++ b/docs/divecloud @@ -1,9 +1,9 @@ DiveCloud integrates Application Performance Testing into the Continuous Integration Cycle by allowing you to run a performance test after each successful deployment. -When Github receives notice that you have successfully deployed your application, it will initiate a performance test based on the test plan you created at https://divecloud.nouvola.com. +When GitHub receives notice that you have successfully deployed your application, it will initiate a performance test based on the test plan you created at https://divecloud.nouvola.com. -Please enter your API Key and the Plan ID for the plan that you would like to run on successful deployment of your application. +Please enter your API Key and the Plan ID for the plan that you would like to run on successful deployment of your application. -If you would like to add 'Think Time' to you test, select the 'Think Time' checkbox. +If you would like to add 'Think Time' to you test, select the 'Think Time' checkbox. -If your test plan includes credentials, include your credential password in the field below. +If your test plan includes credentials, include your credential password in the field below. diff --git a/docs/hall b/docs/hall deleted file mode 100644 index a790596a6..000000000 --- a/docs/hall +++ /dev/null @@ -1,8 +0,0 @@ -Broadcast this project's commits, pull requests, issues, and their respective comments to Hall. - -Install Notes -------------- - - * Room Token is a room-specific token. - * You can locate your token by viewing the desired room's setting page. - * Hall is available 24/7 to help. Email us at contact@hall-inc.com diff --git a/docs/honbu b/docs/honbu deleted file mode 100644 index 24f577511..000000000 --- a/docs/honbu +++ /dev/null @@ -1,15 +0,0 @@ -This service posts GitHub events to the Honbu integration service. - -Supported events are currently: -'push', 'issues', 'issue_comment', 'commit_comment', 'create', -'delete', pull_request', 'pull_request_review_comment', 'gollum', -'watch', 'release', 'fork', 'member', 'public', 'team_add', -'status', 'deployment', 'deployment_status'. - -As described at https://developer.github.com/webhooks/#service-hooks - - -Install Notes ------------- - -Token: The GUID generated by Honbu app when the user chooses to integrate with GitHub diff --git a/docs/hubci b/docs/hubci deleted file mode 100644 index 9d4353608..000000000 --- a/docs/hubci +++ /dev/null @@ -1,11 +0,0 @@ -NODE.CI is a SaaS continuous integration tool for Node.js - -Install Notes -------------- - -1. Create an account at http://node.ci (you can sign in with GitHub) -2. Install your repository on NODE.CI -3. You're done! - -For more details about NODE.CI, go to http://docs.node.ci - diff --git a/docs/huboard b/docs/huboard index ae830acd5..7b87f86a5 100644 --- a/docs/huboard +++ b/docs/huboard @@ -3,7 +3,7 @@ Instant project management for you GitHub repositories See: https://huboard.com HuBoard is built from the ground up using the GitHub public API. HuBoard issues **are** GitHub issues, you will never -have to deal with syncronization problems. Keep you issues where they belong, in the repository with you code. +have to deal with synchronization problems. Keep you issues where they belong, in the repository with you code. By enabling GitHub's Service Hook integration, HuBoard keeps your agile boards up to date by sending events that occur on GitHub directly to HuBoard. diff --git a/docs/jqueryplugins b/docs/jqueryplugins deleted file mode 100644 index 9e0a9da39..000000000 --- a/docs/jqueryplugins +++ /dev/null @@ -1 +0,0 @@ -This service notifies the [jQuery Plugin site](http://plugins.jquery.com) of any new releases to your jQuery plugin. See [http://plugins.jquery.com/docs/publish/](http://plugins.jquery.com/docs/publish/) for more information. diff --git a/docs/kanbanize b/docs/kanbanize index 88a094ab3..2b3a2b963 100644 --- a/docs/kanbanize +++ b/docs/kanbanize @@ -2,7 +2,7 @@ Install Notes ------------- 1. **Kanbanize domain name** - Your project Kanbanize domain name Ex: **mycompany.kanbanize.com** -2. **Kanbanize api key** - The API key of a Kanbanize user account. We recomend using a dedicated Administrator user or a standard user (e.g. GitHub_user) with permissions to access, comment and modify cards on the desired boards. +2. **Kanbanize api key** - The API key of a Kanbanize user account. We recommend using a dedicated Administrator user or a standard user (e.g. GitHub_user) with permissions to access, comment and modify cards on the desired boards. 3. **Branch Filter** - A Comma-separated list of branches which will be automatically inspected. Leave blank to include all branches. 4. **Restrict to Last Commit** - Only the last commit of each push will be inspected for task IDs. 5. **Track Project Issues In Kanbanize** - Open/Move to Done a card when a project issue is Open/Closed diff --git a/docs/leanpub b/docs/leanpub index 45ada86a9..a0744520f 100644 --- a/docs/leanpub +++ b/docs/leanpub @@ -4,6 +4,6 @@ Required values are: api_key: Your Leanpub api_key, which you can find at https://leanpub.com/author_dashboard/settings. -slug: The slug for your book. This is the part of the URL for your book after https://leanpub.com/. For example, for https://leanpub.com/thes3cookbook, the slug is thes3cookbook. +slug: The slug for your book. This is the part of the URL for your book after https://leanpub.com/. For example, for https://leanpub.com/lean, the slug is lean. See https://leanpub.com/help/api for more information on the Leanpub API. diff --git a/docs/lechat b/docs/lechat deleted file mode 100644 index b8e20fcbc..000000000 --- a/docs/lechat +++ /dev/null @@ -1,7 +0,0 @@ -Kato is a team chat service with an emphasis on search, user interface, and reliability. - -Integrating with GitHub will cause certain information about commits, issues, and comments to appear in a specified Kato room. - -Install Notes -------------- -**Webhook Url** - GitHub webhook URL from the Integrations tab in room settings in your [Kato](http://kato.im) account diff --git a/docs/loggly b/docs/loggly deleted file mode 100644 index 64d1660b1..000000000 --- a/docs/loggly +++ /dev/null @@ -1,7 +0,0 @@ -This service hook allows you to log pushed commits directly to a Loggly HTTP -input. - -Install Notes -------------- - -1. input token -- take this from the detail page for your HTTP input. \ No newline at end of file diff --git a/docs/masterbranch b/docs/masterbranch deleted file mode 100644 index 5bd8c21ab..000000000 --- a/docs/masterbranch +++ /dev/null @@ -1,4 +0,0 @@ -With this service your commit's logs will be sent to Masterbranch.com. -Masterbranch will proportionate you with an automatic-updated profile of your -project. This profile will show the different technologies you are using, -including some stats based on the contributors development. diff --git a/docs/maxcdn b/docs/maxcdn index 5df0af085..964b3c5d8 100644 --- a/docs/maxcdn +++ b/docs/maxcdn @@ -6,7 +6,7 @@ Purge your MaxCDN Pull Zone 1. Get your "Company Alias", "Consumer Key" and "Consumer Secret" from your [MaxCDN Account API Page][account_api_url]. 2. Get your "Zone ID" from your [MaxCDN Account Pull Zones Overview page][account_pull_zone]. 3. "Static Only" will only purge your zone if modified files include static files — `css`, `js`, `jpg`, `jpeg`, `gif`, `ico`, `png`, `bmp`, `pict`, `csv`, `doc`, `pdf`, `pls`, `ppt`, `tif`, `tiff`, `eps`, `ejs`, `swf`, `midi`, `mid`, `txt`, `ttf`, `eot`, `woff`, `otf`, `svg`, `svgz`, `webp`, `docx`, `xlsx`, `xls`, `pptx`, `ps`, `rss`, `class`, `jar`. - 4. Whitelist the GitHub web hook IP block with MaxCDN. For instructions, see MaxCDN's support page on [How To Whitelsit Your Server IP To Use The API][whitelist_article]. + 4. Whitelist the GitHub web hook IP block with MaxCDN. For instructions, see MaxCDN's support page on [How To Whitelist Your Server IP To Use The API][whitelist_article]. > GitHub's IPs may change from time to time, if you're having issues, verify that the IP you've whitelisted is still current, by checking the "hook" key at [GitHub's "meta" API endpoint][meta_endpoint]. diff --git a/docs/nma b/docs/nma deleted file mode 100644 index f9e52cabb..000000000 --- a/docs/nma +++ /dev/null @@ -1,11 +0,0 @@ -With NotifyMyAndroid (NMA) you can push notifications to your Android devices -through Google's C2DM notification system. The [public Web API](http://www.notifymyandroid.com/api.php) -can be used by virtually any application to delivery push notifications to -your Android. - -Install Notes -------------- - -1. Register at https://www.notifymyandroid.com/register.php. - -2. Generate an API key at https://www.notifymyandroid.com/account.php to be used on GitHub. diff --git a/docs/nodejitsu b/docs/nodejitsu deleted file mode 100644 index e50b53168..000000000 --- a/docs/nodejitsu +++ /dev/null @@ -1,33 +0,0 @@ -Nodejitsu – Intelligent, scalable Node.js clouds. - -Install Notes -------------- - -Create an account at http://nodejitsu.com and login there. - - 1. Enter your credentials - - Username - - Password (Authorization Token suggested, password also works) - - Branch, if specified will only deploy from the specified branch - 3. Check the "Active" checkbox and click "Update Settings". - 4. Click on the "Nodejitsu" service name and then click the "Test Hook" link. - -API Documentation ------------------ - -Please refer to https://webhooks.nodejitsu.com for documentation. - -Travis CI Integration ---------------------- - -It is possible to integrate this endpoint with Travis-CI. Check out blog for more information. - -Running in your own Nodejitsu Cloud ------------------------------------ - -If you own a copy of Nodejitsu Enterprise you can set the `endpoint` that you wish to use for your installation. Simply enter the host of your Nodejitsu Web Hooks API Copy (defaults to https://webhooks.nodejitsu.com). - -Support -------- - -Join #nodejitsu on chat.freenode.net and get immediate assistance from our support team! diff --git a/docs/pushalot b/docs/pushalot deleted file mode 100644 index 5df67e2ac..000000000 --- a/docs/pushalot +++ /dev/null @@ -1,11 +0,0 @@ -Pushalot is a platform for receiving custom push notifications to connected devices running Windows Phone or Windows 8. Custom means that those push notifications can be sent from virtually any source, as long as that source can interact with our open [REST API](https://pushalot.com/api). - -Install Notes -------------- - -1. Install the [Windows 8 app](https://pushalot.com/apps) from the Windows Store, or the [Windows Phone app](https://pushalot.com/apps) from the Windows Phone Apps+Games Store. - -2. Sign in to [Pushalot](https://pushalot.com/) and copy your authorization token. - -3. Add your authorization token in the field above. - diff --git a/docs/pythonpackages b/docs/pythonpackages deleted file mode 100644 index c1a29b02f..000000000 --- a/docs/pythonpackages +++ /dev/null @@ -1,3 +0,0 @@ -Automatically release Python packages from GitHub to the [Python Package Index](http://pypi.python.org). - -For more information, please see [the docs](http://docs.pythonpackages.com/en/latest/github-service.html). diff --git a/docs/railsbp b/docs/railsbp deleted file mode 100644 index bb9fd27a0..000000000 --- a/docs/railsbp +++ /dev/null @@ -1,14 +0,0 @@ -Railsbp - a code analyzer service for rails projects. - -Install Notes -------------- - -1. Create an account on railsbp.com (just sign in with GitHub) -2. Create a repository on railsbp.com -3. Enter your token - - the token which you can find on repository edit page on railsbp.com -4. Enter your railsbp_url if you deploy the proxy on your own server -5. Check the "Active" checkbox and click "Update Settings" - -For more details about Railsbp, go to https://railsbp.com - diff --git a/docs/railsbrakeman b/docs/railsbrakeman deleted file mode 100644 index fdc2256e0..000000000 --- a/docs/railsbrakeman +++ /dev/null @@ -1,12 +0,0 @@ -RailsBrakeman is an online service to find security issues in your Rails -projects. - -1. Create an account on rails-brakeman.com (just sign in with GitHub) -2. Create a repository on rails-brakeman.com -3. Enter your token - - the token which you can find on repository edit page on rails-brakeman.com -4. Enter your rails_brakeman_url if you deploy the proxy on your own server -5. Check the "Active" checkbox and click "Update Settings" - -For more details about RailsBrakeman, go to https://rails-brakeman.com - diff --git a/docs/rapidpush b/docs/rapidpush deleted file mode 100644 index e951239ac..000000000 --- a/docs/rapidpush +++ /dev/null @@ -1,9 +0,0 @@ -RapidPush is an easy-to-use push notification service. -You can receive notifications from third-party applications like nagios, GitHub or flexget directly to your smartphone. - -Install Notes -------------- -1. Get an account at https://rapidpush.net/signup -2. Install the RapidPush Android App through the Google Play Store and login to your created account -3. Generate an API-Key within the user interface under the API-Key tab and provide this key to the GitHub RapidPush service hook -4. Finished, you can now receive the notifications diff --git a/docs/rationaljazzhub b/docs/rationaljazzhub deleted file mode 100644 index 55c09350f..000000000 --- a/docs/rationaljazzhub +++ /dev/null @@ -1,18 +0,0 @@ -**NOTE: This service has been deprecated by the IBM DevOps Service. Please use the IBM DevOps Service for all new integrations. - -This service integrates GitHub with Rational's JazzHub service (http://hub.jazz.net). The hook automatically adds change set links into the work item specified by the commit message. - -The hook will recognize any of the common work item type names in the commit message and look for a corresponding work item. - -For example: - - "Fix bug 42" - - "Deliver Story 99" - - "[work item 999] fixed some stuff" - -Install Notes -------------- - -The JazzHub hook needs to be configured with your JazzHub login info: - -1. Username - This is the username of the user used to access JazzHub. -2. Password - This is the password of the user used to access JazzHub. diff --git a/docs/redmine b/docs/redmine index aa0f848bb..96985817d 100644 --- a/docs/redmine +++ b/docs/redmine @@ -9,7 +9,7 @@ Install Notes ------------- 1. Download and install Redmine from http://redmine.org -2. Activate "Enable WS for repository management" in the global settings. While there, generate an API key (if neccessary) and copy it. +2. Activate "Enable WS for repository management" in the global settings. While there, generate an API key (if necessary) and copy it. 3. Set your GitHub repository as git repository for a project. 4. Enter the full URL to your Redmine instance as well as the project's identifier and the API key. 5. Check the "Fetch GitHub Commits" option to enable the module. diff --git a/docs/snapci b/docs/snapci deleted file mode 100644 index 62fec8807..000000000 --- a/docs/snapci +++ /dev/null @@ -1,11 +0,0 @@ -[Snap-CI](https://snap-ci.com) will add these hooks automatically to projects which you test using Snap-CI. - - -Install Notes -------------- - -1. Sign up at https://snap-ci.com with your GitHub account -2. Add your repository -3. You're ready! - -For more details about Snap-CI, go to http://docs.snap-ci.com. diff --git a/docs/sqwiggle b/docs/sqwiggle deleted file mode 100644 index b478302c2..000000000 --- a/docs/sqwiggle +++ /dev/null @@ -1,13 +0,0 @@ -This service alerts your colleagues, collaborators and friends of GitHub events -by posting a message into the Sqwiggle room of your choice! - -Install Notes ------------- - -**Token**: You'll need to generate an API Client and paste in the provided token. -(create one here: https://www.sqwiggle.com/company/clients) - -**Room**: (optional) The last part of the url for the room you would like the -messages to appear in e.g sqwiggle.com/company_name/ROOM_ID_HERE. Leave blank if you want to use the default room. - -See https://www.sqwiggle.com/docs for more info on the Sqwiggle API diff --git a/docs/stormpath b/docs/stormpath deleted file mode 100644 index 0d3902fa4..000000000 --- a/docs/stormpath +++ /dev/null @@ -1,14 +0,0 @@ -[Stormpath](http://stormpath.com/) is a User Management API that reduces development time with instant-on, scalable user infrastructure. Stormpath's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application. - -This service will help you update the Single Sign On site configured in Stormpath. In the Stormpath Admin Console, you can specify which branch needs to be synced with Stormpath. - -Install Notes -------------- - -After signing up for Stormpath at https://api.stormpath.com/register: - -1. Log in to the Stormpath Admin Console using the email address and password you used to register with Stormpath. -1. In the top-right corner of the resulting page, visit Settings > My Account. -1. On the Account Details page, under Security Credentials, click Create API Key. -1. Set **API Key ID** to the API Key ID generated by Stormpath -1. Set **API Key Secret** to the API Key Secret generated by Stormpath \ No newline at end of file diff --git a/docs/teamcity b/docs/teamcity index d38132afe..42eb39483 100644 --- a/docs/teamcity +++ b/docs/teamcity @@ -1,7 +1,7 @@ [TeamCity](https://www.jetbrains.com/teamcity/) is a continuous integration server that automates building and testing of your software. The GitHub TeamCity service can be used in two ways: * to trigger builds after code has been pushed to your git repository; (Default) diff --git a/docs/tinypm b/docs/tinypm deleted file mode 100644 index d73e33c55..000000000 --- a/docs/tinypm +++ /dev/null @@ -1,12 +0,0 @@ -This service posts an event object for GitHub events to [tinyPM][tinyPM_link] application. - -[tinyPM][tinyPM_link] is an agile collaboration tool with product management, backlog, taskboard, user stories and wiki. Web-based and internationalized. - - -Install Notes -------------- - -1. You will need to copy your GitHub integration URL. Open your tinyPM and navigate to Application Settings (requires admin access to tinyPM). -2. Don't forget to check **Active** - -[tinyPM_link]: http://www.tinypm.com diff --git a/docs/trajectory b/docs/trajectory deleted file mode 100644 index 13eef5e98..000000000 --- a/docs/trajectory +++ /dev/null @@ -1,7 +0,0 @@ -Install Notes -------------- - -1. api_key: Your api key can be found in this link: https://www.apptrajectory.com/profile/edit - -All you need to do is copy your api key from the application and paste it into the GitHub service configuration. - diff --git a/docs/visualops b/docs/visualops deleted file mode 100644 index 81ee9068d..000000000 --- a/docs/visualops +++ /dev/null @@ -1,13 +0,0 @@ -Trigger a re-deploy of VisualOps apps when you push to GitHub. You can set a list of app_id with correspond branch. - -Install Notes -------------- - -1. You will need to register an account and launch an app in [VisualOps][visualops], and get a token that authorises GitHub to write to the VisualOps API. -2. Supply a list of apps you want to update when you push to GitHub, and the apps are separated by commas. You can specify the git branch for every app with a colon suffix (`app_id:branch`), and the default branch for an app is `master`. The following is an example of App List: - - app-11223344, app-1a2b3c4d:develop, app-12345678:master - - Then the app `app-11223344` and `app-12345678` will be update when you push to `master` branch, and `app-1a2b3c4d` will you push to `develop` branch. And the you can find your app_id in the property pannel of VisualOps IDE - -[visualops]: http://www.visualops.io \ No newline at end of file diff --git a/docs/yammer b/docs/yammer deleted file mode 100644 index 1f73c1500..000000000 --- a/docs/yammer +++ /dev/null @@ -1,5 +0,0 @@ -Install Notes -------------- - -1. Go to the Yammer App Directory and login in the GitHub app. -2. Enter the token above. diff --git a/github-services-1.0.0.bab7cf5.gem b/github-services-1.0.0.bab7cf5.gem deleted file mode 100644 index ab1913fd8..000000000 Binary files a/github-services-1.0.0.bab7cf5.gem and /dev/null differ diff --git a/github-services.gemspec b/github-services.gemspec index 92204fa1e..6f445038c 100644 --- a/github-services.gemspec +++ b/github-services.gemspec @@ -21,11 +21,12 @@ Gem::Specification.new do |spec| spec.licenses = ['MIT'] spec.add_dependency "addressable", "~> 2.3" - spec.add_dependency 'yajl-ruby', '1.1.0' + spec.add_dependency 'yajl-ruby', '>= 1.1.0' spec.add_dependency "mash", "~> 0.1.1" spec.add_dependency "mime-types", "~> 1.15" spec.add_dependency "ruby-hmac", "0.4.0" spec.add_dependency "faraday", "0.9.0" + spec.add_dependency "xmlrpc", "0.2.1" # Basecamp Classic spec.add_dependency "activeresource", "~> 4.0.0" @@ -34,7 +35,7 @@ Gem::Specification.new do |spec| spec.add_dependency "oauth", "0.4.4" # MaxCDN - spec.add_dependency "maxcdn", "~> 0.2.0" + spec.add_dependency "maxcdn", "~> 0.3.2" # Campfire spec.add_dependency "tinder", "1.10.0" @@ -46,7 +47,7 @@ Gem::Specification.new do |spec| spec.add_dependency "mail", "~>2.3" # Jabber - spec.add_dependency "xmpp4r-simple-19", "~> 1.0.0" + spec.add_dependency "xmpp4r", "~> 0.5" # Twilio spec.add_dependency "twilio-ruby", "~> 3.9.0" diff --git a/lib/github-services.rb b/lib/github-services.rb index 46ee912af..b76d5cbdc 100644 --- a/lib/github-services.rb +++ b/lib/github-services.rb @@ -18,18 +18,15 @@ require 'basecamp' require 'mail' require 'xmpp4r' -require 'xmpp4r/jid.rb' -require 'xmpp4r/presence.rb' -require 'xmpp4r/muc.rb' -require 'xmpp4r-simple' -require 'rubyforge' +require 'xmpp4r/jid' +require 'xmpp4r/presence' +require 'xmpp4r/muc' +require 'xmpp4r/roster' require 'oauth' -require 'yammer4r' require 'twilio-ruby' # vendor require 'basecamp' -require 'rubyforge' require 'softlayer/messaging' require 'faraday' diff --git a/lib/service.rb b/lib/service.rb index 2169d6bb2..094ba06a0 100644 --- a/lib/service.rb +++ b/lib/service.rb @@ -484,6 +484,8 @@ def inherited(svc) attr_reader :remote_calls + attr_reader :pre_delivery_callbacks + def initialize(event = :push, data = {}, payload = nil) helper_name = "#{event.to_s.classify}Helpers" if Service.const_defined?(helper_name) @@ -500,6 +502,7 @@ def initialize(event = :push, data = {}, payload = nil) @http = @secrets = @email_config = nil @http_calls = [] @remote_calls = [] + @pre_delivery_callbacks = [] end # Boolean fields as either nil, "0", or "1". @@ -531,6 +534,8 @@ def shorten_url(url) url end + ENABLED_TRANSPORTS = ["", "http", "https"] + # Public: Makes an HTTP GET call. # # url - Optional String URL to request. @@ -560,11 +565,18 @@ def shorten_url(url) # # Yields a Faraday::Request instance. # Returns a Faraday::Response instance. - def http_get(url = nil, params = nil, headers = nil) + def http_get(url = nil, params = {}, headers = {}) + raise_config_error("Invalid scheme") unless permitted_transport?(url) + url = url.strip if url + + if pre_delivery_callbacks.any? + pre_delivery_callbacks.each { |c| c.call(url, nil, headers, params) } + end + http.get do |req| req.url(url) if url - req.params.update(params) if params - req.headers.update(headers) if headers + req.params.update(params) if params.present? + req.headers.update(headers) if headers.present? yield req if block_given? end end @@ -595,9 +607,9 @@ def http_get(url = nil, params = nil, headers = nil) # # Yields a Faraday::Request instance. # Returns a Faraday::Response instance. - def http_post(url = nil, body = nil, headers = nil) + def http_post(url = nil, body = nil, headers = {}, params = {}) block = Proc.new if block_given? - http_method :post, url, body, headers, &block + http_method :post, url, body, headers, params, &block end # Public: Makes an HTTP call. @@ -627,19 +639,32 @@ def http_post(url = nil, body = nil, headers = nil) # # Yields a Faraday::Request instance. # Returns a Faraday::Response instance. - def http_method(method, url = nil, body = nil, headers = nil) + def http_method(method, url = nil, body = nil, headers = {}, params = {}) block = Proc.new if block_given? + url = url.strip if url + raise_config_error("Invalid scheme") unless permitted_transport?(url) + + if pre_delivery_callbacks.any? + pre_delivery_callbacks.each { |c| c.call(url, body, headers, params) } + end + check_ssl do http.send(method) do |req| req.url(url) if url - req.headers.update(headers) if headers + req.headers.update(headers) if headers.present? req.body = body if body + req.params = params if params.present? block.call req if block end end end + def permitted_transport?(url = nil) + ENABLED_TRANSPORTS.include?(http.url_prefix.scheme.to_s.downcase) && + ENABLED_TRANSPORTS.include?(Addressable::URI.parse(url).scheme.to_s.downcase) + end + # Public: Lazily loads the Faraday::Connection for the current Service # instance. # @@ -839,6 +864,14 @@ def reportable_http_env(env, time) } end + def before_delivery(&block) + @pre_delivery_callbacks << block + end + + def reset_pre_delivery_callbacks! + @pre_delivery_callbacks = [] + end + # Raised when an unexpected error occurs during service hook execution. class Error < StandardError attr_reader :original_exception diff --git a/lib/services/CodePorting-C#2Java.rb b/lib/services/CodePorting-C#2Java.rb deleted file mode 100644 index 4481c66cc..000000000 --- a/lib/services/CodePorting-C#2Java.rb +++ /dev/null @@ -1,77 +0,0 @@ -class Service::CodePortingCSharp2Java < Service - string :project_name, :repo_key, :target_repo_key, :codeporting_username - password :codeporting_password, :github_access_token - - self.title = 'CodePorting-C#2Java' - - def receive_push - return if Array(payload['commits']).empty? - - check_configuration_options(data) - - response = nil - token = perform_login - - if token.blank? - response = "Unable to login on codeporting.com at the moment :( " - raise_config_error "#{response}" - end - - response = process_on_codeporting(token) - if response != "True" - raise_config_error 'Porting performed with errors, porting will be performed again on next commit.' - end - - response - end - - def perform_login - http.ssl[:verify] = false - login_url = "https://apps.codeporting.com/csharp2java/v0/UserSignin" - resp = http.post login_url do |req| - req.body = {:LoginName => data['codeporting_username'], :Password => data['codeporting_password']} - end - - doc = REXML::Document.new(resp.body) - retValue = nil - doc.each_element('//return') do |item| - retValue = item.attributes['success'] - end - - if retValue == "True" - token = nil - doc.each_element('//Token') do |item| - token = item.text - end - token - end - end - - def process_on_codeporting(token) - process_url = "https://apps.codeporting.com/csharp2java/v0/githubpluginsupport" - resp = http.post process_url do |req| - req.body = {:token => token, :ProjectName => data['project_name'], - :RepoKey => data['repo_key'], :TarRepoKey => data['target_repo_key'], - :Username => data['codeporting_username'], :Password => data['codeporting_password'], - :GithubAccessToken => data['github_access_token']} - end - - doc = REXML::Document.new(resp.body) - retValue = nil - doc.each_element('//return') do |item| - retValue = item.attributes['success'] - end - retValue - end - - private - - def check_configuration_options(data) - raise_config_error 'Project name must be set' if data['project_name'].blank? - raise_config_error 'Repository is required' if data['repo_key'].blank? - raise_config_error 'Target repository is required' if data['target_repo_key'].blank? - raise_config_error 'Codeporting username must be provided' if data['codeporting_username'].blank? - raise_config_error 'Codeporting password must be provided' if data['codeporting_password'].blank? - raise_config_error 'GitHub Access Token must be provided for commiting changes back to GitHub' if data['github_access_token'].blank? - end -end diff --git a/lib/services/active_collab.rb b/lib/services/active_collab.rb index 601e547bd..64f4ebe21 100644 --- a/lib/services/active_collab.rb +++ b/lib/services/active_collab.rb @@ -36,14 +36,15 @@ def receive_push build_message = statuses * "\n" - http.url_prefix = data['url'] - http.headers['Accept'] = 'application/xml' + url = data['url'] + body = params(push_message, build_message) + headers = {:Accept => 'application/xml'} + params = { + :path_info => "projects/#{data['project_id']}/discussions/add", + :token => data['token'] + } - http.post do |req| - req.params['path_info'] = "projects/#{data['project_id']}/discussions/add" - req.params['token'] = data['token'] - req.body = params(push_message, build_message) - end + http_post url, body, headers, params end def params(name, message) diff --git a/lib/services/agilezen.rb b/lib/services/agilezen.rb deleted file mode 100644 index 47e285947..000000000 --- a/lib/services/agilezen.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Service::AgileZen < Service - string :api_key, :project_id, :branches - white_list :project_id, :branches - - def receive_push - raise_config_error "Missing 'api_key'" if data['api_key'].to_s == '' - raise_config_error "Missing 'project_id'" if data['project_id'].to_s == '' - - branches = data['branches'].to_s.split(/\s+/) - ref = payload["ref"].to_s - return unless branches.empty? || branches.include?(ref.split("/").last) - - http.headers['X-Zen-ApiKey'] = data['api_key'] - http.headers['Content-Type'] = 'application/json' - - res = http_post "https://agilezen.com/api/v1/projects/#{data['project_id']}/changesets/github", - generate_json(payload) - - if res.status < 200 || res.status > 299 - raise_config_error - end - end -end diff --git a/lib/services/asana.rb b/lib/services/asana.rb index eb54aa4b6..0ab2986cf 100644 --- a/lib/services/asana.rb +++ b/lib/services/asana.rb @@ -2,7 +2,7 @@ class Service::Asana < Service password :auth_token string :restrict_to_branch boolean :restrict_to_last_commit - white_list :restrict_to_branch, :restrict_to_last_comment + white_list :restrict_to_branch, :restrict_to_last_commit def receive_push # make sure we have what we need @@ -12,7 +12,7 @@ def receive_push branch = payload['ref'].split('/').last branch_restriction = data['restrict_to_branch'].to_s - commit_restriction = config_boolean_true?('restrict_to_last_comment') + commit_restriction = config_boolean_true?('restrict_to_last_commit') # check the branch restriction is poplulated and branch is not included if branch_restriction.length > 0 && branch_restriction.index(branch) == nil diff --git a/lib/services/aws_ops_works.rb b/lib/services/aws_ops_works.rb index fc8cc5263..bf5007af9 100644 --- a/lib/services/aws_ops_works.rb +++ b/lib/services/aws_ops_works.rb @@ -6,6 +6,7 @@ class Service::AwsOpsWorks < Service::HttpPost string :app_id, # see AppId at http://docs.aws.amazon.com/opsworks/latest/APIReference/API_App.html :stack_id, # see StackId at http://docs.aws.amazon.com/opsworks/latest/APIReference/API_Stack.html :branch_name, # see Revision at http://docs.aws.amazon.com/opsworks/latest/APIReference/API_Source.html + :endpoint_region, # see AWS Opsworks Stacks at http://docs.aws.amazon.com/general/latest/gr/rande.html#opsworks_region :github_api_url, # The GitHub API endpoint to post DeploymentStatus callbacks to :aws_access_key_id # see AWSAccessKeyID at http://docs.aws.amazon.com/opsworks/latest/APIReference/CommonParameters.html password :aws_secret_access_key, :github_token @@ -13,6 +14,7 @@ class Service::AwsOpsWorks < Service::HttpPost white_list :app_id, :stack_id, :branch_name, + :endpoint_region, :github_api_url, :aws_access_key_id @@ -139,8 +141,13 @@ def create_deployment end def ops_works_client + region = config_value('endpoint_region') + # The AWS library requires you pass `nil`, and not an empty string, if you + # want to connect to a legitimate default AWS host name. + region = nil if region.empty? AWS::OpsWorks::Client.new access_key_id: required_config_value('aws_access_key_id'), - secret_access_key: required_config_value('aws_secret_access_key') + secret_access_key: required_config_value('aws_secret_access_key'), + region: region end def github_api_url diff --git a/lib/services/basecamp.rb b/lib/services/basecamp.rb index d59120ec3..7f450b05b 100644 --- a/lib/services/basecamp.rb +++ b/lib/services/basecamp.rb @@ -7,8 +7,6 @@ class Service::Basecamp < Service white_list :project_url, :email_address default_events :push, :pull_request, :issues - self.hook_name = 'bcx' - def receive_push commit = payload['commits'].last || {} author = commit['author'] || commit['committer'] || payload['pusher'] diff --git a/lib/services/boxcar.rb b/lib/services/boxcar.rb deleted file mode 100644 index 6fb5db036..000000000 --- a/lib/services/boxcar.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Service::Boxcar < Service - string :subscribers - white_list :subscribers - - def receive_push - http_post \ - "http://providers.boxcar.io/github/%s" % - [secrets['boxcar']['apikey']], - :emails => data['subscribers'], - :payload => generate_json(payload) - end -end diff --git a/lib/services/circleci.rb b/lib/services/circleci.rb deleted file mode 100644 index c9500a4d2..000000000 --- a/lib/services/circleci.rb +++ /dev/null @@ -1,35 +0,0 @@ -class Service::Circleci < Service - self.title = "CircleCI" - url "https://circleci.com" - logo_url "https://circleci.com/favicon.ico" - - maintained_by :github => 'circleci' - supported_by :web => 'https://circleci.com/about', - :email => 'sayhi@circleci.com' - - default_events Service::ALL_EVENTS - - string :domain - white_list :domain - - def receive_event - http.headers['content-type'] = 'application/x-www-form-urlencoded' - http_post circleci_url, - "payload" => generate_json(payload), - "event_type" => generate_json(:event_type => event) - end - - private - - def circleci_url - "#{domain}/hooks/github" - end - - def domain - if data['domain'].present? - data['domain'].sub(%r{/+$}, '') - else - 'https://circleci.com' - end - end -end diff --git a/lib/services/co_op.rb b/lib/services/co_op.rb deleted file mode 100644 index 6de6d9e32..000000000 --- a/lib/services/co_op.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Service::CoOp < Service - string :group_id - password :token - white_list :group_id - - self.title = 'Co-Op' - - def receive_push - repository = payload['repository']['name'] - payload['commits'].each do |commit| - status = "#{commit['author']['name']} just committed a change to #{repository} on GitHub: #{commit['message']} (#{commit['url']})" - res = http_post "http://coopapp.com/groups/%s/notes" % [data['group_id']], - generate_json(:status => status, :key => data['token']), - 'Accept' => 'application/json', - 'Content-Type' => 'application/json; charset=utf-8', - 'User-Agent' => 'GitHub Notifier' - - if res.status >= 400 - raise_config_error - end - end - end -end diff --git a/lib/services/coffeedocinfo.rb b/lib/services/coffeedocinfo.rb deleted file mode 100644 index ba59eb493..000000000 --- a/lib/services/coffeedocinfo.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Service::CoffeeDocInfo < Service::HttpPost - self.title = 'CoffeeDoc.info' - - default_events :push - - url "http://coffeedoc.info/" - - maintained_by :github => 'pwnall', :twitter => '@pwnall' - - supported_by :web => 'https://github.com/netzpirat/coffeedoc.info', - :twitter => 'netzpirat', :github => 'netzpirat' - - def receive_event - url = 'http://coffeedoc.info/checkout' - deliver url - end -end diff --git a/lib/services/cube.rb b/lib/services/cube.rb deleted file mode 100644 index 92cb7d26f..000000000 --- a/lib/services/cube.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Service::Cube < Service - string :domain, :project - password :token - white_list :domain, :project - - def receive_push - http_post "http://cube.bitrzr.com/integration/events/github/create", - 'payload' => generate_json(payload), - 'project_name' => data['project'], - 'project_token' => data['token'], - 'domain' => data['domain'] - end -end diff --git a/lib/services/depending.rb b/lib/services/depending.rb deleted file mode 100644 index 86b5190da..000000000 --- a/lib/services/depending.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Service::Depending < Service - password :token - - url "http://depending.in/" - - maintained_by :github => 'toopay' - - def receive_push - http.ssl[:verify] = false - http.basic_auth "github", token - http_post "http://depending.in/hook", :payload => generate_json(payload) - end - - def token - data["token"].to_s.strip - end - -end diff --git a/lib/services/distiller.rb b/lib/services/distiller.rb deleted file mode 100644 index 13503ead6..000000000 --- a/lib/services/distiller.rb +++ /dev/null @@ -1,24 +0,0 @@ -class Service::Distiller < Service::HttpPost - self.title = "Distiller" - url "http://distiller.io" - logo_url "http://www.distiller.io/favicon.ico" - - maintained_by :github => 'travis' - supported_by :web => 'http://distiller.io/chat', - :email => 'help@distiller.io' - - default_events :push - - def receive_event - http.headers['content-type'] = 'application/x-www-form-urlencoded' - http_post distiller_url, - "payload" => generate_json(payload), - "event_type" => generate_json(:event_type => event) - end - - private - - def distiller_url - "https://www.distiller.io/hooks/github" - end -end diff --git a/lib/services/email.rb b/lib/services/email.rb index 3be8f2c17..2d4e8b587 100644 --- a/lib/services/email.rb +++ b/lib/services/email.rb @@ -192,7 +192,12 @@ def mail_body body << compare_text unless single_commit? - body + body << <<-NOTE + + **NOTE:** GitHub Services has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ + + We will provide an alternative path for the email notifications by January 31st, 2019. + NOTE end # Public diff --git a/lib/services/hall.rb b/lib/services/hall.rb deleted file mode 100644 index da3f7292e..000000000 --- a/lib/services/hall.rb +++ /dev/null @@ -1,19 +0,0 @@ -class Service::Hall < Service - - default_events :commit_comment, :gollum, :issues, :issue_comment, :pull_request, :push - password :room_token - - # Contributing Assets - url "https://hall.com" - logo_url "https://s3.amazonaws.com/hall-production-assets/assets/media_kit/hall_logo-8b3fb6d39f78ad4b234e684f378b87b7.jpg" - maintained_by :github => 'bhellman1' - supported_by :web => 'https://hallcom.uservoice.com/', :email => 'contact@hall-inc.com', :twitter => 'hall' - - def receive_event - raise_config_error "Missing room token" if data['room_token'].to_s.empty? - room_token = data['room_token'].to_s - - res = http_post "https://hall.com/api/1/services/github/#{room_token}", :payload => generate_json(payload) - end - -end diff --git a/lib/services/honbu.rb b/lib/services/honbu.rb deleted file mode 100644 index f89d8d368..000000000 --- a/lib/services/honbu.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Service::Honbu < Service::HttpPost - password :token - - - default_events :push, :issues, :issue_comment, :commit_comment, - :create, :delete, :pull_request, :follow, :gollum, :fork, - :member, :team_add, :deployment, :deployment_status - - - - url "http://honbu.io" - logo_url "http://honbu.io/assets/honbu-website-logo.png" - - maintained_by :github => 'RedFred7' - - supported_by :web => 'http://honbu.io/company', - :email => 'support@honbu.io' - - def receive_event - token = required_config_value('token') - - http.headers['Authorization'] = "#{token}" - http.headers['X-GitHub-Event'] = event.to_s - - url = "https://integrations.honbu.io/github" - - deliver url - end -end diff --git a/lib/services/jabber.rb b/lib/services/jabber.rb index 82fee2c18..6445b1b8a 100644 --- a/lib/services/jabber.rb +++ b/lib/services/jabber.rb @@ -1,19 +1,8 @@ -# Jabber::Simple does some insane kind of queueing if it thinks -# we are not in their buddy list (which is always) so messages -# never get sent before we disconnect. This forces the library -# to assume the recipient is a buddy. -class ::Jabber::Simple - def subscribed_to?(x); true; end -end - class Service::Jabber < Service string :user white_list :user def receive_push - # Accept any friend request - im.accept_subscriptions = true - #Split multiple addresses into array, removing duplicates recipients = data.has_key?('user') ? data['user'].split(',').each(&:strip!).uniq : [] messages = [] @@ -25,26 +14,43 @@ def receive_push end def deliver_messages(message, recipients) + m = ::Jabber::Message.new(nil, message).set_type(:chat) recipients.each do |recipient| - im.deliver_deferred recipient, message, :chat + m.set_to(recipient) + client.send(m) end + disconnect end - attr_writer :im - def im - @im || @@im ||= build_jabber_connection - end - - def build_jabber_connection - user = secrets['jabber']['user'].to_s - pass = secrets['jabber']['password'].to_s - - if user.empty? || pass.empty? - raise_config_error("Missing Jabber user/pass: #{user.inspect}") + def client + @client ||= begin + user = secrets['jabber']['user'].to_s + pass = secrets['jabber']['password'].to_s + + if user.empty? || pass.empty? + raise_config_error("Missing Jabber user/pass: #{user.inspect}") + end + + jid = ::Jabber::JID.new(user) + client = ::Jabber::Client.new(jid) + client.connect + client.auth(pass) + + roster = ::Jabber::Roster::Helper.new(client, false) + roster.add_subscription_request_callback do |roster_item, presence| + roster.accept_subscription(presence.from) + end + + presence = ::Jabber::Presence.new(nil, "Available") + client.send(presence) + client.send_with_id(::Jabber::Iq.new_rosterget) + client end + end - ::Jabber::Simple.new(secrets['jabber']['user'], secrets['jabber']['password']) - rescue - raise_config_error("Troubles connecting to Jabber: #{user.inspect}") + def disconnect + client.close + @client = nil end + end diff --git a/lib/services/jquery_plugins.rb b/lib/services/jquery_plugins.rb deleted file mode 100644 index 3600132ec..000000000 --- a/lib/services/jquery_plugins.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Service::JqueryPlugins < Service - - self.title = 'jQuery Plugins' - - url "http://plugins.jquery.com/" - - logo_url "http://plugins.jquery.com/jquery-wp-content/themes/jquery/images/logo-jquery.png" - - maintained_by :github => 'dwradcliffe', :twitter => 'dwradcliffe' - - supported_by :email => 'plugins@jquery.com' - - def receive_push - http_post "http://plugins.jquery.com/postreceive-hook", :payload => generate_json(payload) - end - -end diff --git a/lib/services/loggly.rb b/lib/services/loggly.rb deleted file mode 100644 index 8da0f9aa6..000000000 --- a/lib/services/loggly.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Service::Loggly < Service - password :input_token - - def receive_push - http.headers['Content-Type'] = 'application/json' - url = "https://logs.loggly.com/inputs/#{data['input_token']}" - payload['commits'].each { |commit| http_post url, generate_json(commit) } - end -end diff --git a/lib/services/masterbranch.rb b/lib/services/masterbranch.rb deleted file mode 100644 index 8caf78e21..000000000 --- a/lib/services/masterbranch.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Service::Masterbranch < Service - def receive_push - http_post "http://webhooks.masterbranch.com/gh-hook", - :payload => generate_json(payload) - end -end - diff --git a/lib/services/nodejitsu.rb b/lib/services/nodejitsu.rb deleted file mode 100644 index 820dba507..000000000 --- a/lib/services/nodejitsu.rb +++ /dev/null @@ -1,74 +0,0 @@ -# based on the travis.rb service -class Service::Nodejitsu < Service - string :username - password :password - string :branch, :endpoint - boolean :email_success_deploys, :email_errors - white_list :endpoint, :username, :branch, :email_success_deploys, :email_errors - - def receive_push - return if branch.to_s != '' && branch != branch_name - http.ssl[:verify] = false - http.basic_auth username, password - http_post nodejitsu_url, :payload => generate_json(payload), - :email_success => email_success_deploys, :email_errors => email_errors - end - - def nodejitsu_url - "#{scheme}://#{domain}/1/deploy" - end - - def username - if data['username'].to_s == '' - payload['repository']['owner']['name'] - else - data['username'] - end.strip - end - - def branch - if data['branch'].to_s == '' - 'master' - else - data['branch'] - end.strip - end - - def password - if data['password'].to_s == '' - '' - else - data['password'] - end.strip - end - - def email_success_deploys - data['email_success_deploys'] - end - - def email_errors - data['email_errors'] - end - - def scheme - domain_parts.size == 1 ? 'https' : domain_parts.first - end - - def domain - domain_parts.last - end - - protected - - def full_domain - if data['endpoint'].to_s == '' - 'https://webhooks.nodejitsu.com' - else - data['endpoint'] - end.strip - end - - def domain_parts - @domain_parts ||= full_domain.split('://') - end -end diff --git a/lib/services/notifymyandroid.rb b/lib/services/notifymyandroid.rb deleted file mode 100644 index 512573122..000000000 --- a/lib/services/notifymyandroid.rb +++ /dev/null @@ -1,24 +0,0 @@ -class Service::NMA < Service - string :apikey - self.title = 'Notify My Android' - - def receive_push - return unless payload['commits'] - - url = URI.parse('https://www.notifymyandroid.com/publicapi/notify') - repository = payload['repository']['url'].split("/") - event = [repository[-2], repository[-1]].join('/') - application = "GitHub" - description = "#{payload['commits'].length} commits pushed to #{application} (#{payload['commits'][-1]['id'][0..7]}..#{payload['commits'][0]['id'][0..7]}) - - Latest Commit by #{payload['commits'][-1]['author']['name']} - #{payload['commits'][-1]['id'][0..7]} #{payload['commits'][-1]['message']}" - - http_post 'https://www.notifymyandroid.com/publicapi/notify', - :apikey => data['apikey'], - :application => application, - :event => event, - :description => description, - :url => payload['compare'] - end -end diff --git a/lib/services/obs.rb b/lib/services/obs.rb index 15e2d21de..f3f08d635 100644 --- a/lib/services/obs.rb +++ b/lib/services/obs.rb @@ -17,8 +17,8 @@ class Service::Obs < Service::HttpPost def receive_push # required token = required_config_value('token').to_s - url = config_value('url') - url = "https://api.opensuse.org:443" if url.blank? + apiurl = config_value('url') + apiurl = "https://api.opensuse.org:443" if apiurl.blank? # optional. The token may set the package container already. project = config_value('project') @@ -43,7 +43,7 @@ def receive_push http.ssl[:verify] = false http.headers['Authorization'] = "Token #{t.strip}" - url = "#{url}/trigger/runservice" + url = "#{apiurl}/trigger/runservice" unless project.blank? or package.blank? url << "?project=#{CGI.escape(project)}&package=#{CGI.escape(package)}" end diff --git a/lib/services/pushalot.rb b/lib/services/pushalot.rb deleted file mode 100644 index ab8c6cb90..000000000 --- a/lib/services/pushalot.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Service::Pushalot < Service - password :authorization_token - - url "https://pushalot.com" - logo_url "https://pushalot.com/content/images/favicon.png" - maintained_by :github => 'molesinski' - supported_by :web => 'https://pushalot.com/support' - - def receive_push - res = http_post "https://pushalot.com/api/githubhook", - :authorizationToken => authorization_token, - :payload => generate_json(payload) - - if res.status != 200 - raise_config_error - end - end - - def authorization_token - data["authorization_token"].to_s.strip - end -end - diff --git a/lib/services/pythonpackages.rb b/lib/services/pythonpackages.rb deleted file mode 100644 index 59543393e..000000000 --- a/lib/services/pythonpackages.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Service::PythonPackages < Service - def receive_push - http_post "https://pythonpackages.com/github", :payload => generate_json(payload) - end -end diff --git a/lib/services/rails_brakeman.rb b/lib/services/rails_brakeman.rb deleted file mode 100644 index 0a6dcaff3..000000000 --- a/lib/services/rails_brakeman.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Service::RailsBrakeman < Service - string :rails_brakeman_url - password :token - white_list :rails_brakeman_url - - def receive_push - http_post rails_brakeman_url, :token => token, :payload => generate_json(payload) - end - - def rails_brakeman_url - if !(url = data["rails_brakeman_url"].to_s).empty? - url.strip - else - "https://rails-brakeman.com" - end - end - - def token - data['token'].strip - end -end diff --git a/lib/services/railsbp.rb b/lib/services/railsbp.rb deleted file mode 100644 index ba79c33d7..000000000 --- a/lib/services/railsbp.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Service::Railsbp < Service - string :railsbp_url - password :token - white_list :railsbp_url - - def receive_push - http_post railsbp_url, :token => token, :payload => generate_json(payload) - end - - def railsbp_url - if !(url = data["railsbp_url"].to_s).empty? - url.strip - else - "https://railsbp.com" - end - end - - def token - data['token'].strip - end -end diff --git a/lib/services/rally.rb b/lib/services/rally.rb index 5faed0dff..6d5ee0f0e 100644 --- a/lib/services/rally.rb +++ b/lib/services/rally.rb @@ -120,7 +120,7 @@ def itemRef(item) end def rallyWorkspaces() - response = @http.get('Subscription.js?fetch=Name,Workspaces,Workspace&pretty=true') + response = http_get('Subscription.js?fetch=Name,Workspaces,Workspace&pretty=true') raise_config_error('Config error: credentials not valid for Rally endpoint') if response.status == 401 raise_config_error('Config error: unable to obtain your Rally subscription info') unless response.success? qr = JSON.parse(response.body) @@ -137,7 +137,7 @@ def rallyQuery(entity, fields, criteria) target_url = '%s.js?fetch=%s' % [entity.downcase, fields] target_url += '&query=(%s)' % [criteria] if criteria.length > 0 target_url += '&workspace=%s' % [@wksp_ref] - res = @http.get(target_url) + res = http_get(target_url) raise StandardError("Config Error: #{entity} query failed") unless res.success? qr = JSON.parse(res.body)['QueryResult'] item = qr['TotalResultCount'] > 0 ? qr['Results'][0] : nil @@ -148,7 +148,7 @@ def rallyQuery(entity, fields, criteria) def rallyCreate(entity, data) create_url = "%s/create.js?workspace=%s" % [entity, @wksp_ref] payload = {"#{entity}" => data} - res = @http.post(create_url, generate_json(payload)) + res = http_post(create_url,generate_json(payload)) raise_config_error("Unable to create the Rally #{entity} for #{data['Name']}") unless res.success? cr = JSON.parse(res.body)['CreateResult'] item = cr['Object'] diff --git a/lib/services/rapidpush.rb b/lib/services/rapidpush.rb deleted file mode 100644 index 9241977b8..000000000 --- a/lib/services/rapidpush.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Service::RapidPush < Service - string :apikey - - def receive_push - http.ssl[:verify] = false - http_post "https://rapidpush.net/api/github/#{apikey}", :payload => generate_json(payload) - end - - def apikey - data["apikey"].to_s.strip - end -end diff --git a/lib/services/rational_jazzhub.rb b/lib/services/rational_jazzhub.rb deleted file mode 100644 index a686a9c90..000000000 --- a/lib/services/rational_jazzhub.rb +++ /dev/null @@ -1,33 +0,0 @@ -class Service::RationalJazzHub < Service::HttpPost - string :username - password :password - string :override_server_url - white_list :username - - def receive_push - username = required_config_value('username') - password = required_config_value('password') - override_server_url = data['override_server_url'] - server_url = (override_server_url.nil? || override_server_url.empty? ? "https://hub.jazz.net/manage" : override_server_url) - post_url = "#{server_url}/processGitHubPayload" - @request = {:username => username, :server_url => server_url, :url => post_url} - @response = deliver post_url - verify_post_response - end - - def verify_post_response - case @response.status - when 200, 201, 304 - # OK - when 401 then - raise_config_error("Authentication failed for #{@request[:username]}: Status=#{@response.status}, Message=#{@response.body}") - when 403 then - raise_config_error("Authorization failure: Status=#{@response.status}, Message=#{@response.body}") - when 404 then - raise_config_error("Invalid git repo URL provided: Status=#{@response.status}, Message=#{@response.body}") - else - raise_config_error("HTTP Error: Status=#{@response.status}, Message=#{@response.body}") - end - end - -end diff --git a/lib/services/redmine.rb b/lib/services/redmine.rb index 9442b3766..b64eb49a7 100644 --- a/lib/services/redmine.rb +++ b/lib/services/redmine.rb @@ -24,13 +24,13 @@ def receive_push message = commit['message'].clone #Extract issue IDs and send update to the related issues - while !(id= message[/#(\d)+/]).nil? do + while !(id= message[/#(\d)+/]).nil? do message.gsub!(id,'') issue_no = id.gsub('#','') # Send the commit information to the related issue on redmine http.url_prefix = data['address'] - + http_method :put, "issues/#{issue_no}.json" do |req| req.headers['Content-Type'] = 'application/json' req.headers['X-Redmine-API-Key'] = data['api_key'] @@ -38,12 +38,12 @@ def receive_push end end end - return true + return true rescue SocketError => se - puts "SocketError has occured: #{se.inspect}" + puts "SocketError has occurred: #{se.inspect}" return false rescue Exception => e - puts "Other Exception has occured: #{e.inspect}" + puts "Other Exception has occurred: #{e.inspect}" return false end end @@ -52,7 +52,7 @@ def receive_push private def check_configuration_options(data) raise_config_error 'Redmine url must be set' if data['address'].blank? - raise_config_error 'API key is required' if data['api_key'].blank? + raise_config_error 'API key is required' if data['api_key'].blank? end def fetch_github_commits_enabled? @@ -64,7 +64,7 @@ def update_issues_enabled? end #Extract and buffer the needed commit information into one string - def commit_text(commit) + def commit_text(commit) gitsha = commit['id'] added = commit['added'].map { |f| ['A', f] } removed = commit['removed'].map { |f| ['R', f] } diff --git a/lib/services/snapci.rb b/lib/services/snapci.rb deleted file mode 100644 index 7c84aebc5..000000000 --- a/lib/services/snapci.rb +++ /dev/null @@ -1,11 +0,0 @@ -require File.expand_path('../web', __FILE__) - -class Service::Snapci < Service::Web - self.title = "Snap CI" - url "https://snap-ci.com" - logo_url "https://snap-ci.com/assets/favicons/snap.ico" - - supported_by :web => 'https://snap-ci.com/contact-us', :email => 'snap-ci@thoughtworks.com' - maintained_by :github => 'snap-ci' - default_events :push, :member -end diff --git a/lib/services/sqwiggle.rb b/lib/services/sqwiggle.rb deleted file mode 100644 index 23bf5a6fa..000000000 --- a/lib/services/sqwiggle.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Service::Sqwiggle < Service::HttpPost - password :token - string :room - - # only include 'room' in the debug logs, skip the api token. - white_list :room - - #accept all events and filter on sqwiggle servers so we can add events as - #requested without the need to wait on GitHub PR's - default_events Service::ALL_EVENTS - - url "https://www.sqwiggle.com" - logo_url "https://sqwiggle-assets.s3.amazonaws.com/assets/logo-header-b4bc3b6e82e42a0beb96b7fa413537f6.png" - - maintained_by :github => 'lukeroberts1990', - :twitter => '@lukeroberts1990' - - supported_by :web => 'https://www.sqwiggle.com/help', - :email => 'howdy@sqwiggle.com', - :twitter => '@sqwiggle' - - def receive_event - token = required_config_value('token') - http.basic_auth token, 'X' - - #dev url - # url = "http://localhost:3001/integrations/github/#{data['room']}" - - #production url - url = "https://api.sqwiggle.com:443/integrations/github/#{data['room']}" - - deliver url - end -end diff --git a/lib/services/stormpath.rb b/lib/services/stormpath.rb deleted file mode 100644 index de13a33e5..000000000 --- a/lib/services/stormpath.rb +++ /dev/null @@ -1,40 +0,0 @@ -class Service::Stormpath < Service::HttpPost - - string :api_key_id - password :api_key_secret - white_list :api_key_id - - url "https://stormpath.com" - - maintained_by :github => "lhazlewood" - - default_events :push - - logo_url "https://api.stormpath.com/assets/images/logo_nav.png" - - supported_by :web => 'https://support.stormpath.com', - :email => 'support@stormpath.com', - :twitter => '@goStormpath' - - def receive_event - - id = required_config_value('api_key_id') - secret = required_config_value('api_key_secret') - - http.basic_auth id.to_s, secret.to_s - - res = deliver api_url - - case res.status - when 200..299 - when 401 then raise_config_error("Authentication with a valid API Key is required. The provided Api Key Id/Secret is invalid.") - else raise_config_error("HTTP: #{res.status}") - end - - end - - def api_url - "https://api.stormpath.com/vendors/github/events" - end - -end \ No newline at end of file diff --git a/lib/services/teamcity.rb b/lib/services/teamcity.rb index 6b8369ebf..cd16293cf 100644 --- a/lib/services/teamcity.rb +++ b/lib/services/teamcity.rb @@ -29,16 +29,17 @@ def receive_push raise_config_error "No base url: #{base_url.inspect}" end + http.headers['Content-Type'] = 'application/xml' http.url_prefix = base_url http.basic_auth data['username'].to_s, data['password'].to_s build_type_ids = data['build_type_id'].to_s build_type_ids.split(",").each do |build_type_id| - if check_for_changes_only - # This is undocumented call. TODO: migrate to REST API (TC at least 8.0) - res = http_get "httpAuth/action.html", :checkForChangesBuildType => build_type_id - else - res = http_get "httpAuth/action.html", :add2Queue => build_type_id, :branchName => branch + res = perform_post_request(build_type_id, check_for_changes_only, branch: branch) + + # Hotfix for older TeamCity versions (older than 2017.1.1) where a GET is needed + if res.status == 415 || res.status == 405 + res = perform_get_request(build_type_id, check_for_changes_only, branch: branch) end case res.status @@ -53,4 +54,22 @@ def receive_push raise_config_error "Invalid TeamCity host name" if e.to_s =~ /getaddrinfo: Name or service not known/ raise end + + # This is undocumented call. TODO: migrate to REST API (TC at least 8.0) + def perform_post_request(build_type_id, check_for_changes_only, branch: nil) + if check_for_changes_only + http_post "httpAuth/app/rest/vcs-root-instances/checkingForChangesQueue?locator=buildType:#{build_type_id}" + else + http_post "httpAuth/app/rest/buildQueue", "" + end + end + + # This is undocumented call. TODO: migrate to REST API (TC at least 8.0) + def perform_get_request(build_type_id, check_for_changes_only, branch: nil) + if check_for_changes_only + http_get "httpAuth/action.html", :checkForChangesBuildType => build_type_id + else + http_get "httpAuth/action.html", :add2Queue => build_type_id, :branchName => branch + end + end end diff --git a/lib/services/tinypm.rb b/lib/services/tinypm.rb deleted file mode 100644 index cc631c966..000000000 --- a/lib/services/tinypm.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Service::TinyPM < Service::HttpPost - string :url - # white_list :server - - default_events :push - - url "http://www.tinypm.com" - logo_url "http://www.tinypm.com/images/tinypm_logo.gif" - - maintained_by :github => 'raho', - :email => 'rafal.hotlos@gmail.com' - - supported_by :web => 'http://www.tinypm.com/', - :email => 'support@tinypm.com' - - - def receive_push - server_url = required_config_value('url') - http.headers['Content-Type'] = 'application/json' - http_post(server_url, generate_json(payload)) - end - -end diff --git a/lib/services/trajectory.rb b/lib/services/trajectory.rb deleted file mode 100644 index d619ac0a2..000000000 --- a/lib/services/trajectory.rb +++ /dev/null @@ -1,47 +0,0 @@ -class Service::Trajectory < Service - string :api_key - BASE_URL = "https://www.apptrajectory.com/api/payloads?api_key=" - - def receive_push - send_to_trajectory - end - - def receive_pull_request - send_to_trajectory - end - - private - - def send_to_trajectory - set_http_headers - response = send_post - raise_config_error_for_bad_status(response) - end - - def set_http_headers - http.headers['content-type'] = 'application/json' - end - - def send_post - http_post full_url, json_payload - end - - def full_url - BASE_URL + api_key - end - - def raise_config_error_for_bad_status(response) - if response.status < 200 || response.status > 299 - raise_config_error - end - end - - def api_key - raise_config_error "Missing 'api_key'" if data['api_key'].to_s == '' - data['api_key'].to_s - end - - def json_payload - generate_json(payload) - end -end diff --git a/lib/services/visualops.rb b/lib/services/visualops.rb deleted file mode 100644 index 89f513a07..000000000 --- a/lib/services/visualops.rb +++ /dev/null @@ -1,65 +0,0 @@ -class Service::VisualOps < Service::HttpPost - string :username, :app_list - password :consumer_token - - white_list :username, :app_list - - default_events :push - - url "http://www.visualops.io" - - maintained_by :github => "gnawux", - :twitter => "@gnawux" - - supported_by :email => 'support@visualops.io' - - def receive_event - return unless update_states? - - # Confirm all required config is present - assert_required_credentials - - # Update State - app = push_list(app_list) - if not app.empty? - data.update('app_list' => app) - deliver update_url, :content_type => 'application/json' - end - end - - private - - def update_states? - payload['commits'].size != 0 - end - - def app_list - data['app_list'].split(',').map do |ab_pair| - (app, sep, bx) = ab_pair.strip.partition(":") - branch = bx.empty? ? "master" : bx - [app, branch] - end - end - - def push_list(apps) - apps.keep_if{|x| x[1] == branch_name}.map{|x| x[0]} - end - - def assert_required_credentials - if (consumer_token.empty? || username.empty?) - raise_config_error "You need a user ID and an authorization Token." - end - end - - def update_url - "https://api.visualops.io:443/v1/github" - end - - def consumer_token - data['consumer_token'].to_s - end - - def username - data['username'].to_s - end -end diff --git a/lib/services/yammer.rb b/lib/services/yammer.rb deleted file mode 100644 index 38a1393ef..000000000 --- a/lib/services/yammer.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Service::Yammer < Service - default_events :push, :commit_comment, :pull_request, :pull_request_review_comment, :public - password :token - - def receive_event - http_post "https://yammer-github.herokuapp.com/#{token}/notify/#{event}", :payload => generate_json(payload) - end - - def token - data["token"].to_s.strip - end -end - diff --git a/test/CodePorting-C#2Java_test.rb b/test/CodePorting-C#2Java_test.rb deleted file mode 100644 index 3b7d7a59a..000000000 --- a/test/CodePorting-C#2Java_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class CodePortingCSharp2JavaTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @stubs.post '/csharp2java/v0/UserSignin' do |env| - form = Faraday::Utils.parse_query(env[:body]) - assert_equal 'codeportingtest', form['LoginName'] - assert_equal 'testpassword', form['Password'] - [200, {}, %(MONKEY)] - end - end - - def test_push - @stubs.post '/csharp2java/v0/githubpluginsupport' do |env| - form = Faraday::Utils.parse_query(env[:body]) - assert_equal 'MONKEY', form['token'] - assert_equal 'Test_Project', form['ProjectName'] - assert_equal 'Test', form['RepoKey'] - assert_equal 'TestJava', form['TarRepoKey'] - assert_equal 'codeportingtest', form['Username'] - assert_equal 'testpassword', form['Password'] - assert_equal '0314adcacbb895bd52f3bc6f2f361ebac3ffbfb6', form['GithubAccessToken'] - [200, {}, %()] - end - - svc = service({'project_name' => 'Test_Project', - 'repo_key' => 'Test', - 'target_repo_key' => 'TestJava', - 'codeporting_username' => 'codeportingtest', - 'codeporting_password' => 'testpassword', - 'active' => '1', - 'github_access_token' => '0314adcacbb895bd52f3bc6f2f361ebac3ffbfb6'}, payload) - - assert_equal 3, payload['commits'].size - assert_equal "True", svc.receive_push - end - - def service(*args) - super Service::CodePortingCSharp2Java, *args - end -end diff --git a/test/active_collab_test.rb b/test/active_collab_test.rb index d78a0502e..3dc016096 100644 --- a/test/active_collab_test.rb +++ b/test/active_collab_test.rb @@ -38,6 +38,3 @@ def service(*args) super Service::ActiveCollab, *args end end - - - diff --git a/test/agilezen_test.rb b/test/agilezen_test.rb deleted file mode 100644 index e96a49823..000000000 --- a/test/agilezen_test.rb +++ /dev/null @@ -1,85 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class AgileZenTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_unspecified_branch - payload = {'answer' => 42, 'ref' => 'refs/heads/master'} - @stubs.post '/api/v1/projects/123/changesets/github' do |env| - body = JSON.parse(env[:body]) - assert_equal payload, body - assert_equal 'test_api_key', env[:request_headers]['X-Zen-ApiKey'] - assert_equal 'application/json', env[:request_headers]['Content-Type'] - [200, {}, ''] - end - - svc = service({'api_key' => 'test_api_key', 'project_id' => '123'}, payload) - svc.receive_push - @stubs.verify_stubbed_calls - end - - def test_matching_branch - payload = {"ref" => "refs/heads/foo"} - @stubs.post("/api/v1/projects/123/changesets/github") { |e| [200, {}, ''] } - - svc = service({'api_key' => 'test_api_key', 'project_id' => '123', 'branches' => 'foo'}, payload) - svc.receive_push - @stubs.verify_stubbed_calls - end - - def test_unmatching_branch - payload = {"ref" => "refs/heads/bar"} - @stubs.post("/api/v1/projects/123/changesets/github") { |e| [200, {}, ''] } - - svc = service({'api_key' => 'test_api_key', 'project_id' => '123', 'branches' => 'foo'}, payload) - svc.receive_push - - # Test that no post fired - begin - @stubs.verify_stubbed_calls - rescue RuntimeError - else - assert_true false - end - end - - def test_matching_branch_of_many - payload = {"ref" => "refs/heads/foo"} - @stubs.post("/api/v1/projects/123/changesets/github") { |e| [200, {}, ''] } - - svc = service({'api_key' => 'test_api_key', 'project_id' => '123', 'branches' => 'baz foo'}, payload) - svc.receive_push - @stubs.verify_stubbed_calls - end - - def test_unmatching_branch_of_many - payload = {"ref" => "refs/heads/bar"} - @stubs.post("/api/v1/projects/123/changesets/github") { |e| [200, {}, ''] } - - svc = service({'api_key' => 'test_api_key', 'project_id' => '123', 'branches' => 'baz foo'}, payload) - svc.receive_push - - # Test that no post fired - begin - @stubs.verify_stubbed_calls - rescue RuntimeError - else - assert_true false - end - end - - def test_matching_tag - payload = {"ref" => "refs/tags/foo"} - @stubs.post("/api/v1/projects/123/changesets/github") { |e| [200, {}, ''] } - - svc = service({'api_key' => 'test_api_key', 'project_id' => '123', 'branches' => 'foo'}, payload) - svc.receive_push - @stubs.verify_stubbed_calls - end - - def service(*args) - super Service::AgileZen, *args - end -end diff --git a/test/asana_test.rb b/test/asana_test.rb index 8e9372548..520aae4de 100644 --- a/test/asana_test.rb +++ b/test/asana_test.rb @@ -56,7 +56,7 @@ def test_restricted_comment_commit_push end svc = service( - {'auth_token' => '0000',"restrict_to_last_comment" => "1"}, + {'auth_token' => '0000',"restrict_to_last_commit" => "1"}, modified_payload) svc.receive_push end diff --git a/test/aws_ops_works_test.rb b/test/aws_ops_works_test.rb index a04a48e1b..659bd10dc 100644 --- a/test/aws_ops_works_test.rb +++ b/test/aws_ops_works_test.rb @@ -52,6 +52,11 @@ def test_aws_access_key_id_configured assert_equal sample_data['aws_access_key_id'], config.access_key_id end + def test_region_configured + config = service.ops_works_client.config + assert_equal sample_data['region'], config.ops_works_region + end + def test_aws_access_key_id_missing svc = service(sample_data.except('aws_access_key_id')) assert_raises Service::ConfigurationError do @@ -71,6 +76,12 @@ def test_aws_secret_access_key_missing end end + def test_region_blank + svc = service(sample_data.merge('region' => "")) + config = service.ops_works_client.config + assert_equal sample_data['region'], config.ops_works_region + end + def service(data = sample_data, payload = sample_payload) Service::AwsOpsWorks.new(:push, data, payload) end @@ -81,6 +92,7 @@ def sample_data 'aws_secret_access_key' => '0123456789+0123456789+0123456789+0123456', 'stack_id' => '12345678-1234-1234-1234-123456789012', 'app_id' => '01234567-0123-0123-0123-012345678901', + 'region' => "us-east-1", 'branch_name' => 'default-branch' } end diff --git a/test/boxcar_test.rb b/test/boxcar_test.rb deleted file mode 100644 index 2455b2a15..000000000 --- a/test/boxcar_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class BoxcarTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - svc = service :push, {'subscribers' => 'abc'}, 'a' => 1 - svc.secrets = {'boxcar' => {'apikey' => 'key'}} - - @stubs.post "/github/key" do |env| - assert_match /(^|\&)emails=abc($|\&)/, env[:body] - assert_match /(^|\&)payload=%7B%22a%22%3A1%7D($|\&)/, env[:body] - [200, {}, ''] - end - - svc.receive - - @stubs.verify_stubbed_calls - end - - def service(*args) - super Service::Boxcar, *args - end -end - diff --git a/test/circleci_test.rb b/test/circleci_test.rb deleted file mode 100644 index 5215238f4..000000000 --- a/test/circleci_test.rb +++ /dev/null @@ -1,144 +0,0 @@ -require File.expand_path('../helper', __FILE__) -class CircleciTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - # currently supported events - - # commit_comment create delete download follow fork fork_apply gist gollum - # issue_comment issues member public pull_request push team_add watch - # pull_request_review_comment status - - def test_commit_comment - post_to_service(:commit_comment) - end - - def test_create - post_to_service(:create) - end - - def test_delete - post_to_service(:delete) - end - - def test_download - post_to_service(:download) - end - - def test_follow - post_to_service(:follow) - end - - def test_fork - post_to_service(:fork) - end - - def test_fork_apply - post_to_service(:fork_apply) - end - - def test_gist - post_to_service(:gist) - end - - def test_gollum - post_to_service(:gollum) - end - - def test_issue_comment - post_to_service(:issue_comment) - end - - def test_issues - post_to_service(:issues) - end - - def test_member - post_to_service(:member) - end - - def test_public - post_to_service(:public) - end - - def test_push - post_to_service(:push) - end - - - def test_team_add - post_to_service(:team_add) - end - - def test_watch - post_to_service(:watch) - end - - def test_pull_request_review_comment - post_to_service(:pull_request_review_comment) - end - - def test_status - post_to_service(:status) - end - - def test_supported_events - assert_equal Service::Circleci.supported_events.sort , Service::ALL_EVENTS.sort - assert_equal Service::Circleci.default_events.sort , Service::ALL_EVENTS.sort - end - - def test_custom_domains - svc = service(:push, {'domain' => 'https://e.circleci.com'}, payload) - - @stubs.post "/hooks/github" do |env| - body = Faraday::Utils.parse_query env[:body] - assert_match "https://e.circleci.com/hooks/github", env[:url].to_s - end - - svc.receive_event - end - - def test_custom_domains_trailing_slash - svc = service(:push, {'domain' => 'https://e.circleci.com/'}, payload) - - @stubs.post "/hooks/github" do |env| - body = Faraday::Utils.parse_query env[:body] - assert_match "https://e.circleci.com/hooks/github", env[:url].to_s - end - - svc.receive_event - end - - def test_empty_domain_uses_circleci - svc = service(:push, {'domain' => ''}, payload) - - @stubs.post "/hooks/github" do |env| - body = Faraday::Utils.parse_query env[:body] - assert_match "https://circleci.com/hooks/github", env[:url].to_s - end - - svc.receive_event - end - - private - - def service(*args) - super Service::Circleci, *args - end - - def post_to_service(event_name) - assert Service::ALL_EVENTS.include? event_name.to_s - svc = service(event_name, {}, payload) - - @stubs.post "/hooks/github" do |env| - body = Faraday::Utils.parse_query env[:body] - assert_match "https://circleci.com/hooks/github", env[:url].to_s - assert_match 'application/x-www-form-urlencoded', env[:request_headers]['content-type'] - assert_equal payload, JSON.parse(body["payload"].to_s) - assert_equal event_name.to_s, JSON.parse(body["event_type"].to_s)["event_type"] - end - - svc.receive_event - end -end diff --git a/test/coffeedocinfo_test.rb b/test/coffeedocinfo_test.rb deleted file mode 100644 index 93dcde211..000000000 --- a/test/coffeedocinfo_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class CoffeeDocInfoTest < Service::TestCase - include Service::HttpTestMethods - - def test_push - @stubs.post "/checkout" do |env| - assert_equal 'coffeedoc.info', env[:url].host - body = JSON.parse(env[:body]) - assert_equal 'push', body['event'] - assert_equal 'test', body['payload']['commits'][0]['id'] - [200, {}, ''] - end - - payload = {'commits'=>[{'id'=>'test'}]} - svc = service({}, payload) - svc.receive_event - @stubs.verify_stubbed_calls - end - - def service_class - Service::CoffeeDocInfo - end -end - diff --git a/test/coop_test.rb b/test/coop_test.rb deleted file mode 100644 index 331e417db..000000000 --- a/test/coop_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class CoOpTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - svc = service({'group_id' => 'abc', 'token' => 'def'}, payload) - - num = 0 - @stubs.post "/groups/abc/notes" do |env| - data = JSON.parse env[:body] - assert_match /tom/i, data['status'] - assert_equal 'def', data['key'] - - assert_equal 'GitHub Notifier', env[:request_headers]['User-Agent'] - assert_equal 'application/json; charset=utf-8', - env[:request_headers]['Content-Type'] - assert_equal 'application/json', - env[:request_headers]['Accept'] - - num += 1 - - [200, {}, ''] - end - - svc.receive_push - assert_equal 3, num - - @stubs.verify_stubbed_calls - end - - def service(*args) - super Service::CoOp, *args - end -end - - - diff --git a/test/cube_test.rb b/test/cube_test.rb deleted file mode 100644 index 45869df51..000000000 --- a/test/cube_test.rb +++ /dev/null @@ -1,29 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class CubeTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - url = "/integration/events/github/create" - @stubs.post url do |env| - assert_match /(^|\&)payload=%7B%22a%22%3A1%7D($|\&)/, env[:body] - assert_match "project_name=p", env[:body] - assert_match "project_token=t", env[:body] - assert_match "domain=d", env[:body] - [200, {}, ''] - end - - svc = service( - {'project' => 'p', 'token' => 't', 'domain' => 'd'}, - 'a' => 1) - svc.receive_push - end - - def service(*args) - super Service::Cube, *args - end -end - - diff --git a/test/depending_test.rb b/test/depending_test.rb deleted file mode 100644 index f2d016f27..000000000 --- a/test/depending_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class DependingTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @svc = service(data, payload) - end - - def test_reads_token_from_config - assert_equal "bf215181b5140522137b3d4f6b73544a", @svc.token - end - - def test_strips_whitespace_from_config - svc = service({'token' => 'bf215181b5140522137b3d4f6b73544a '}, payload) - assert_equal 'bf215181b5140522137b3d4f6b73544a', svc.token - end - - def test_post_payload - @stubs.post '/hook' do |env| - assert_equal 'http', env[:url].scheme - assert_equal 'depending.in', env[:url].host - assert_equal basic_auth('github', 'bf215181b5140522137b3d4f6b73544a'), - env[:request_headers]['authorization'] - assert_equal payload, JSON.parse(Faraday::Utils.parse_query(env[:body])['payload']) - end - - @svc.receive_push - end - -private - - def service(*args) - super Service::Depending, *args - end - - def data - { 'token' => 'bf215181b5140522137b3d4f6b73544a' } - end - -end diff --git a/test/distiller_test.rb b/test/distiller_test.rb deleted file mode 100644 index 81e953482..000000000 --- a/test/distiller_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.expand_path('../helper', __FILE__) -class DistillerTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - # currently supported events - - # push - - def test_push - post_to_service(:push) - end - - def test_supported_events - assert_equal Service::Distiller.supported_events.sort , Service::ALL_EVENTS.sort - assert_equal Service::Distiller.default_events.sort , [:push].sort - end - - private - - def service(*args) - super Service::Distiller, *args - end - - def post_to_service(event_name) - assert Service::ALL_EVENTS.include? event_name.to_s - svc = service(event_name, {'token' => 'abc'}, payload) - - @stubs.post "/hooks/github" do |env| - body = Faraday::Utils.parse_query env[:body] - assert_match "https://www.distiller.io/hooks/github", env[:url].to_s - assert_match 'application/x-www-form-urlencoded', env[:request_headers]['content-type'] - assert_equal payload, JSON.parse(body["payload"].to_s) - assert_equal event_name.to_s, JSON.parse(body["event_type"].to_s)["event_type"] - end - - svc.receive_event - end -end diff --git a/test/hall_test.rb b/test/hall_test.rb deleted file mode 100644 index a91a6c6d0..000000000 --- a/test/hall_test.rb +++ /dev/null @@ -1,23 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class HallTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @room_token = "test_token" - end - - def test_push - @stubs.post "/api/1/services/github/#{@room_token}" do |env| - assert_equal 'hall.com', env[:url].host - [200, {}, ''] - end - - svc = service( - {'room_token' => 'test_token'}, payload) - svc.receive_event - end - - def service(*args) - super Service::Hall, *args - end -end diff --git a/test/honbu_test.rb b/test/honbu_test.rb deleted file mode 100644 index 23148a3a7..000000000 --- a/test/honbu_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class HonbuTest < Service::TestCase - include Service::HttpTestMethods - - def test_push - test_token = "0123456789abcde" - - - data = { - 'token' => test_token, - } - - - - payload = {'commits'=>[{'id'=>'test'}]} - svc = service(data, payload) - - @stubs.post "/github" do |env| - body = JSON.parse(env[:body]) - - assert_equal env[:url].host, "integrations.honbu.io" - assert_equal env[:request_headers]['Authorization'], "#{test_token}" - assert_equal env[:request_headers]['X-GitHub-Event'], "push" - assert_equal 'test', body['payload']['commits'][0]['id'] - assert_match 'guid-', body['guid'] - assert_equal data, body['config'] - assert_equal 'push', body['event'] - [200, {}, ''] - end - - svc.receive_event - @stubs.verify_stubbed_calls - end - - def service_class - Service::Honbu - end -end - diff --git a/test/jabber_test.rb b/test/jabber_test.rb deleted file mode 100644 index 31d31c4be..000000000 --- a/test/jabber_test.rb +++ /dev/null @@ -1,53 +0,0 @@ -require File.expand_path('../helper', __FILE__) -require 'stringio' - -class JabberTest < Service::TestCase - class FakeJabber - class Client - attr_reader :conference - def initialize(conference) - @conference = conference - end - def active?() true end - end - - attr_accessor :accept_subscriptions - attr_reader :delivered - - def initialize - @delivered = [] - end - - def deliver_deferred(*args) - @delivered << args - end - end - - def test_push - svc = service({'user' => 'a,b , c , b', 'muc' => 'e,f , g, f'}, payload) - svc.im = FakeJabber.new - svc.receive_push - - assert svc.im.accept_subscriptions - - assert msg = svc.im.delivered.shift - assert_equal 'a', msg[0] - assert_equal :chat, msg[2] - - assert msg = svc.im.delivered.shift - assert_equal 'b', msg[0] - assert_equal :chat, msg[2] - - assert msg = svc.im.delivered.shift - assert_equal 'c', msg[0] - assert_equal :chat, msg[2] - - assert_nil svc.im.delivered.shift - end - - def service(*args) - super Service::Jabber, *args - end -end - - diff --git a/test/jquery_plugins_test.rb b/test/jquery_plugins_test.rb deleted file mode 100644 index 4a092c6c8..000000000 --- a/test/jquery_plugins_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class JqueryPluginsTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - svc = service :push, {}, 'a' => 1 - - @stubs.post "/postreceive-hook" do |env| - assert_equal 'plugins.jquery.com', env[:url].host - data = Faraday::Utils.parse_nested_query(env[:body]) - assert_equal 1, JSON.parse(data['payload'])['a'] - [200, {}, ''] - end - - svc.receive - - @stubs.verify_stubbed_calls - end - - def service(*args) - super Service::JqueryPlugins, *args - end -end - diff --git a/test/loggly_test.rb b/test/loggly_test.rb deleted file mode 100644 index 2aafdbac7..000000000 --- a/test/loggly_test.rb +++ /dev/null @@ -1,22 +0,0 @@ -class LogglyTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - @stubs.post "/inputs/input-foo" do |env| - assert_equal 'application/json', env[:request_headers]['Content-Type'] - assert_equal 'logs.loggly.com', env[:url].host - [200, {}, ''] - end - - svc = service( - {"input_token" => "input-foo"}, - payload) - svc.receive_push - end - - def service(*args) - super Service::Loggly, *args - end -end diff --git a/test/masterbranch_test.rb b/test/masterbranch_test.rb deleted file mode 100644 index 9a343f5e9..000000000 --- a/test/masterbranch_test.rb +++ /dev/null @@ -1,23 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class MasterbranchTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - @stubs.post "/gh-hook" do |env| - assert_equal 'webhooks.masterbranch.com', env[:url].host - assert_match 'payload=%7B%22a%22%3A1%7D', env[:body] - [200, {}, ''] - end - - svc = service({}, :a => 1) - svc.receive_push - end - - def service(*args) - super Service::Masterbranch, *args - end -end - diff --git a/test/nodejitsu_test.rb b/test/nodejitsu_test.rb deleted file mode 100644 index f06ddbc70..000000000 --- a/test/nodejitsu_test.rb +++ /dev/null @@ -1,170 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class NodejitsuTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @svc = service(data, payload) - end - - def test_reads_user_from_data - assert_equal 'kronn', @svc.username - end - - def test_reads_password_from_data - assert_equal "5373dd4a3648b88fa9acb8e46ebc188a", @svc.password - end - - def test_reads_domain_from_data - assert_equal "webhooks.nodejitsu.com", @svc.domain - end - - def test_reads_branch_from_data - assert_equal "master", @svc.branch - end - - def test_reads_email_errors_from_data - assert_equal true, @svc.email_errors - end - - def test_reads_email_success_deploys_from_data - assert_equal false, @svc.email_success_deploys - end - - def test_keeps_http_scheme - svc = service(data.merge({'endpoint' => 'http://example.com'}), payload) - assert_equal 'http', svc.scheme - end - - def test_keeps_domain - svc = service(data.merge({'endpoint' => 'http://example.com'}), payload) - assert_equal 'example.com', svc.domain - end - - def test_constructs_post_receive_url - assert_equal 'https://webhooks.nodejitsu.com/1/deploy', - @svc.nodejitsu_url - end - - def test_posts_payload - @stubs.post '/1/deploy' do |env| - assert_equal 'webhooks.nodejitsu.com', env[:url].host - assert_equal basic_auth('kronn', '5373dd4a3648b88fa9acb8e46ebc188a'), - env[:request_headers]['authorization'] - end - @svc.receive_push - end - - def test_strips_whitespace_from_form_values - data = { - 'username' => 'kronn ', - 'password' => '5373dd4a3648b88fa9acb8e46ebc188a ', - 'endpoint' => 'hooks.nodejitsu.com ', - 'branch' => 'integration ' - } - - svc = service(data, payload) - assert_equal 'kronn', svc.username - assert_equal '5373dd4a3648b88fa9acb8e46ebc188a', svc.password - assert_equal 'hooks.nodejitsu.com', svc.domain - assert_equal 'https', svc.scheme - assert_equal 'integration', svc.branch - end - - def test_handles_blank_strings_without_errors - data = { - 'username' => '', - 'password' => '5373dd4a3648b88fa9acb8e46ebc188a', - 'domain' => '', - 'branch' => '' - } - - svc = service(data, payload) - assert_equal 'mojombo', svc.username - assert_equal '5373dd4a3648b88fa9acb8e46ebc188a', svc.password - assert_equal 'webhooks.nodejitsu.com', svc.domain - assert_equal 'https', svc.scheme - assert_equal 'master', svc.branch - end - - def test_infers_user_from_repo_data - svc = service(data.reject{|key,v| key == 'username'}, payload) - assert_equal "mojombo", svc.username - end - - def test_defaults_to_https_scheme - assert_equal 'https', @svc.scheme - end - - def test_defaults_to_nodejitsu_domain - svc = service(data.reject{|key,v| key == 'domain'}, payload) - assert_equal "webhooks.nodejitsu.com", svc.domain - end - - def service(*args) - super Service::Nodejitsu, *args - end - - def data - { - 'username' => 'kronn', - 'password' => '5373dd4a3648b88fa9acb8e46ebc188a', - 'domain' => 'webhooks.nodejitsu.com', - 'branch' => 'master', - 'email_success_deploys' => false, - 'email_errors' => true - } - end - - def payload - { - "after" => "a47fd41f3aa4610ea527dcc1669dfdb9c15c5425", - "ref" => "refs/heads/master", - "before" => "4c8124ffcf4039d292442eeccabdeca5af5c5017", - "compare" => "http://github.com/mojombo/grit/compare/4c8124ffcf4039d292442eeccabdeca5af5c5017...a47fd41f3aa4610ea527dcc1669dfdb9c15c5425", - "forced" => false, - "created" => false, - "deleted" => false, - "repository" => { - "name" => "grit", - "url" => "http://github.com/mojombo/grit", - "owner" => { "name" => "mojombo", "email" => "tom@mojombo.com" } - }, - "commits" => [ - { - "distinct" => true, - "removed" => [], - "message" => "[#WEB-249 status:31 resolution:1] stub git call for Grit#heads test", - "added" => [], - "timestamp" => "2007-10-10T00:11:02-07:00", - "modified" => ["lib/grit/grit.rb", "test/helper.rb", "test/test_grit.rb"], - "url" => "http://github.com/mojombo/grit/commit/06f63b43050935962f84fe54473a7c5de7977325", - "author" => { "name" => "Tom Preston-Werner", "email" => "tom@mojombo.com" }, - "id" => "06f63b43050935962f84fe54473a7c5de7977325" - }, - { - "distinct" => true, - "removed" => [], - "message" => "clean up heads test", - "added" => [], - "timestamp" => "2007-10-10T00:18:20-07:00", - "modified" => ["test/test_grit.rb"], - "url" => "http://github.com/mojombo/grit/commit/5057e76a11abd02e83b7d3d3171c4b68d9c88480", - "author" => { "name" => "Tom Preston-Werner", "email" => "tom@mojombo.com" }, - "id" => "5057e76a11abd02e83b7d3d3171c4b68d9c88480" - }, - { - "distinct" => true, - "removed" => [], - "message" => "add more comments throughout", - "added" => [], - "timestamp" => "2007-10-10T00:50:39-07:00", - "modified" => ["lib/grit.rb", "lib/grit/commit.rb", "lib/grit/grit.rb"], - "url" => "http://github.com/mojombo/grit/commit/a47fd41f3aa4610ea527dcc1669dfdb9c15c5425", - "author" => { "name" => "Tom Preston-Werner", "email" => "tom@mojombo.com" }, - "id" => "a47fd41f3aa4610ea527dcc1669dfdb9c15c5425" - } - ] - } - end -end - diff --git a/test/notifymyandroid_test.rb b/test/notifymyandroid_test.rb deleted file mode 100644 index d793338dd..000000000 --- a/test/notifymyandroid_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class NMATest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - @stubs.post "/publicapi/notify" do |env| - assert_equal 'www.notifymyandroid.com', env[:url].host - data = Faraday::Utils.parse_query(env[:body]) - assert_equal 'a', data['apikey'] - [200, {}, ''] - end - - svc = service({'apikey' => 'a'}, payload) - svc.receive_push - end - - def service(*args) - super Service::NMA, *args - end -end - diff --git a/test/pushalot_test.rb b/test/pushalot_test.rb deleted file mode 100644 index bff7e83c0..000000000 --- a/test/pushalot_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class PushalotTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @svc = service(data, payload) - end - - def test_reads_token_from_data - assert_equal "be82304d88d74eb884e384a98a282b8a", @svc.authorization_token - end - - def test_strips_whitespace_from_token - svc = service({'authorization_token' => 'be82304d88d74eb884e384a98a282b8a '}, payload) - assert_equal 'be82304d88d74eb884e384a98a282b8a', svc.authorization_token - end - - def test_posts_payload - @stubs.post '/api/githubhook' do |env| - assert_equal 'https', env[:url].scheme - assert_equal 'pushalot.com', env[:url].host - data = Faraday::Utils.parse_query(env[:body]) - assert_equal "be82304d88d74eb884e384a98a282b8a", data["authorizationToken"] - assert_equal payload, JSON.parse(data['payload']) - [200, {}, 'ok'] - end - - @svc.receive_push - end - -private - - def service(*args) - super Service::Pushalot, *args - end - - def data - { 'authorization_token' => 'be82304d88d74eb884e384a98a282b8a' } - end - -end - diff --git a/test/pythonpackages_test.rb b/test/pythonpackages_test.rb deleted file mode 100644 index 95d9a912e..000000000 --- a/test/pythonpackages_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class PythonPackagesTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - @stubs.post "/github" do |env| - assert_equal 'pythonpackages.com', env[:url].host - data = Faraday::Utils.parse_query(env[:body]) - assert_equal 1, JSON.parse(data['payload'])['a'] - [200, {}, ''] - end - - svc = service({}, :a => 1) - svc.receive_push - end - - def service(*args) - super Service::PythonPackages, *args - end -end - diff --git a/test/rails_brakeman_test.rb b/test/rails_brakeman_test.rb deleted file mode 100644 index 5f7833d48..000000000 --- a/test/rails_brakeman_test.rb +++ /dev/null @@ -1,87 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class RailsBrakemanTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @svc = service(data, payload) - end - - def test_reads_token_from_data - assert_equal "xAAQZtJhYHGagsed1kYR", @svc.token - end - - def test_reads_default_rails_brakeman_url_from_data - assert_equal "https://rails-brakeman.com", @svc.rails_brakeman_url - end - - def test_reads_custom_rails_brakeman_url_from_data - data = { "token" => "xAAQZtJhYHGagsed1kYR", "rails_brakeman_url" => "http://rails-brakeman.heroku.com" } - svc = service(data, payload) - assert_equal "http://rails-brakeman.heroku.com", svc.rails_brakeman_url - end - - def test_strips_whitespace_from_form_values - data = { "token" => " xAAQZtJhYHGagsed1kYR ", "rails_brakeman_url" => " http://rails-brakeman.heroku.com " } - svc = service(data, payload) - assert_equal "xAAQZtJhYHGagsed1kYR", svc.token - assert_equal "http://rails-brakeman.heroku.com", svc.rails_brakeman_url - end - - def test_posts_payload - @stubs.post "/" do |env| - assert_equal payload, JSON.parse(Faraday::Utils.parse_query(env[:body])['payload']) - end - @svc.receive_push - end - - def service(*args) - super Service::RailsBrakeman, *args - end - - def data - { "token" => "xAAQZtJhYHGagsed1kYR", 'rails_brakeman_url' => '' } - end - - def payload - { - "before" => "a6ab010bc21151e238c73d5229c36892d51c2d4f", - "repository" => { - "url" => "https =>//github.com/flyerhzm/rails-brakeman.com", - "name" => "rails-brakeman.com", - "description" => "rails-brakeman.com", - "watchers" => 1, - "forks" => 1, - "private" => 0, - "owner" => { - "email" => "flyerhzm@gmail.com", - "name" => "Richard Huang" - } - }, - "commits" => [ - { - "id" => "af9718a9bee64b9bbbefc4c9cf54c4cc102333a8", - "url" => "https =>//github.com/flyerhzm/rails-brakeman.com/commit/af9718a9bee64b9bbbefc4c9cf54c4cc102333a8", - "author" => { - "email" => "flyerhzm@gmail.com", - "name" => "Richard Huang" - }, - "message" => "fix typo in .travis.yml", - "timestamp" => "2011-12-25T18 =>57 =>17+08 =>00", - "modified" => [".travis.yml"] - }, - { - "id" => "473d12b3ca40a38f12620e31725922a9d88b5386", - "url" => "https =>//github.com/flyerhzm/rails-brakeman.com/commit/473d12b3ca40a38f12620e31725922a9d88b5386", - "author" => { - "email" => "flyerhzm@gmail.com", - "name" => "Richard Huang" - }, - "message" => "copy config yaml files for travis", - "timestamp" => "2011-12-25T20 =>36 =>34+08 =>00" - } - ], - "after" => "473d12b3ca40a38f12620e31725922a9d88b5386", - "ref" => "refs/heads/master" - } - end -end diff --git a/test/railsbp_test.rb b/test/railsbp_test.rb deleted file mode 100644 index b0aeeeaaf..000000000 --- a/test/railsbp_test.rb +++ /dev/null @@ -1,87 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class RailsbpTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @svc = service(data, payload) - end - - def test_reads_token_from_data - assert_equal "xAAQZtJhYHGagsed1kYR", @svc.token - end - - def test_reads_default_railsbp_url_from_data - assert_equal "https://railsbp.com", @svc.railsbp_url - end - - def test_reads_custom_railsbp_url_from_data - data = { "token" => "xAAQZtJhYHGagsed1kYR", "railsbp_url" => "http://railsbp.heroku.com" } - svc = service(data, payload) - assert_equal "http://railsbp.heroku.com", svc.railsbp_url - end - - def test_strips_whitespace_from_form_values - data = { "token" => " xAAQZtJhYHGagsed1kYR ", "railsbp_url" => " http://railsbp.heroku.com " } - svc = service(data, payload) - assert_equal "xAAQZtJhYHGagsed1kYR", svc.token - assert_equal "http://railsbp.heroku.com", svc.railsbp_url - end - - def test_posts_payload - @stubs.post "/" do |env| - assert_equal payload, JSON.parse(Faraday::Utils.parse_query(env[:body])['payload']) - end - @svc.receive_push - end - - def service(*args) - super Service::Railsbp, *args - end - - def data - { "token" => "xAAQZtJhYHGagsed1kYR", 'railsbp_url' => '' } - end - - def payload - { - "before" => "a6ab010bc21151e238c73d5229c36892d51c2d4f", - "repository" => { - "url" => "https =>//github.com/railsbp/rails-bestpractices.com", - "name" => "rails-bestpractice.com", - "description" => "rails-bestpractices.com", - "watchers" => 64, - "forks" => 14, - "private" => 0, - "owner" => { - "email" => "flyerhzm@gmail.com", - "name" => "Richard Huang" - } - }, - "commits" => [ - { - "id" => "af9718a9bee64b9bbbefc4c9cf54c4cc102333a8", - "url" => "https =>//github.com/railsbp/rails-bestpractices.com/commit/af9718a9bee64b9bbbefc4c9cf54c4cc102333a8", - "author" => { - "email" => "flyerhzm@gmail.com", - "name" => "Richard Huang" - }, - "message" => "fix typo in .travis.yml", - "timestamp" => "2011-12-25T18 =>57 =>17+08 =>00", - "modified" => [".travis.yml"] - }, - { - "id" => "473d12b3ca40a38f12620e31725922a9d88b5386", - "url" => "https =>//github.com/railsbp/rails-bestpractices.com/commit/473d12b3ca40a38f12620e31725922a9d88b5386", - "author" => { - "email" => "flyerhzm@gmail.com", - "name" => "Richard Huang" - }, - "message" => "copy config yaml files for travis", - "timestamp" => "2011-12-25T20 =>36 =>34+08 =>00" - } - ], - "after" => "473d12b3ca40a38f12620e31725922a9d88b5386", - "ref" => "refs/heads/master" - } - end -end diff --git a/test/rapidpush_test.rb b/test/rapidpush_test.rb deleted file mode 100644 index 801a49579..000000000 --- a/test/rapidpush_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class RapidPushTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_push - @stubs.post "/api/github/a" do |env| - assert_equal 'rapidpush.net', env[:url].host - data = Faraday::Utils.parse_query(env[:body]) - assert_equal payload.to_json, data['payload'] - [200, {}, ''] - end - - svc = service({'apikey' => 'a'}, payload) - svc.receive_push - end - - def service(*args) - super Service::RapidPush, *args - end -end - diff --git a/test/rational_jazzhub_test.rb b/test/rational_jazzhub_test.rb deleted file mode 100644 index 49748ebea..000000000 --- a/test/rational_jazzhub_test.rb +++ /dev/null @@ -1,73 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class RationalJazzhubTest < Service::TestCase - def setup - @stubs= Faraday::Adapter::Test::Stubs.new - @Pushes= 0 - end - - def test_push - svc = service( - {'username' => username, - 'password' => password}, - payload) - - @stubs.post "/manage/processGitHubPayload" do |env| - assert_equal 'hub.jazz.net', env[:url].host - params = Faraday::Utils.parse_nested_query(env[:url].query) - refute params - @Pushes += 1 - [200, {}, ''] - end - svc.receive_push - assert_equal 1, @Pushes - end - - def test_push_empty_server_override - svc = service( - {'username' => username, - 'password' => password, - 'override_server_url' => ""}, - payload) - - @stubs.post "/manage/processGitHubPayload" do |env| - assert_equal 'hub.jazz.net', env[:url].host - params = Faraday::Utils.parse_nested_query(env[:url].query) - refute params - @Pushes += 1 - [200, {}, ''] - end - svc.receive_push - assert_equal 1, @Pushes - end - - def test_push_server_override - svc = service( - {'username' => username, - 'password' => password, - 'override_server_url' => "https://test.example.org/foo"}, - payload) - - @stubs.post "/foo/processGitHubPayload" do |env| - assert_equal 'test.example.org', env[:url].host - params = Faraday::Utils.parse_nested_query(env[:url].query) - refute params - @Pushes += 1 - [200, {}, ''] - end - svc.receive_push - assert_equal 1, @Pushes - end - - def username - return 'test_user' - end - - def password - return 'test_pass' - end - - def service(*args) - super Service::RationalJazzHub, *args - end -end diff --git a/test/service_test.rb b/test/service_test.rb index 7efe53192..160ed1450 100644 --- a/test/service_test.rb +++ b/test/service_test.rb @@ -79,6 +79,75 @@ def http.post end end + def test_http_only_with_prefix + ["ftp://1.1.1.1", "file:///etc/passwd"].each do |url| + http = @service.http + http.url_prefix = URI::parse(url) + + assert_raises Service::ConfigurationError do + @service.http_post "/this/is/a/url" + end + assert_raises Service::ConfigurationError do + @service.http_get "/this/is/a/url" + end + end + end + + def test_http_only_with_full_url + ["ftp://1.1.1.1", "file:///etc/passwd"].each do |url| + http = @service.http + + assert_raises Service::ConfigurationError do + @service.http_post url + end + assert_raises Service::ConfigurationError do + @service.http_get url + end + end + end + + def test_http_only_with_prefix_and_fqdn + ["ftp://1.1.1.1", "file:///etc/passwd"].each do |url| + http = @service.http + http.url_prefix = URI::parse(url) + + assert_raises Service::ConfigurationError do + @service.http_post "ftp:///this/is/a/url" + end + assert_raises Service::ConfigurationError do + @service.http_get "ftp:///this/is/a/url" + end + end + end + + def test_http_get_url_strip + stubs = Faraday::Adapter::Test::Stubs.new + stubs.get("/") { |env| [200, {}, "ok"] } + stubs.get("/ ") { |env| [200, {}, "nope"] } + + service = TestService.new(:push, "data", "payload") + service.http :adapter => [:test, stubs] + + service.http_get "https://example.com/ " + http_call = service.http_calls[0] + assert_equal "https://example.com/", http_call[:request][:url] + assert_equal "ok", http_call[:response][:body] + end + + def test_http_post_url_strip + stubs = Faraday::Adapter::Test::Stubs.new + stubs.post("/") { |env| [200, {}, "ok"] } + stubs.post("/ ") { |env| [200, {}, "nope"] } + + service = TestService.new(:push, "data", "payload") + service.http :adapter => [:test, stubs] + + service.http_post "https://example.com/ " + http_call = service.http_calls[0] + assert_equal "https://example.com/", http_call[:request][:url] + assert_equal "ok", http_call[:response][:body] + end + def test_json_encoding payload = {'unicodez' => "rtiaΓΌ\n\n€ý5:q"} json = @service.generate_json(payload) @@ -102,6 +171,72 @@ def test_config_boolean_true_helper assert svc.config_boolean_true?("is_checked") end + def test_before_delivery + @service.before_delivery do |url, payload, headers, params| + headers['EDITED-IN-BEFORE-DELIVERY'] = true + payload.replace("EDITED") + end + + @stubs.post '/' do |env| + assert_equal '/', env.url.to_s + assert_equal 'EDITED', env[:body] + assert_equal true, env[:request_headers]['Edited-In-Before-Delivery'] + [200, {'X-Test' => 'success'}, 'OK'] + end + + @service.http_post('/', payload.to_s) + + @service.http_calls.each do |env| + assert_equal 200, env[:response][:status] + end + + assert_equal 1, @service.http_calls.size + end + + def test_multiple_before_delivery_callbacks + @service.before_delivery do |url, payload, headers, params| + headers['EDITED-IN-BEFORE-DELIVERY-1'] = true + end + + @service.before_delivery do |url, payload, headers, params| + headers['EDITED-IN-BEFORE-DELIVERY-2'] = true + end + + @stubs.get '/' do |env| + assert_equal true, env[:request_headers]['Edited-In-Before-Delivery-1'] + assert_equal true, env[:request_headers]['Edited-In-Before-Delivery-2'] + [200, {'X-Test' => 'success'}, 'OK'] + end + + @service.http_get('/') + + @service.http_calls.each do |env| + assert_equal 200, env[:response][:status] + end + end + + def test_reset_pre_delivery_callbacks! + @service.before_delivery do |url, payload, headers, params| + headers['EDITED-IN-BEFORE-DELIVERY'] = true + payload.replace("EDITED") + end + + @stubs.post '/' do |env| + assert_equal 'EDITED', env[:body] + assert_equal true, env[:request_headers]['Edited-In-Before-Delivery'] + [200, {'X-Test' => 'success'}, 'OK'] + end + + @service.http_post('/', "desrever") + @service.reset_pre_delivery_callbacks! + + @stubs.post '/' do |env| + refute_equal 'EDITED', env[:body] + refute_equal true, env[:request_headers]['Edited-In-Before-Delivery'] + [200, {'X-Test' => 'success'}, 'OK'] + end + end + def service(*args) super TestService, *args end diff --git a/test/sqwiggle_test.rb b/test/sqwiggle_test.rb deleted file mode 100644 index fbf7929d4..000000000 --- a/test/sqwiggle_test.rb +++ /dev/null @@ -1,61 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class SqwiggleTest < Service::TestCase - include Service::HttpTestMethods - - def test_default_room_push - - data = { - 'token' => 'some_token' - } - - payload = {'commits'=>[{'id'=>'test'}]} - svc = service(data, payload) - - @stubs.post "integrations/github/" do |env| - body = JSON.parse(env[:body]) - - assert_equal env[:url].host, "api.sqwiggle.com" - assert_equal basic_auth('some_token', 'X'), env[:request_headers][:authorization] - assert_equal 'test', body['payload']['commits'][0]['id'] - assert_match 'guid-', body['guid'] - assert_equal data, body['config'] - assert_equal 'push', body['event'] - [200, {}, ''] - end - - svc.receive_event - @stubs.verify_stubbed_calls - end - - def test_specified_room_push - data = { - 'token' => 'some_token', - 'room' => 'some_room' - } - - payload = {'commits'=>[{'id'=>'test'}]} - svc = service(data, payload) - - @stubs.post "integrations/github/some_room" do |env| - body = JSON.parse(env[:body]) - - assert_equal env[:url].host, "api.sqwiggle.com" - assert_equal basic_auth('some_token', 'X'), env[:request_headers][:authorization] - assert_equal 'test', body['payload']['commits'][0]['id'] - assert_match 'guid-', body['guid'] - assert_equal data, body['config'] - assert_equal 'push', body['event'] - [200, {}, ''] - end - - svc.receive_event - @stubs.verify_stubbed_calls - end - - def service_class - Service::Sqwiggle - end -end - - diff --git a/test/stormpath_test.rb b/test/stormpath_test.rb deleted file mode 100644 index 1ab783290..000000000 --- a/test/stormpath_test.rb +++ /dev/null @@ -1,92 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class Hash - def except!(*keys) - keys.each { |key| delete(key) } - self - end -end - -class StormpathTest < Service::TestCase - include Service::HttpTestMethods - - TEST_API_KEY_ID = "18WJZYBI2I1YX8LDJBIK5DA6O" - TEST_API_KEY_SECRET = "5awFkPbNusdIKJkkmjVY6GUjap+VDw39Mnwy16C0luU" - - def data - { - 'api_key_id' => TEST_API_KEY_ID, - 'api_key_secret' => TEST_API_KEY_SECRET - } - end - - def payload - { - 'commits'=>[{'id'=>'test'}] - } - end - - def test_push - - svc = service(data, payload) - - @stubs.post "/vendors/github/events" do |env| - body = JSON.parse(env[:body]) - - assert_equal env[:request_headers]['content-type'], "application/json" - assert_equal 'test', body['payload']['commits'][0]['id'] - assert_match 'guid-', body['guid'] - assert_equal data, body['config'] - assert_equal 'push', body['event'] - [200, {}, ''] - end - - svc.receive_event - @stubs.verify_stubbed_calls - end - - def verify_requires(svc) - assert_raises Service::ConfigurationError do - svc.receive_event - end - end - - def test_requires_api_key_id - verify_requires(service(data.except!('api_key_id'), payload)) - end - - def test_requires_api_key_secret - verify_requires(service(data.except!('api_key_secret'), payload)) - end - - def test_invalid_api_key - - invalid_api_key = {'api_key_id' => 'invalid_id', 'api_key_secret' => 'invalid_secret'} - svc = service(invalid_api_key, payload) - - @stubs.post "/vendors/github/events" do |env| - body = JSON.parse(env[:body]) - - assert_equal env[:request_headers]['content-type'], "application/json" - assert_equal 'test', body['payload']['commits'][0]['id'] - assert_match 'guid-', body['guid'] - assert_equal 'push', body['event'] - [401, {}, ''] - end - - verify_requires svc - @stubs.verify_stubbed_calls - end - - def test_config - - svc = service(data, payload) - - assert_equal svc.data['api_key_id'], TEST_API_KEY_ID - assert_equal svc.data['api_key_secret'], TEST_API_KEY_SECRET - end - - def service_class - Service::Stormpath - end -end \ No newline at end of file diff --git a/test/teamcity_test.rb b/test/teamcity_test.rb index d8d237773..378a3e121 100644 --- a/test/teamcity_test.rb +++ b/test/teamcity_test.rb @@ -6,10 +6,18 @@ def setup end def test_push - url = "/abc/httpAuth/action.html" - @stubs.get url do |env| + url = "/abc/httpAuth/app/rest/buildQueue" + @stubs.post url do |env| + assert_equal 'teamcity.com', env[:url].host + assert_equal '', env[:body] + assert_equal basic_auth(:u, :p), env[:request_headers]['authorization'] + [200, {}, ''] + end + + url2 = "abc/httpAuth/app/rest/vcs-root-instances/checkingForChangesQueue?locator=buildType:btid" + @stubs.post url2 do |env| assert_equal 'teamcity.com', env[:url].host - assert_equal 'btid', env[:params]['add2Queue'] + assert_equal nil, env[:body] assert_equal basic_auth(:u, :p), env[:request_headers]['authorization'] [200, {}, ''] end @@ -26,7 +34,7 @@ def test_push def test_push_deleted_branch url = "/abc/httpAuth/action.html" - @stubs.get url do |env| + @stubs.post url do |env| assert false, "service should not be called for deleted branches" end @@ -41,9 +49,9 @@ def test_push_deleted_branch end def test_push_with_branch_name - url = "/abc/httpAuth/action.html" - @stubs.get url do |env| - assert_equal 'branch-name', env[:params]['branchName'] + url = "/abc/httpAuth/app/rest/buildQueue" + @stubs.post url do |env| + assert_equal '', env[:body] [200, {}, ''] end @@ -57,9 +65,9 @@ def test_push_with_branch_name end def test_push_with_branch_name_incl_slashes - url = "/abc/httpAuth/action.html" - @stubs.get url do |env| - assert_equal 'branch/name', env[:params]['branchName'] + url = "/abc/httpAuth/app/rest/buildQueue" + @stubs.post url do |env| + assert_equal '', env[:body] [200, {}, ''] end @@ -73,9 +81,9 @@ def test_push_with_branch_name_incl_slashes end def test_push_with_branch_full_ref - url = "/abc/httpAuth/action.html" - @stubs.get url do |env| - assert_equal 'refs/heads/branch/name', env[:params]['branchName'] + url = "/abc/httpAuth/app/rest/buildQueue" + @stubs.post url do |env| + assert_equal '', env[:body] [200, {}, ''] end @@ -90,10 +98,10 @@ def test_push_with_branch_full_ref end def test_push_when_check_for_changes_is_true - url = "/abc/httpAuth/action.html" - @stubs.get url do |env| + url = "abc/httpAuth/app/rest/vcs-root-instances/checkingForChangesQueue?locator=buildType:btid" + @stubs.post url do |env| assert_equal 'teamcity.com', env[:url].host - assert_equal 'btid', env[:params]['checkForChangesBuildType'] + assert_equal "", env[:body] [200, {}, ''] end diff --git a/test/tinypm_test.rb b/test/tinypm_test.rb deleted file mode 100644 index 1bf12acbc..000000000 --- a/test/tinypm_test.rb +++ /dev/null @@ -1,33 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class TinyPMTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @data = {'url' => 'http://tinypm.com/github'} - end - - def test_push - @stubs.post "/github" do |env| - form = Faraday::Utils.parse_query(env[:body]) - assert_equal 'tinypm.com', env[:url].host - assert_equal 'application/json', env[:request_headers]['Content-Type'] - assert_equal JSON.generate(payload), env[:body] - [200, {}, ''] - end - - svc = service(@data, payload) - svc.receive_push - @stubs.verify_stubbed_calls - end - - def test_no_server - assert_raises Service::ConfigurationError do - svc = service :push, {'url' => ''}, payload - svc.receive_push - end - end - - def service(*args) - super Service::TinyPM, *args - end -end diff --git a/test/trajectory_test.rb b/test/trajectory_test.rb deleted file mode 100644 index e7edfb4fd..000000000 --- a/test/trajectory_test.rb +++ /dev/null @@ -1,52 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class TrajectoryTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_raise_config_error_without_api_key - assert_raises Service::ConfigurationError do - svc = service({}, payload) - svc.receive_push - end - - assert_raises Service::ConfigurationError do - svc = service({}, payload) - svc.receive_pull_request - end - end - - def test_push - @stubs.post '/api/payloads?api_key=test_api_key' do |env| - confirm_trajectory_receives_request(env) - [200, {}, ''] - end - - svc = service({'api_key' => 'test_api_key'}, payload) - svc.receive_push - - @stubs.verify_stubbed_calls - end - - def test_pull_request - @stubs.post '/api/payloads?api_key=test_api_key' do |env| - confirm_trajectory_receives_request(env) - [200, {}, ''] - end - - svc = service({'api_key' => 'test_api_key'}, payload) - svc.receive_pull_request - - @stubs.verify_stubbed_calls - end - - def service(*args) - super Service::Trajectory, *args - end - - def confirm_trajectory_receives_request(env) - assert_equal 'application/json', env[:request_headers]['Content-Type'] - assert_equal 'https://www.apptrajectory.com/api/payloads?api_key=test_api_key', env[:url].to_s - end -end diff --git a/test/visualops_test.rb b/test/visualops_test.rb deleted file mode 100644 index 1c43b736a..000000000 --- a/test/visualops_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class VisualOpsTest < Service::TestCase - - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - @data = {'username' => 'someuser', 'app_list' => 'abc123, madeira:master, xyz456:devel', 'consumer_token' => 'madeira-visualops'} - end - - def test_push - svc = service :push, @data - - @stubs.post "/v1/github" do |env| - assert_equal 'api.visualops.io', env[:url].host - body = JSON.parse(env[:body]) - assert_equal 'someuser', body['config']['username'] - assert_equal 'madeira-visualops', body['config']['consumer_token'] - assert_equal ['abc123','madeira'], body['config']['app_list'] - [200, {}, ''] - end - - svc.receive_event - end - - def test_develop - svc = service :push, @data, - payload.update("ref" => "refs/heads/devel") - - @stubs.post "/v1/github" do |env| - assert_equal 'api.visualops.io', env[:url].host - body = JSON.parse(env[:body]) - assert_equal 'someuser', body['config']['username'] - assert_equal 'madeira-visualops', body['config']['consumer_token'] - assert_equal ['xyz456'], body['config']['app_list'] - [200, {}, ''] - end - - svc.receive_event - end - - def test_other_branch - svc = service :push, @data, - payload.update("ref" => "refs/heads/no-such-branch") - - @stubs.post "/v1/github" do |env| - raise "This should not be called" - end - - svc.receive_event - end - - def service(*args) - super Service::VisualOps, *args - end -end diff --git a/test/yammer_test.rb b/test/yammer_test.rb deleted file mode 100644 index 4ae6b8c59..000000000 --- a/test/yammer_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require File.expand_path('../helper', __FILE__) - -class YammerTest < Service::TestCase - def setup - @stubs = Faraday::Adapter::Test::Stubs.new - end - - def test_reads_token_from_data - svc = service({'token' => 'a4f1200fc99331027ab1239%3D%3D'}, payload) - assert_equal "a4f1200fc99331027ab1239%3D%3D", svc.token - end - - def test_strips_whitespace_from_token - svc = service({'token' => 'a4f1200fc99331027ab1239%3D%3D '}, payload) - assert_equal 'a4f1200fc99331027ab1239%3D%3D', svc.token - end - - def test_posts_payload - [:push, :commit_comment, :pull_request, :pull_request_review_comment, :public].each do |event| - svc = service(event, data, payload) - @stubs.post "/a4f1200fc99331027ab1239%3D%3D/notify/#{event}" do |env| - assert_equal 'https', env[:url].scheme - assert_equal 'yammer-github.herokuapp.com', env[:url].host - assert_equal "/a4f1200fc99331027ab1239%3D%3D/notify/#{event}", env[:url].path - assert_equal payload, JSON.parse(Faraday::Utils.parse_query(env[:body])['payload']) - end - - svc.receive_event - end - end - -private - - def service(*args) - super Service::Yammer, *args - end - - def data - { 'token' => 'a4f1200fc99331027ab1239%3D%3D' } - end - -end diff --git a/vendor/cache/activemodel-4.2.10.gem b/vendor/cache/activemodel-4.2.10.gem new file mode 100644 index 000000000..4c3ba99f5 Binary files /dev/null and b/vendor/cache/activemodel-4.2.10.gem differ diff --git a/vendor/cache/activemodel-4.2.5.1.gem b/vendor/cache/activemodel-4.2.5.1.gem deleted file mode 100644 index f30fd6564..000000000 Binary files a/vendor/cache/activemodel-4.2.5.1.gem and /dev/null differ diff --git a/vendor/cache/activesupport-4.2.10.gem b/vendor/cache/activesupport-4.2.10.gem new file mode 100644 index 000000000..addf8b408 Binary files /dev/null and b/vendor/cache/activesupport-4.2.10.gem differ diff --git a/vendor/cache/activesupport-4.2.5.1.gem b/vendor/cache/activesupport-4.2.5.1.gem deleted file mode 100644 index 3bfabeb44..000000000 Binary files a/vendor/cache/activesupport-4.2.5.1.gem and /dev/null differ diff --git a/vendor/cache/addressable-2.4.0.gem b/vendor/cache/addressable-2.4.0.gem deleted file mode 100644 index 5f23fd9f8..000000000 Binary files a/vendor/cache/addressable-2.4.0.gem and /dev/null differ diff --git a/vendor/cache/addressable-2.5.2.gem b/vendor/cache/addressable-2.5.2.gem new file mode 100644 index 000000000..3e53ea0e4 Binary files /dev/null and b/vendor/cache/addressable-2.5.2.gem differ diff --git a/vendor/cache/aws-sdk-1.66.0.gem b/vendor/cache/aws-sdk-1.67.0.gem similarity index 53% rename from vendor/cache/aws-sdk-1.66.0.gem rename to vendor/cache/aws-sdk-1.67.0.gem index 906688e43..9302695e6 100644 Binary files a/vendor/cache/aws-sdk-1.66.0.gem and b/vendor/cache/aws-sdk-1.67.0.gem differ diff --git a/vendor/cache/aws-sdk-v1-1.66.0.gem b/vendor/cache/aws-sdk-v1-1.66.0.gem deleted file mode 100644 index 9dae4e4ad..000000000 Binary files a/vendor/cache/aws-sdk-v1-1.66.0.gem and /dev/null differ diff --git a/vendor/cache/aws-sdk-v1-1.67.0.gem b/vendor/cache/aws-sdk-v1-1.67.0.gem new file mode 100644 index 000000000..21548704c Binary files /dev/null and b/vendor/cache/aws-sdk-v1-1.67.0.gem differ diff --git a/vendor/cache/builder-3.2.2.gem b/vendor/cache/builder-3.2.2.gem deleted file mode 100644 index b59ef922e..000000000 Binary files a/vendor/cache/builder-3.2.2.gem and /dev/null differ diff --git a/vendor/cache/builder-3.2.3.gem b/vendor/cache/builder-3.2.3.gem new file mode 100644 index 000000000..3500c8043 Binary files /dev/null and b/vendor/cache/builder-3.2.3.gem differ diff --git a/vendor/cache/concurrent-ruby-1.0.5.gem b/vendor/cache/concurrent-ruby-1.0.5.gem new file mode 100644 index 000000000..4119d3aaf Binary files /dev/null and b/vendor/cache/concurrent-ruby-1.0.5.gem differ diff --git a/vendor/cache/curb-0.9.1.gem b/vendor/cache/curb-0.9.1.gem deleted file mode 100644 index e579c7dd3..000000000 Binary files a/vendor/cache/curb-0.9.1.gem and /dev/null differ diff --git a/vendor/cache/curb-fu-0.6.2.gem b/vendor/cache/curb-fu-0.6.2.gem deleted file mode 100644 index 0a992bda1..000000000 Binary files a/vendor/cache/curb-fu-0.6.2.gem and /dev/null differ diff --git a/vendor/cache/domain_name-0.5.20160128.gem b/vendor/cache/domain_name-0.5.20160128.gem deleted file mode 100644 index c25aac3d4..000000000 Binary files a/vendor/cache/domain_name-0.5.20160128.gem and /dev/null differ diff --git a/vendor/cache/domain_name-0.5.20170404.gem b/vendor/cache/domain_name-0.5.20170404.gem new file mode 100644 index 000000000..e7235dd10 Binary files /dev/null and b/vendor/cache/domain_name-0.5.20170404.gem differ diff --git a/vendor/cache/eventmachine-1.0.9.1.gem b/vendor/cache/eventmachine-1.0.9.1.gem deleted file mode 100644 index 214c02dad..000000000 Binary files a/vendor/cache/eventmachine-1.0.9.1.gem and /dev/null differ diff --git a/vendor/cache/eventmachine-1.2.5.gem b/vendor/cache/eventmachine-1.2.5.gem new file mode 100644 index 000000000..26c18a8e0 Binary files /dev/null and b/vendor/cache/eventmachine-1.2.5.gem differ diff --git a/vendor/cache/faraday_middleware-0.10.0.gem b/vendor/cache/faraday_middleware-0.10.0.gem deleted file mode 100644 index 98ea117a1..000000000 Binary files a/vendor/cache/faraday_middleware-0.10.0.gem and /dev/null differ diff --git a/vendor/cache/faraday_middleware-0.12.2.gem b/vendor/cache/faraday_middleware-0.12.2.gem new file mode 100644 index 000000000..24c9f2567 Binary files /dev/null and b/vendor/cache/faraday_middleware-0.12.2.gem differ diff --git a/vendor/cache/http-cookie-1.0.2.gem b/vendor/cache/http-cookie-1.0.2.gem deleted file mode 100644 index 9c90dcd5b..000000000 Binary files a/vendor/cache/http-cookie-1.0.2.gem and /dev/null differ diff --git a/vendor/cache/http-cookie-1.0.3.gem b/vendor/cache/http-cookie-1.0.3.gem new file mode 100644 index 000000000..f02ecaf77 Binary files /dev/null and b/vendor/cache/http-cookie-1.0.3.gem differ diff --git a/vendor/cache/i18n-0.7.0.gem b/vendor/cache/i18n-0.7.0.gem deleted file mode 100644 index 6f8cf7357..000000000 Binary files a/vendor/cache/i18n-0.7.0.gem and /dev/null differ diff --git a/vendor/cache/i18n-0.9.1.gem b/vendor/cache/i18n-0.9.1.gem new file mode 100644 index 000000000..c8cb0dc54 Binary files /dev/null and b/vendor/cache/i18n-0.9.1.gem differ diff --git a/vendor/cache/jmespath-1.1.3.gem b/vendor/cache/jmespath-1.1.3.gem deleted file mode 100644 index 7f06f80dc..000000000 Binary files a/vendor/cache/jmespath-1.1.3.gem and /dev/null differ diff --git a/vendor/cache/jmespath-1.3.1.gem b/vendor/cache/jmespath-1.3.1.gem new file mode 100644 index 000000000..deba3208e Binary files /dev/null and b/vendor/cache/jmespath-1.3.1.gem differ diff --git a/vendor/cache/json-1.8.3.gem b/vendor/cache/json-1.8.3.gem deleted file mode 100644 index 6474a4fcf..000000000 Binary files a/vendor/cache/json-1.8.3.gem and /dev/null differ diff --git a/vendor/cache/json-1.8.6.gem b/vendor/cache/json-1.8.6.gem new file mode 100644 index 000000000..2a7d6648e Binary files /dev/null and b/vendor/cache/json-1.8.6.gem differ diff --git a/vendor/cache/jwt-1.5.2.gem b/vendor/cache/jwt-1.5.2.gem deleted file mode 100644 index 0c6ce4bb8..000000000 Binary files a/vendor/cache/jwt-1.5.2.gem and /dev/null differ diff --git a/vendor/cache/jwt-2.1.0.gem b/vendor/cache/jwt-2.1.0.gem new file mode 100644 index 000000000..ebfe13720 Binary files /dev/null and b/vendor/cache/jwt-2.1.0.gem differ diff --git a/vendor/cache/mail-2.6.3.gem b/vendor/cache/mail-2.6.3.gem deleted file mode 100644 index ae3e0804e..000000000 Binary files a/vendor/cache/mail-2.6.3.gem and /dev/null differ diff --git a/vendor/cache/mail-2.7.0.gem b/vendor/cache/mail-2.7.0.gem new file mode 100644 index 000000000..8db385adf Binary files /dev/null and b/vendor/cache/mail-2.7.0.gem differ diff --git a/vendor/cache/maxcdn-0.2.1.gem b/vendor/cache/maxcdn-0.2.1.gem deleted file mode 100644 index 30883fe5a..000000000 Binary files a/vendor/cache/maxcdn-0.2.1.gem and /dev/null differ diff --git a/vendor/cache/maxcdn-0.3.2.gem b/vendor/cache/maxcdn-0.3.2.gem new file mode 100644 index 000000000..30a3696ca Binary files /dev/null and b/vendor/cache/maxcdn-0.3.2.gem differ diff --git a/vendor/cache/mini_mime-1.0.0.gem b/vendor/cache/mini_mime-1.0.0.gem new file mode 100644 index 000000000..cd814c59c Binary files /dev/null and b/vendor/cache/mini_mime-1.0.0.gem differ diff --git a/vendor/cache/mini_portile2-2.0.0.gem b/vendor/cache/mini_portile2-2.0.0.gem deleted file mode 100644 index 03f624696..000000000 Binary files a/vendor/cache/mini_portile2-2.0.0.gem and /dev/null differ diff --git a/vendor/cache/mini_portile2-2.3.0.gem b/vendor/cache/mini_portile2-2.3.0.gem new file mode 100644 index 000000000..341a956b2 Binary files /dev/null and b/vendor/cache/mini_portile2-2.3.0.gem differ diff --git a/vendor/cache/minitest-5.10.3.gem b/vendor/cache/minitest-5.10.3.gem new file mode 100644 index 000000000..082361c26 Binary files /dev/null and b/vendor/cache/minitest-5.10.3.gem differ diff --git a/vendor/cache/minitest-5.4.2.gem b/vendor/cache/minitest-5.4.2.gem deleted file mode 100644 index 999b71a36..000000000 Binary files a/vendor/cache/minitest-5.4.2.gem and /dev/null differ diff --git a/vendor/cache/multi_json-1.11.2.gem b/vendor/cache/multi_json-1.11.2.gem deleted file mode 100644 index b65fbbb08..000000000 Binary files a/vendor/cache/multi_json-1.11.2.gem and /dev/null differ diff --git a/vendor/cache/multi_json-1.12.2.gem b/vendor/cache/multi_json-1.12.2.gem new file mode 100644 index 000000000..af3c0b462 Binary files /dev/null and b/vendor/cache/multi_json-1.12.2.gem differ diff --git a/vendor/cache/net-http-persistent-2.9.4.gem b/vendor/cache/net-http-persistent-2.9.4.gem new file mode 100644 index 000000000..73f16a79f Binary files /dev/null and b/vendor/cache/net-http-persistent-2.9.4.gem differ diff --git a/vendor/cache/nokogiri-1.6.7.2.gem b/vendor/cache/nokogiri-1.8.1.gem similarity index 53% rename from vendor/cache/nokogiri-1.6.7.2.gem rename to vendor/cache/nokogiri-1.8.1.gem index aa77f2ac7..970507ca4 100644 Binary files a/vendor/cache/nokogiri-1.6.7.2.gem and b/vendor/cache/nokogiri-1.8.1.gem differ diff --git a/vendor/cache/public_suffix-3.0.1.gem b/vendor/cache/public_suffix-3.0.1.gem new file mode 100644 index 000000000..e8fc0478e Binary files /dev/null and b/vendor/cache/public_suffix-3.0.1.gem differ diff --git a/vendor/cache/rack-1.6.4.gem b/vendor/cache/rack-1.6.4.gem deleted file mode 100644 index 6d06fed8e..000000000 Binary files a/vendor/cache/rack-1.6.4.gem and /dev/null differ diff --git a/vendor/cache/rack-test-0.6.3.gem b/vendor/cache/rack-test-0.6.3.gem deleted file mode 100644 index 914afe94c..000000000 Binary files a/vendor/cache/rack-test-0.6.3.gem and /dev/null differ diff --git a/vendor/cache/rails-observers-0.1.2.gem b/vendor/cache/rails-observers-0.1.2.gem deleted file mode 100644 index 96772dcbf..000000000 Binary files a/vendor/cache/rails-observers-0.1.2.gem and /dev/null differ diff --git a/vendor/cache/rails-observers-0.1.5.gem b/vendor/cache/rails-observers-0.1.5.gem new file mode 100644 index 000000000..c673b989a Binary files /dev/null and b/vendor/cache/rails-observers-0.1.5.gem differ diff --git a/vendor/cache/rest-client-1.8.0.gem b/vendor/cache/rest-client-1.8.0.gem deleted file mode 100644 index 81d44af45..000000000 Binary files a/vendor/cache/rest-client-1.8.0.gem and /dev/null differ diff --git a/vendor/cache/rest-client-2.0.2.gem b/vendor/cache/rest-client-2.0.2.gem new file mode 100644 index 000000000..3369c0a08 Binary files /dev/null and b/vendor/cache/rest-client-2.0.2.gem differ diff --git a/vendor/cache/signet-0.5.1.gem b/vendor/cache/signet-0.5.1.gem deleted file mode 100644 index de94ae3a7..000000000 Binary files a/vendor/cache/signet-0.5.1.gem and /dev/null differ diff --git a/vendor/cache/signet-0.8.1.gem b/vendor/cache/signet-0.8.1.gem new file mode 100644 index 000000000..b2b22f3c4 Binary files /dev/null and b/vendor/cache/signet-0.8.1.gem differ diff --git a/vendor/cache/thread_safe-0.3.5.gem b/vendor/cache/thread_safe-0.3.5.gem deleted file mode 100644 index ab806b6e8..000000000 Binary files a/vendor/cache/thread_safe-0.3.5.gem and /dev/null differ diff --git a/vendor/cache/thread_safe-0.3.6.gem b/vendor/cache/thread_safe-0.3.6.gem new file mode 100644 index 000000000..7ee950f8b Binary files /dev/null and b/vendor/cache/thread_safe-0.3.6.gem differ diff --git a/vendor/cache/tzinfo-1.2.2.gem b/vendor/cache/tzinfo-1.2.2.gem deleted file mode 100644 index 57dd32600..000000000 Binary files a/vendor/cache/tzinfo-1.2.2.gem and /dev/null differ diff --git a/vendor/cache/tzinfo-1.2.4.gem b/vendor/cache/tzinfo-1.2.4.gem new file mode 100644 index 000000000..40fc7d747 Binary files /dev/null and b/vendor/cache/tzinfo-1.2.4.gem differ diff --git a/vendor/cache/unf_ext-0.0.7.2.gem b/vendor/cache/unf_ext-0.0.7.2.gem deleted file mode 100644 index c2fb45946..000000000 Binary files a/vendor/cache/unf_ext-0.0.7.2.gem and /dev/null differ diff --git a/vendor/cache/unf_ext-0.0.7.4.gem b/vendor/cache/unf_ext-0.0.7.4.gem new file mode 100644 index 000000000..444be9f6a Binary files /dev/null and b/vendor/cache/unf_ext-0.0.7.4.gem differ diff --git a/vendor/cache/xmlrpc-0.2.1.gem b/vendor/cache/xmlrpc-0.2.1.gem new file mode 100644 index 000000000..fd2d27f47 Binary files /dev/null and b/vendor/cache/xmlrpc-0.2.1.gem differ diff --git a/vendor/cache/xmpp4r-simple-19-1.0.0.gem b/vendor/cache/xmpp4r-simple-19-1.0.0.gem deleted file mode 100644 index 4e8174d14..000000000 Binary files a/vendor/cache/xmpp4r-simple-19-1.0.0.gem and /dev/null differ diff --git a/vendor/cache/yajl-ruby-1.1.0.gem b/vendor/cache/yajl-ruby-1.1.0.gem deleted file mode 100644 index 3fcb580e8..000000000 Binary files a/vendor/cache/yajl-ruby-1.1.0.gem and /dev/null differ diff --git a/vendor/cache/yajl-ruby-1.3.1.gem b/vendor/cache/yajl-ruby-1.3.1.gem new file mode 100644 index 000000000..8ac269cc0 Binary files /dev/null and b/vendor/cache/yajl-ruby-1.3.1.gem differ diff --git a/vendor/internal-gems/rubyforge/lib/rubyforge.rb b/vendor/internal-gems/rubyforge/lib/rubyforge.rb deleted file mode 100644 index 61b0e9714..000000000 --- a/vendor/internal-gems/rubyforge/lib/rubyforge.rb +++ /dev/null @@ -1,74 +0,0 @@ -# This code was pretty much copied from Ara Howard's -# RubyForge gem... thanks Ara! :) - -require 'net/https' -require 'openssl' -require 'webrick/cookie' - -class RubyForge - def initialize(username, password) - @cookies = Array.new - login(username, password) - end - - def post_news(group_id, subject, body) - url = URI.parse('http://rubyforge.org/news/submit.php') - form = { - 'group_id' => group_id.to_s, - 'post_changes' => 'y', - 'summary' => subject, - 'details' => body, - 'submit' => 'Submit' - } - execute(url, form) - end - - ####### - private - ####### - - def login(username, password) - url = URI.parse('https://rubyforge.org/account/login.php') - form = { - 'return_to' => '', - 'form_loginname' => username, - 'form_pw' => password, - 'login' => 'Login' - } - response = execute(url, form) - bake_cookies(url, response) - end - - def execute(url, parameters) - request = Net::HTTP::Post.new(url.request_uri) - request['Content-Type'] = 'application/x-www-form-urlencoded' - @cookies.each do |cookie| - request['Cookie'] = cookie - end - http = Net::HTTP.new(url.host, url.port) - if url.scheme == 'https' - http.use_ssl = true - http.verify_mode = OpenSSL::SSL::VERIFY_NONE - end - request_data = query_string_for(parameters) - request['Content-Length'] = request_data.length.to_s - http.request(request, request_data) - end - - def bake_cookies(url, response) - (response.get_fields('Set-Cookie') || []).each do |raw_cookie| - WEBrick::Cookie.parse_set_cookies(raw_cookie).each do |baked_cookie| - baked_cookie.domain ||= url.host - baked_cookie.path ||= url.path - @cookies << baked_cookie - end - end - end - - def query_string_for(parameters) - parameters.sort_by { |k,v| k.to_s }.map { |k,v| - k && [ WEBrick::HTTPUtils.escape_form(k.to_s), - WEBrick::HTTPUtils.escape_form(v.to_s) ].join('=') - }.compact.join('&') - end -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/README b/vendor/internal-gems/yammer4r-0.1.5/README deleted file mode 100644 index 40290f9bc..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/README +++ /dev/null @@ -1,16 +0,0 @@ -= Yammer4R - -== Developers -* {Jim Patterson} - -== Description -Yammer4R provides an object based API to query or update your Yammer account via pure Ruby. It hides the ugly HTTP/REST code from your code. - -== External Dependencies -* Ruby 1.8 (tested with 1.8.7) -* JSON gem (tested with versions: 1.1.3) -* OAuth gem (tested with versions: 0.2.7) -* RSpec gem (tested with versions: 1.1.11) - -== Usage Examples -Coming soon... \ No newline at end of file diff --git a/vendor/internal-gems/yammer4r-0.1.5/Rakefile b/vendor/internal-gems/yammer4r-0.1.5/Rakefile deleted file mode 100644 index c183b6602..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/Rakefile +++ /dev/null @@ -1,13 +0,0 @@ -$:.unshift(File.join(File.dirname(__FILE__), 'lib')) - -require 'rubygems' -require 'rake' -require 'spec/rake/spectask' -require 'yammer4r' - -desc "Run all specs" -Spec::Rake::SpecTask.new('spec') do |t| - t.spec_files = FileList['spec/**/*spec.rb'] -end - -task :default => [:spec] \ No newline at end of file diff --git a/vendor/internal-gems/yammer4r-0.1.5/TODO b/vendor/internal-gems/yammer4r-0.1.5/TODO deleted file mode 100644 index 438a76403..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/TODO +++ /dev/null @@ -1,2 +0,0 @@ -Test! There are currently no tests for yammer4r, and that makes me very sad. -Switch to HTTParty instead of yammer_request. diff --git a/vendor/internal-gems/yammer4r-0.1.5/bin/yammer_create_oauth_yml.rb b/vendor/internal-gems/yammer4r-0.1.5/bin/yammer_create_oauth_yml.rb deleted file mode 100644 index 4c845e19f..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/bin/yammer_create_oauth_yml.rb +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env ruby - -# Instructions: -# -# Register your application at https://www.yammer.com/client_applications/new -# Upon successful registration, you'll recieve your consumer key and secret. -# Pass these values on the command line as --key (-k) and --secret (-s) then -# follow the instructions. - -require 'optparse' -require 'rubygems' -require 'oauth' - -OPTIONS = { - :outfile => 'oauth.yml' -} - -YAMMER_OAUTH = "https://www.yammer.com" - -ARGV.options do |o| - script_name = File.basename($0) - - o.set_summary_indent(' ') - o.banner = "Usage: #{script_name} [OPTIONS]" - o.define_head "Create a yaml file for yammer oauth" - o.separator "" - o.separator "[-k] and [-s] options are mandatory" - o.separator "" - - o.on("-o", "--outfile=[val]", String, - "Yaml output file", - "Default: #{OPTIONS[:outfile]}") { |OPTIONS[:outfile]| } - o.on("-k", "--key=val", String, - "Consumer key for Yammer app") { |key| OPTIONS[:key] = key} - o.on("-s", "--secret=val", String, - "Consumer secret for Yammer app") { |secret| OPTIONS[:secret] = secret} - - o.separator "" - - o.on_tail("-h", "--help", "Show this help message.") { puts o; exit } - o.parse! -end - -unless OPTIONS[:key] && OPTIONS[:secret] - raise ArgumentError, "Must supply consumer key and secret (use -h for help)" -end - -consumer = OAuth::Consumer.new OPTIONS[:key], OPTIONS[:secret], {:site => YAMMER_OAUTH} -request_token = consumer.get_request_token - -puts "Please visit the following URL in your browser to authorize your application, then enter the 4 character security code when done: #{request_token.authorize_url}" -oauth_verifier = gets -response = consumer.token_request(consumer.http_method, - (consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path), - request_token, - {}, - :oauth_verifier => oauth_verifier.chomp) -access_token = OAuth::AccessToken.new(consumer,response[:oauth_token],response[:oauth_token_secret]) - -oauth_yml = <<-EOT -consumer: - key: #{OPTIONS[:key]} - secret: #{OPTIONS[:secret]} -access: - token: #{access_token.token} - secret: #{access_token.secret} -EOT - -File.open(OPTIONS[:outfile], "w") do |f| - f.write oauth_yml -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/example.rb b/vendor/internal-gems/yammer4r-0.1.5/example.rb deleted file mode 100644 index 17e0eed42..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/example.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'yammer4r' - -config_path = File.dirname(__FILE__) + 'oauth.yml' -yammer = Yammer::Client.new(:config => config_path) - -# Get all messages -messages = yammer.messages -puts messages.size -puts messages.last.body.plain -puts messages.last.body.parsed - -# Print out all the users -yammer.users.each do |u| - puts "#{u.name} - #{u.me?}" -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/lib/ext/core_ext.rb b/vendor/internal-gems/yammer4r-0.1.5/lib/ext/core_ext.rb deleted file mode 100644 index fad18ac2d..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/lib/ext/core_ext.rb +++ /dev/null @@ -1,30 +0,0 @@ -class String - def to_boolean - case self - when 'true' - true - when 'false' - false - else - nil - end - end -end - -class Hash - def symbolize_keys - inject({}) do |options, (key, value)| - options[(key.to_sym rescue key) || key] = value - options - end - end - - def symbolize_keys! - self.replace(self.symbolize_keys) - end - - def assert_has_keys(*valid_keys) - missing_keys = [valid_keys].flatten - keys - raise(ArgumentError, "Missing Option(s): #{missing_keys.join(", ")}") unless missing_keys.empty? - end -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/client.rb b/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/client.rb deleted file mode 100644 index 35a17a1cb..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/client.rb +++ /dev/null @@ -1,100 +0,0 @@ -module Yammer - class Client - def initialize(options={}) - options.assert_has_keys(:consumer, :access) unless options.has_key?(:config) - - yammer_url = options.delete(:yammer_host) || "https://www.yammer.com" - @api_path = "/api/v1/" - - if options[:config] - config = YAML.load(open(options[:config])) - options[:consumer] = config['consumer'].symbolize_keys - options[:access] = config['access'].symbolize_keys - end - - consumer = OAuth::Consumer.new(options[:consumer][:key], options[:consumer][:secret], :site => yammer_url) - consumer.http.set_debug_output($stderr) if options[:verbose] == true - @access_token = OAuth::AccessToken.new(consumer, options[:access][:token], options[:access][:secret]) - end - - - # TODO: modularize message and user handling - def messages(action = :all, params = {}) - params.merge!(:resource => :messages) - params.merge!(:action => action) unless action == :all - - parsed_response = JSON.parse(yammer_request(:get, params).body) - older_available = parsed_response['meta']['older_available'] - - ml = parsed_response['messages'].map do |m| - mash(m) - end - Yammer::MessageList.new(ml, older_available, self) - end - - # POST or DELETE a message - def message(action, params) - params.merge!(:resource => :messages) - yammer_request(action, params) - end - - def users(params = {}) - params.merge!(:resource => :users) - JSON.parse(yammer_request(:get, params).body).map { |u| Yammer::User.new(mash(u), self) } - end - - def user(id) - u = JSON.parse(yammer_request(:get, {:resource => :users, :id => id}).body) - Yammer::User.new(mash(u), self) - end - - def current_user - u = JSON.parse(yammer_request(:get, {:resource => :users, :action => :current}).body) - Yammer::User.new(mash(u), self) - end - alias_method :me, :current_user - - private - - def yammer_request(http_method, options) - request_uri = @api_path + options.delete(:resource).to_s - [:action, :id].each {|k| request_uri += "/#{options.delete(k)}" if options.has_key?(k) } - request_uri += ".json" - - if options.any? - request_uri += "?#{create_query_string(options)}" unless http_method == :post - end - - if http_method == :post - handle_response(@access_token.send(http_method, request_uri, options)) - else - handle_response(@access_token.send(http_method, request_uri)) - end - end - - def create_query_string(options) - options.map {|k, v| "#{OAuth::Helper.escape(k)}=#{OAuth::Helper.escape(v)}"}.join('&') - end - - def mash(json) - Mash.new(json) - end - - def handle_response(response) - # TODO: Write classes for exceptions - case response.code.to_i - when 200..201 - response - when 400 - raise "Bad Request: #{response.body}" - when 401 - raise "Authentication failed. Check your username and password" - when 503 - raise "503: Service Unavailable" - else - raise "Error. HTTP Response #{response.code}: #{response.body}" - end - end - - end -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/message.rb b/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/message.rb deleted file mode 100644 index 3b097d83b..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/message.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Yammer::Message - - attr_reader :id, :url, :web_url, :replied_to_id, :thread_id, - :body_plain, :body_parsed, :message_type, :client_type, - :sender_id, :sender_type - - def initialize(m) - @id = m['id'] - @url = m['url'] - @web_url = m['web_url'] - @replied_to_id = m['replied_to_id'] - @thread_id = m['thread_id'] - @body_plain = m['body']['plain'] - @body_parsed = m['body']['parsed'] - @message_type = m['message_type'] - @client_type = m['client_type'] - @sender_id = m['sender_id'] - @sender_type = m['sender_type'] - begin - @created_at = m['created_at'] - rescue ArgumentError => e - @created_at = nil - end - end - -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/message_list.rb b/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/message_list.rb deleted file mode 100644 index 98928559e..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/message_list.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Yammer::MessageList < Array - - attr_reader :older_available, :ids - - def initialize(a, oa, c) - super(a) - @older_available = oa - @client = c - @ids = a.map {|m| m.id}.sort - end - - def first - self[0] - end - - def last - self[self.size - 1] - end - -end \ No newline at end of file diff --git a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/user.rb b/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/user.rb deleted file mode 100644 index ff965fe9c..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer/user.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Yammer::User - extend Forwardable - def_delegator :@user, :id - - def initialize(mash, client) - @user = mash - @client = client - end - - def me? - @user.id == @client.me.id - end - - def method_missing(call, *args) - @user.send(call, *args) - end -end diff --git a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer4r.rb b/vendor/internal-gems/yammer4r-0.1.5/lib/yammer4r.rb deleted file mode 100644 index 0907b43a7..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/lib/yammer4r.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'forwardable' -require 'rubygems' -require 'date' -require 'yaml' -require 'open-uri' - -#gem 'json', '>= 1.1.7' -#require 'json' - -#gem 'oauth', '>=0.3.5' -require 'oauth' - -#gem 'mash', '>=0.0.3' -require 'mash' - -$:.unshift(File.dirname(__FILE__)) -require 'ext/core_ext' -require 'yammer/client' -require 'yammer/message' -require 'yammer/message_list' -require 'yammer/user' diff --git a/vendor/internal-gems/yammer4r-0.1.5/oauth.yml.template b/vendor/internal-gems/yammer4r-0.1.5/oauth.yml.template deleted file mode 100644 index 248c13b47..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/oauth.yml.template +++ /dev/null @@ -1,7 +0,0 @@ -consumer: - key: CLIENT_KEY - secret: CLIENT_SECRET - -access: - token: CONSUMER_TOKEN - secret: CONSUMER_SECRET diff --git a/vendor/internal-gems/yammer4r-0.1.5/spec/spec_helper.rb b/vendor/internal-gems/yammer4r-0.1.5/spec/spec_helper.rb deleted file mode 100644 index 64f17e490..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/spec/spec_helper.rb +++ /dev/null @@ -1,3 +0,0 @@ -$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib")) -require 'yammer4r' -require 'spec' \ No newline at end of file diff --git a/vendor/internal-gems/yammer4r-0.1.5/spec/yammer/client_spec.rb b/vendor/internal-gems/yammer4r-0.1.5/spec/yammer/client_spec.rb deleted file mode 100644 index 2d06e049c..000000000 --- a/vendor/internal-gems/yammer4r-0.1.5/spec/yammer/client_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -require 'ostruct' - -describe Yammer::Client do - - context "creating" do - - before(:each) do - mock_consumer = mock(OAuth::Consumer) - OAuth::Consumer.stub!("new").and_return(mock_consumer) - @mock_http = mock("http") - mock_consumer.stub!("http").and_return(@mock_http) - end - - it "can be configured to be verbose" do - @mock_http.should_receive("set_debug_output").with($stderr) - Yammer::Client.new(:consumer => {}, :access => {}, :verbose => true) - end - - it "should not be configured to be verbose unless asked to be" do - @mock_http.should_not_receive("set_debug_output") - Yammer::Client.new(:consumer => {}, :access => {}) - end - - it "should not be configured to be verbose if asked not to be" do - @mock_http.should_not_receive("set_debug_output") - Yammer::Client.new(:consumer => {}, :access => {}, :verbose => false) - end - - end - - context "users" do - - before(:each) do - @mock_access_token = mock(OAuth::AccessToken) - @response = OpenStruct.new(:code => 200, :body => '{}') - OAuth::AccessToken.stub!("new").and_return(@mock_access_token) - @client = Yammer::Client.new(:consumer => {}, :access => {}) - end - - it "should request the first page by default" do - @mock_access_token.should_receive("get").with("/api/v1/users.json").and_return(@response) - @client.users - end - - it "can request a specified page" do - @mock_access_token.should_receive("get").with("/api/v1/users.json?page=2").and_return(@response) - @client.users(:page => 2) - end - - end - -end \ No newline at end of file