Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to latest stable prebid version #5

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"plugins": ["transform-object-assign"]
}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Built Files
node_modules/
build

# Test Files
test/app
gpt.html
gpt-each-bidder3.html

# Dev File

integrationExamples/gpt/gpt.html
integrationExamples/implementations/

# Coverage reports
build/coverage/

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion

Expand Down Expand Up @@ -52,3 +66,6 @@ crashlytics-build.properties

#zip files (for releases)
*.zip

# TypeScript typings
typings/
10 changes: 10 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"maxErrors": 1000,
"requireTrailingComma": null,
"requireCamelCaseOrUpperCaseIdentifiers": null,
"requireSpacesInAnonymousFunctionExpression": null,
"validateIndentation": 2,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
}
}
38 changes: 38 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"bitwise": false,
"browser": true,
"curly": false,
"devel": true,
"eqeqeq": true,
"freeze": true,
"immed": true,
"maxdepth": 5,
"newcap": true,
"noarg": true,
"node": true,
"notypeof": true,
"esnext": true,
"trailing": true,
"undef": true,
"unused": true,
"strict": false,
"scripturl": true,
"globals": {
"before": true,
"after": true,
"exports": true,
"pbjs": true,
"pbjsTestOnly": true,
"assert": false,
"expect": false,
"dump": false,
"describe": false,
"it": false,
"xit": false,
"pkg": false,
"sinon": false,
"beforeEach": false,
"afterEach": false,
"JSON": true
}
}
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: node_js

node_js:
- 0.12
- 0.11
- "5.1"

before_install:
- npm install -g gulp

script:
- gulp build
- gulp build
131 changes: 108 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,54 @@
[![Build Status](https://travis-ci.org/prebid/Prebid.js.svg?branch=master)](https://travis-ci.org/prebid/Prebid.js)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/prebid/Prebid.js.svg)](http://isitmaintained.com/project/prebid/Prebid.js "Percentage of issues still open")
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/prebid/Prebid.js.svg)](http://isitmaintained.com/project/prebid/Prebid.js "Average time to resolve an issue")
[![Code Climate](https://codeclimate.com/github/prebid/Prebid.js/badges/gpa.svg)](https://codeclimate.com/github/prebid/Prebid.js)

Prebid.js
========

> Setup and manage header bidding advertising partners without writing code or confusing line items. Prebid.js is open source and free.

Many SSPs, bidders, and publishers have all contributed to this project.
Many SSPs, bidders, and publishers have all contributed to this project.

Check out the overview and documentation at http://prebid.org.
Check out the overview and documentation at http://prebid.org.

No more week-long development. Header bidding is made easy by prebid.js :)

**Table of Contents**
**Table of Contents**

- [Prebid.js](#)
- [Usage](#usage)
- [Download the latest released code](#download-the-latest-released-code)
- [Example code](#example-code)
- [API](#api)
- [Contribute](#contribute)
- [Add an Bidder Adapter](#add-an-bidder-adapter)
- [Add a Bidder Adapter](#add-a-bidder-adapter)
- [install](#install)
- [Build](#build)
- [Configure](#configure)
- [Run](#run)


Usage
----------
Download the integration example [here](https://github.com/prebid/Prebid.js/blob/master/integrationExamples/gpt/pbjs_example_gpt.html).
Download the integration example [here](https://github.com/prebid/Prebid.js/blob/master/integrationExamples/gpt/pbjs_example_gpt.html).

### Download the latest released code ###
[See the releases page here](https://github.com/prebid/Prebid.js/releases) and download a copy.

### Example code ###

**Include the prebid.js libraray**
**Include the prebid.js library**
Note that you need to host `prebid.js` locally or on a CDN and update the reference in the code snippet below for `cdn.host.com/prebid.min.js
```javascript
(function() {
var d = document, pbs = d.createElement('script'), pro = d.location.protocol;
pbs.type = 'text/javascript';
pbs.src = ((pro === 'https:') ? 'https' : 'http') + '://cdn.host.com/prebid.min.js';
var target = document.getElementsByTagName('head')[0];
target.insertBefore(pbs, target.firstChild);
(function () {
var d = document;
var pbs = d.createElement('script');
pbs.type = 'text/javascript';
//replace with your CDN hosted version. HTTPS is strongly recommended.
pbs.src = '//cdn.host.com/prebid.min.js';
var target = d.getElementsByTagName('script')[0];
target.parentNode.insertBefore(pbs, target);
})();
```

Expand Down Expand Up @@ -77,7 +84,8 @@ pbjs.que.push(function(){
```

**See Console Debug Errors during testing**
By default console errors are supressed. To enabled add `?pbjs_debug=true` to the end of the URL for testing.
By default console errors are suppressed. To enabled add `?pbjs_debug=true` to the end of the URL
for testing.

API
----------
Expand All @@ -87,28 +95,105 @@ Full Developer API reference:

Contribute
----------
**Note:** You need to have at least `node.js 4.x` or greater installed to be able to run the gulp build commands.

### Add a Bidder Adapter ###
Follow the [guide outlined here](http://prebid.org/dev-docs/bidder-adaptor.html) to add an adapter.

### Add an Bidder Adapter ###
Follow the [guide outlined here](http://prebid.org/dev-docs/bidder-adaptor.html) to add an adapter.
### Install ###
$ npm install

### install ###
$ sudo npm install
If you experience errors, after a version update, try a fresh install:

$ rm -rf ./node_modules && npm cache clean && npm install

### Build ###
$ gulp build

Runs code quality checks, generates prebid.js files and creates zip archive distributable:

`./build/dev/prebid.js` Full source code for dev and debug
`./build/dev/prebid.js.map` Source map for dev and debug
`./build/dist/prebid.js` Minified production code
`./prebid.js_<version>.zip` Distributable

Code quality is defined by `./.jscs` and `./.jshint` files and errors are reported in the
terminal. The build will continue with quality errors, however. If you are contributing code
you can configure your editor with the provided .jscs and .jshint settings.

### Configure ###
Edit `./integrationExamples/gpt/pbjs_example_gpt.html`
Edit example file `./integrationExamples/gpt/pbjs_example_gpt.html`:

1. Change `{id}` values appropriately to set up ad units and bidders.

1. Set path for prebid.js in your example file:
#####Development `pbs.src = './build/dev/prebid.js';` #####
```javascript
(function() {
var d = document, pbs = d.createElement('script'), pro = d.location.protocol;
pbs.type = 'text/javascript';
pbs.src = ((pro === 'https:') ? 'https' : 'http') + ':./build/dev/prebid.js';
var target = document.getElementsByTagName('head')[0];
target.insertBefore(pbs, target.firstChild);
})();
```
#####Test/Deploy (default) `pbs.src = './build/dist/prebid.js';`#####
```javascript
(function() {
var d = document, pbs = d.createElement('script'), pro = d.location.protocol;
pbs.type = 'text/javascript';
pbs.src = ((pro === 'https:') ? 'https' : 'http') + './build/dist/prebid.js';
var target = document.getElementsByTagName('head')[0];
target.insertBefore(pbs, target.firstChild);
})();
```
1. (optional optimization) Edit `./package.json` to set the adapters you want to build with:

```json
"adapters": [
"adform",
"aol",
"appnexus",
"indexExchange",
"openx",
"pubmatic",
"pulsepoint",
"rubicon",
"rubiconLegacy",
"sovrn",
"springserve",
"yieldbot"
]
```

Change `{id}` values appropriately

### Run ###

$ gulp serve

Navigate to http://localhost:9999/integrationExamples/gpt/pbjs_example_gpt.html to run the example file
This runs code quality checks, generates prebid files and starts a webserver at
`http://localhost:9999` serving from project root. Navigate to your example implementation to test,
and if your prebid.js file is sourced from the `./build/dev` directory you will have sourcemaps
available in browser developer tools.

Navigate to `http://localhost:9999/integrationExamples/gpt/pbjs_example_gpt.html` to run the
example file.

Navigate to `http://localhost:9999/build/coverage/karma_html/report` to view a test coverage report.

A watch is also in place that will run continuous tests in the terminal as you edit code and
tests.

### Unit Test In the Browser ###
$ gulp test --watch

This will run tests and keep the Karma test browser open. If your prebid.js file is sourced from
the build/dev directory you will also have sourcemaps available when viewing browser developer
tools. Access the Karma debug page at:
`http://localhost:9876/debug.html`
View console for test results and developer tools to set breakpoints in source code.

Navigate to http://localhost:9999/test/spec/runner.html to run the test file.
Detailed code coverage reporting can be generated explicitly with `$ gulp test --coverage` and
results found in `./build/coverage`.

### Supported Browsers ###
Prebid.js is supported on IE9+ and modern browsers.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "prebid-js",
"version": "0.4.1",
"version": "0.6.0",
"authors": [
"Matt Kendall",
"Paul Yang"
],
"description": "Setup and manage header bidding advertising partners without writing code or confusing line items. Prebid.js is open source and free",
"main": "dist/prebid.min.js",
"main": "build/dist/prebid.js",
"keywords": [
"Prebid"
],
Expand Down
16 changes: 16 additions & 0 deletions gulpHelpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
parseBrowserArgs: function (argv) {
return (argv.browsers) ? argv.browsers.split(',') : [];
},

toCapitalCase: function (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
},

jsonifyHTML: function (str) {
console.log(arguments);
return str.replace(/\n/g, '')
.replace(/<\//g, '<\\/')
.replace(/\/>/g, '\\/>');
}
};
Loading