Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2 from prebid/master
Browse files Browse the repository at this point in the history
Merge Prebid
  • Loading branch information
mpereira96 committed Apr 5, 2016
2 parents 80bae86 + 1fd5b7b commit 5b02d32
Show file tree
Hide file tree
Showing 67 changed files with 6,685 additions and 18,816 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "presets": ["es2015"] }
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Built Files
node_modules/
build

# Test Files
test/app
gpt.html

# Dev File

integrationExamples/gpt/gpt.html
integrationExamples/implementations/

# Coverage reports
build/coverage/

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

Expand Down
11 changes: 11 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"maxErrors": 1000,
"esnext": true,
"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
}
}
110 changes: 94 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ 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)
Expand All @@ -23,17 +23,17 @@ No more week-long development. Header bidding is made easy by prebid.js :)
- [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() {
Expand Down Expand Up @@ -77,7 +77,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 +88,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.

### Install ###
$ npm install

### Add an Bidder Adapter ###
Follow the [guide outlined here](http://prebid.org/dev-docs/bidder-adaptor.html) to add an adapter.
If you experience errors, after a version update, try a fresh install:

### install ###
$ sudo npm 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
Loading

0 comments on commit 5b02d32

Please sign in to comment.