GithubHelp home page GithubHelp logo

isabella232 / trunk.cocoapods.org Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cocoapods/trunk.cocoapods.org

0.0 0.0 0.0 1.44 MB

The authentication server for CocoaPods push

License: MIT License

Ruby 86.58% CSS 1.48% HTML 7.53% Shell 0.05% SCSS 0.22% Slim 4.14%

trunk.cocoapods.org's Introduction

trunk.cocoapods.org

Build Status

Available under the MIT license.

Installation

  1. Create a testing sandbox repository on GitHub and, from the CocoaPods specification repository, add the Gemfile and Rakefile files.

  2. Install PostgreSQL. (On OS X you can use the Postgres App.)

  3. Install the dependencies:

     $ rake bootstrap
    
  4. Run the travis before script to set up your db

     $ ./.travis/before.sh
    
  5. Test whether or not a pod sends correctly

     $ ./bin/test-push localhost:4567 spec/fixtures/AFNetworking.podspec
    

Usage

To start a development server run the following command, replacing the environment variables with your GitHub credentials, a GitHub testing sandbox repository, and a SHA hashed version of the password for the admin area (in this example the password is ‘secret’):

env RACK_ENV=development \
    GH_USERNAME=alloy [email protected] GH_TOKEN=secret GH_REPO=alloy/trunk.cocoapods.org-test \
    TRUNK_APP_PUSH_ALLOWED=true TRUNK_APP_ADMIN_PASSWORD=2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b \
    rake serve

Optional environment variables are:

  • RACK_ENV: Can be test, development, or production.
  • DATABASE_URL: The URL to the PostgreSQL database.

Webhook

The webhook sends messages to other services when events in trunk happen.

These events trigger the webhook and send a message.

  • Successful create of a pod: {'type':'pod','action':'create','timestamp':'<date>','data_url':'<URL>'}
  • Successful create of a version: {'type':'version','action':'create','timestamp':'<date>','data_url':'<URL>'}
  • Successful update of a spec: {'type':'spec','action':'update','timestamp':'<date>','data_url':'<URL>'}

Environment variables are:

  • OUTGOING_HOOK_PATH: The garbled path used at the end of <schema>://<domain>/hooks/trunk/<OUTGOING_HOOK_PATH>.
  • WEBHOOKS_ENABLED: If set to true, the webhook is enabled.

Usage in Trunk

Enable:

Webhook.enable

Disable:

Webhook.disable

Trigger a message explicitly:

Webhook.pod_created(created_at, data_url)
Webhook.version_created(created_at, data_url)
Webhook.spec_updated(updated_at, data_url)

Change the webhook service URLs with the hook config methods:

Webhook.pod_created = [urls]
Webhook.version_created = [urls]
Webhook.spec_updated = [urls]

Check if it is enabled:

Webhook.enabled?

Usage in interested web services

Note: The webhooks are currently only available to CP internal services. We are looking into opening them up for public use after some intensive testing.

  1. Add your URL wherever one of the hook config methods (see above) is called (currently in ìnit.rb).
  2. We recommend you add OUTGOING_HOOK_PATH to the path to at least obscure your path.
  3. Install a POST route in your service that corresponds to the URL. Note: You MUST NOT use the value in OUTGOING_HOOK_PATH inside your public code. Instead, use an ENV variable as well, and set it to correspond to OUTGOING_HOOK_PATH.

You'll then receive POSTs to the URL with content message=<JSON data>.

trunk.cocoapods.org's People

Contributors

alloy avatar floere avatar orta avatar segiddins avatar fabiopelosin avatar manfred avatar dnkoutso avatar kylef avatar mrcljx avatar neonichu avatar endocrimes avatar steipete avatar palleas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.