Skip to content
This repository was archived by the owner on Dec 18, 2019. It is now read-only.
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
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:0.10

RUN apt-get -y update && apt-get install -y ruby rubygems

ADD ./Gemfile .

RUN gem install bundler
RUN bundle install

RUN npm install -g grunt


5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem 'sass', "3.2.9"
gem 'sass-globbing', ">= 1.1.0"
gem 'compass', "0.12.2"
20 changes: 20 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
chunky_png (1.3.3)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
fssm (0.2.10)
sass (3.2.9)
sass-globbing (1.1.1)
sass (>= 3.1)

PLATFORMS
ruby

DEPENDENCIES
compass (= 0.12.2)
sass (= 3.2.9)
sass-globbing (>= 1.1.0)
53 changes: 39 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,21 @@ module.exports = function(grunt) {
options: {
livereload: true
}
},
express: {
files: [
'server.js',
'server/**/*.{js,json}'
],
tasks: ['newer:jshint:server', 'express:dev', 'wait'],
options: {
livereload: true,
nospawn: true //Without this option specified express won't be reloaded
}
// },
// Do not watch express code, use nodemon instead.
// It breaks debugger.
// https://github.com/ChrisWren/grunt-nodemon/issues/38#issuecomment-36413725
//
// express: {
// files: [
// 'server.js',
// 'server/**/*.{js,json}'
// ],
// tasks: ['newer:jshint:server', 'express:dev', 'wait'],
// options: {
// livereload: true,
// nospawn: true //Without this option specified express won't be reloaded
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this isn't required anymore we can delete it

}
},

Expand Down Expand Up @@ -162,7 +166,7 @@ module.exports = function(grunt) {
'node-inspector': {
custom: {
options: {
'web-host': 'localhost'
'web-host': '0.0.0.0'
}
}
},
Expand All @@ -172,7 +176,7 @@ module.exports = function(grunt) {
debug: {
script: 'server.js',
options: {
nodeArgs: ['--debug-brk'],
nodeArgs: ['--debug'],
env: {
PORT: process.env.PORT || 9000
},
Expand All @@ -184,7 +188,11 @@ module.exports = function(grunt) {
// opens browser on initial server start
nodemon.on('config:update', function() {
setTimeout(function() {
require('open')('http://localhost:8080/debug?port=5858');
try {
require('open')('http://localhost:8080/debug?port=5858');
} catch (e) {
console.log('You can now access debug interface at http://localhost:8080/debug?port=5858');
}
}, 500);
});
}
Expand Down Expand Up @@ -383,6 +391,15 @@ module.exports = function(grunt) {
logConcurrentOutput: true
}
},
fig: {
tasks: [
'concurrent:debug',
'watch'
],
options: {
logConcurrentOutput: true
}
},
dist: [
'compass:dist',
'imagemin',
Expand Down Expand Up @@ -469,6 +486,14 @@ module.exports = function(grunt) {
]);
}

if (target === 'fig') {
return grunt.task.run([
'clean:server',
'concurrent:server',
'concurrent:fig'
]);
}

grunt.task.run([
'clean:server',
'concurrent:server',
Expand Down
89 changes: 89 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env bash

# This is the project root.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"

# Log a message.
function log {
echo -e " \033[32m*\033[0m ${1}"
}
# write an error message.
function error {
echo -e "\033[31m${1}\033[0m"
}


#
# Utilities to check core dependencies
#
function check_npm_installed {
if [ -z "$(which npm)" ] ;
then
error "Node and npm are required"
exit 1;
fi
}

function check_bundler_installed {
if [ -z "$(which bundle)" ] ;
then
if [ -z "$(which gem)" ] ;
then
error "Ruby and gem are required (install with ruby executable in your path)"
exit 1;
fi

log "Install bundler."
gem install bundler
fi
}

function check_deps {
check_npm_installed
# check_bundler_installed
}

#
# utilities to install packages.
#

function install_npm {
if [ -z "$(which grunt)" ] ;
then
log "Install grunt cli"
npm install grunt-cli
fi
log "Install npm dependencies"
npm install
}

function install_bower {
log "Install bower dependencies"
$DIR/node_modules/.bin/bower install
}

function install_submodule {
log "Install git submodules"
git submodule update --init
}

function install_gem {
log "Install gem files";
bundle install
}

function install {
check_deps
install_npm
install_bower
install_gem
#install_submodule
}

install

if [ $? -eq 0 ] ; then
log "Everything went fine."
else
error "An error append, please check command output for more information."
fi
45 changes: 45 additions & 0 deletions doc/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Webdrivercss Adminpanel Installation
====================================

## Local Machine

You will need the following installed on system:

* nodejs and npm
* ruby

```
# Fetch code
git clone https://github.com/webdriverio/webdrivercss-adminpanel.git
cd webdrivercss-adminpanel

# Install dependencies
./bin/install

# install grunt-cli
npm install -g grunt-cli

# Build and serve code
grunt serve:dev
```

## Using Docker and Fig

You will need the following installed on system:

* [docker](http://docker.com)
* [fig](http://fig.sh)

```
# Fetch code
git clone https://github.com/webdriverio/webdrivercss-adminpanel.git
cd webdrivercss-adminpanel

# Install dependencies
fig run npm install

# Up
fig up frontend
```

More information about what is happening in `fig.yml` file.
38 changes: 38 additions & 0 deletions fig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is the main entry point.
#
# Service is exposed on port 9000.
#
# Each time container is restarted, generated files are cleaned and recreated.
#
# fig up frontend
frontend:
build: .
environment:
- PORT=9000
ports:
- "9000:9000"
- "8080:8080"
links:
- db
volumes:
- .:/usr/src/adminpanel
working_dir: /usr/src/adminpanel
command: run fig
entrypoint: npm

# Run npm commands from this container
#
# fig run npm install
# fig run npm run dev
npm:
build: .
volumes:
- .:/usr/src/adminpanel
working_dir: /usr/src/adminpanel
command: install
entrypoint: npm


# Add a mongo database.
db:
image: mongo:2.6
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
"node": ">=0.10.0"
},
"scripts": {
"postinstall": "./node_modules/.bin/bower install",
"start": "grunt serve:dist",
"fig": "grunt serve:fig",
"dev": "grunt serve:debug",
"test": "grunt test"
}
}