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

Nodejs travis check #19

Closed
wants to merge 10 commits into from
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
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: java
script:
- bash create_config.sh && cd java && ./gradlew run
- PROJ_DIR=$(pwd)
- 'bash create_config.sh && cd "${PROJ_DIR}"/java && ./gradlew run'
- 'cd "${PROJ_DIR}"/nodejs && ./create_config.sh && npm install -g grunt-cli && npm install && grunt test'
jdk:
- openjdk6
- openjdk7
Expand All @@ -11,3 +13,7 @@ env:
- secure: ISBTx5dCLRYtT+vp5MXFiZoJMF9l/I+W40fCIGp/OYJVm5uX3QdY9tqmPPJtHyGNYC/U2MNrhg/Z+8opwxQ931e9kCUfg/7nk6EX8t0gYV4tMKkaqr+NJ7S7uyu8SrFbcwABzUo5/91ujKkrsp/R5yQ/kCggDND+utpEVSWB9LY=
- secure: cTja//s9O9IYrCOgjeFp4j0MJzVfjCnADlF69hPQsLaJNAPAGc6JRcUeaOeVZHSMI3y3qh4IGgfAm3QuxyUFTn5RP0OVpDAYri29Ubn7SYA55cho7K+YUZbrnCFuFMypZ8dVVbdZA2cFefUUnVhuGXHFlVUWUPUwUFd0o2oSw5Y=
- secure: j3EAxprAcKq4aaGn/WA9VKn41C9Kismp/I0caLWP6k2dZvk1SZGnaiZXuAeqLxQMQ4cU4WH6qupnxCb/oS+0OxIe6UE7QAM7Xk8e5jp52NTubCkBJH04gi3BSVapLtDK1ePerNJuwOo0LZh9hwGwMWGy2XEZe59B5V50vvyp8Qo=
# nodejs config
- secure: "QZ2NlSrBo/higMc3uuhq769VKtLW2gGa5l9xFxpdNamfuHEjGIQtUhMYQHH3WrP73dC3zAzmB6TslsDxnJCVGAMG3u18nEppXK533dqUnEkForqQhYreVMd4l9JDrTnnHhoHzF1dWHUSjGPXAfuzIjEmJisGPmX8PtdqHSnwNUs="
- secure: "OmiPopj19efW/6KY2wjj+HOuORUweLG/iJdDNUXfe4kWuCXyOwcmEd2EqPT8Q59f8roWhUChNv6Q/ICtdfAgoIVYeZrEwI04Cq/aBEaull03qVZQbxxeNihd/C88R3pCbMF0vNsbVPELCFdSs4+Axe7TnEyRPGYIuxHX1oGPbnQ="
- secure: "N+fLn7A4s1edSuauSMXn8pCjboNo4fqbKC5H3PGRB5fyHH/DSJhAMH3m3hKXDfojIock79Te0v5IEy0sf5Pl0ARrdZ9T8cdXO4MvuJTTr45OBzoSE5LHfGaTgPzOMChgfbQc7kg3gmIP7Roejg192/Q3jFtSH3HkxNlIauE2uFc="
1 change: 0 additions & 1 deletion node-js/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions node-js/README.md

This file was deleted.

81 changes: 0 additions & 81 deletions node-js/app.js

This file was deleted.

4 changes: 0 additions & 4 deletions node-js/config.js

This file was deleted.

24 changes: 0 additions & 24 deletions node-js/package.json

This file was deleted.

5 changes: 5 additions & 0 deletions nodejs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
node_modules
config.js
lib
test
93 changes: 93 additions & 0 deletions nodejs/Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
module.exports = (grunt) ->

# Load grunt tasks automatically
require('load-grunt-tasks')(grunt)

# project configuration
grunt.initConfig

# load package information
pkg: grunt.file.readJSON 'package.json'

# make sure code style is correct
coffeelint:
options: grunt.file.readJSON('node_modules/sphere-coffeelint/coffeelint.json')
default: ['Gruntfile.coffee', './**/*.coffee']

# empties folders to start fresh
clean:
default:
files: [{
dot: true
src: ['lib', 'test']
}]

# compiles coffeescript
coffee:
options:
bare: true
sourceMap: false
default:
files: grunt.file.expandMapping(['**/*.coffee'], 'lib/',
flatten: false
cwd: 'src/coffee'
ext: '.js'
rename: (dest, matchedSrcPath) ->
dest + matchedSrcPath
)
test:
files: grunt.file.expandMapping(['**/*.spec.coffee'], 'test/',
flatten: false
cwd: 'src/spec'
ext: '.spec.js'
rename: (dest, matchedSrcPath) ->
dest + matchedSrcPath
)
testHelpers:
files: grunt.file.expandMapping(['**/*Helper.coffee'], 'test/',
flatten: false
cwd: 'src/spec'
ext: '.js'
rename: (dest, matchedSrcPath) ->
dest + matchedSrcPath
)

# starts express server and set the environment
express:
options:
port: 3000
debug: false
default:
options:
node_env: 'development'
script: 'lib/app.js'
test:
options:
output: 'Listening' # waits for matching message before passing control back to grunt
node_env: 'test'
script: "lib/app.js"

# watching for changes
watch:
options:
spawn: false # Without this option specified express won't be reloaded
default:
files: [
'Gruntfile.coffee',
'src/**/*.coffee',
'./**/*.jade'
]
tasks: ['build', 'express']

shell:
options:
stdout: true
stderr: true
failOnError: true
jasmine:
command: 'jasmine-node --verbose --captureExceptions test'

grunt.registerTask 'build', ['clean', 'coffee']
grunt.registerTask 'run', ['build', 'express:default']
grunt.registerTask 'serve', ['run', 'watch']
grunt.registerTask 'test', ['build', 'express:test', 'shell:jasmine']
14 changes: 14 additions & 0 deletions nodejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
![SPHERE.IO icon](https://admin.sphere.io/assets/images/sphere_logo_rgb_long.png)

# Node.js Hello API

This is an example application to show how easy is to use the SPHERE.IO API using an Express.js application.

**Make sure to have some Products and Categories in your project if you want to see something**

```bash
$ npm install -g grunt-cli && npm install
$ grunt serve
```

> The source code is written in `coffeescript`, if you want to see the `javascript` version simply execute `grunt build` and look at the `lib` folder.
Binary file added nodejs/assets/images/favicon.ico
Binary file not shown.
77 changes: 77 additions & 0 deletions nodejs/assets/stylesheets/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
Inspired by http://getbootstrap.com/examples/offcanvas/
*/

body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333;
background-color: #fff;
padding-top: 70px;
}
@media screen and (min-width: 768px) {
.jumbotron h1, .jumbotron .h1 {
font-size: 50px;
}
}

/*
* Style tweaks
* --------------------------------------------------
*/
html,
body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
body {
padding-top: 70px;
}
footer {
padding: 30px 0;
}

/*
* Off Canvas
* --------------------------------------------------
*/
@media screen and (max-width: 767px) {
.row-offcanvas {
position: relative;
-webkit-transition: all .25s ease-out;
-o-transition: all .25s ease-out;
transition: all .25s ease-out;
}

.row-offcanvas-right {
right: 0;
}

.row-offcanvas-left {
left: 0;
}

.row-offcanvas-right
.sidebar-offcanvas {
right: -50%; /* 6 columns */
}

.row-offcanvas-left
.sidebar-offcanvas {
left: -50%; /* 6 columns */
}

.row-offcanvas-right.active {
right: 50%; /* 6 columns */
}

.row-offcanvas-left.active {
left: 50%; /* 6 columns */
}

.sidebar-offcanvas {
position: absolute;
top: 0;
width: 50%; /* 6 columns */
}
}
10 changes: 10 additions & 0 deletions nodejs/create_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

cat > "config.js" << EOF
/* SPHERE.IO credentials */
exports.config = {
client_id: "${NODE_SPHERE_CLIENT_ID}",
client_secret: "${NODE_SPHERE_CLIENT_SECRET}",
project_key: "${NODE_SPHERE_PROJECT_KEY}"
}
EOF
Loading