Skip to content

Commit

Permalink
move to new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardPosselt committed Aug 12, 2013
1 parent 20491d0 commit 269f76e
Show file tree
Hide file tree
Showing 31 changed files with 2,281 additions and 582 deletions.
47 changes: 46 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
node_modules/
*.log
build/artifacts
.rvm

# just sane ignores
.*.sw[po]
*.bak
*.BAK
*~
report
*.orig
*.class
.cvsignore
Thumbs.db
*.py[co]
_darcs/*
CVS/*
.svn/*
RCS/*

# kdevelop
.kdev
*.kdev4

# Lokalize
*lokalize*

# eclipse
.project
.settings

# netbeans
nbproject

# phpStorm
.idea

# geany
*.geany

# Cloud9IDE
.settings.xml

# vim ex mode
.vimrc

# Mac OS
.DS_Store
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: php
php:
- 5.3
- 5.4

script:
- sudo add-apt-repository -y ppa:chris-lea/node.js
- sudo apt-get update
- sudo apt-get -y install nodejs
- wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2
- tar xjf phantomjs-1.9.0-linux-x86_64.tar.bz2
- sudo ln -s $(pwd)/phantomjs-1.9.0-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
- cd build && make unit-tests
75 changes: 42 additions & 33 deletions js/Gruntfile.js → build/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,55 @@

/**
* Copyright (c) 2013, Bernhard Posselt <[email protected]>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING file.
* ownCloud - Notes app
*
* @author Bernhard Posselt
*
* @copyright 2013 Bernhard Posselt <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/


module.exports = function(grunt) {

// load needed modules
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-wrap');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-phpunit');
grunt.loadNpmTasks('gruntacular');


grunt.initConfig({

meta: {
pkg: grunt.file.readJSON('package.json'),
version: '<%= meta.pkg.version %>',
production: 'public/'
production: '../js/public/'
},

concat: {
options: {
// remove license headers
stripBanners: true,
banner: '/**\n' +
' * Copyright (c) 2013, Bernhard Posselt '+
'<[email protected]> \n' +
' * This file is licensed under the Affero ' +
'General Public License version 3 or later. \n' +
' * See the COPYING file.\n */\n\n'
stripBanners: true
},
dist: {
src: [
'app/app.js',
'app/directives/*.js',
'app/controllers/*.js',
'app/services/**/*.js'
'../js/config/app.js',
'../js/app/**/*.js'
],
dest: '<%= meta.production %>app.js'
}
Expand All @@ -51,13 +61,18 @@ module.exports = function(grunt) {
dest: '',
wrapper: [
'(function(angular, $, oc_requesttoken, undefined){\n\n\'use strict\';\n\n',
'\n})(window.angular, jQuery, oc_requesttoken);'
'\n})(angular, jQuery, oc_requesttoken);'
]
}
},

jshint: {
files: ['Gruntfile.js', 'app/**/*.js', 'tests/**/*.js'],
files: [
'Gruntfile.js',
'../js/app/**/*.js',
'../js/config/*.js',
'../tests/js/unit/**/*.js'
],
options: {
// options here to override JSHint defaults
globals: {
Expand All @@ -67,51 +82,45 @@ module.exports = function(grunt) {
},

watch: {
// this watches for changes in the app directory and runs the concat
// this watches for changes in the app directory and runs the concat
// and wrap tasks if something changed
concat: {
files: [
'app/**/*.js'
'../js/app/**/*.js',
'../js/config/*.js'
],
tasks: ['build']
},
phpunit: {
files: '../**/*.php',
tasks: 'phpunit'
tasks: ['phpunit']
}
},

phpunit: {
classes: {
dir: '../tests'
dir: '../tests/php/unit'
},
options: {
colors: true
}
},

testacular: {
karma: {
unit: {
configFile: 'config/testacular_conf.js'
configFile: '../tests/js/config/karma.js'
},
continuous: {
configFile: 'config/testacular_conf.js',
configFile: '../tests/js/config/karma.js',
singleRun: true,
browsers: ['PhantomJS'],
reporters: ['progress', 'junit'],
junitReporter: {
outputFile: 'test-results.xml'
}
reporters: ['progress']
}
}

});

// make tasks available under simpler commands
grunt.registerTask('build', ['jshint', 'concat', 'wrap']);
grunt.registerTask('watchjs', ['watch:concat']);
grunt.registerTask('ci', ['testacular:continuous']);
grunt.registerTask('testphp', ['watch:phpunit']);
grunt.registerTask('testjs', ['testacular:unit']);

};
100 changes: 100 additions & 0 deletions build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# ownCloud scaffolder tool
#
# Copyright (C) 2013 Bernhard Posselt, <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.


# Makefile for building the project
app_name=notes
project_dir=$(CURDIR)/../../$(app_name)
build_dir=$(CURDIR)/artifacts
appstore_dir=$(build_dir)/appstore
package_name=$(app_name)

# binary directories for running the CI tests
firefox_bin=/usr/bin/firefox
chrome_bin=/usr/bin/chromium
phantomjs_bin=/usr/bin/phantomjs

# common directories
grunt_dir=$(CURDIR)/node_modules/grunt-cli/bin/grunt
gruntfile_dir=$(CURDIR)/Gruntfile.js

js_dir=$(CURDIR)/../js
js_public_dir=$(js_dir)/public

php_unit_tests_dir=$(CURDIR)/../tests/php/unit
php_integration_tests_dir=$(CURDIR)/../tests/php/integration
php_acceptance_tests_dir=$(CURDIR)/../tests/php/acceptance



# building the javascript
all: build

build: deps
mkdir -p $(js_public_dir)
$(grunt_dir) --config $(gruntfile_dir) build

watch: build
$(grunt_dir) --config $(gruntfile_dir) watch:concat

# testing
tests: js-unit-tests php-unit-tests php-integration-tests php-acceptance-tests

unit-tests: js-unit-tests php-unit-tests


# testing js
js-unit-tests: deps
export PHANTOMJS_BIN=$(phantomjs_bin) && \
$(grunt_dir) --config $(gruntfile_dir) karma:continuous

watch-js-unit-tests: deps
export CHROME_BIN=$(chrome_bin) && export FIREFOX_BIN=$(firefox_bin) && \
$(grunt_dir) --config $(gruntfile_dir) karma:unit


# testing php
php-unit-tests: deps
phpunit $(php_unit_tests_dir)

watch-php-unit-tests: deps
$(grunt_dir) --config $(gruntfile_dir) watch:phpunit

php-integration-tests: deps
phpunit $(php_integration_tests_dir)

php-acceptance-tests: deps
cd $(php_acceptance_tests_dir); make headless


# general
deps:
npm install --deps

clean:
rm -rf $(CURDIR)/node_modules
rm -rf $(build_dir)

dist: appstore

appstore: clean
mkdir -p $(appstore_dir)
tar cvzf $(appstore_dir)/$(package_name).tar.gz $(project_dir) \
--exclude-vcs --exclude=$(project_dir)/build/artifacts #\
# --exclude=$(project_dir)/tests \
#--exclude=$(project_dir)/.travis.yml
45 changes: 45 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Notes development instructions

## Dependencies

The following dependencies are required to build the project:

* gzip
* tar
* make
* node.js >= 0.8


## Build the project

To build the whole project run:

make

To build the project when a javascript file changes run:

make watch

## Running the test suites

The following make commands are available:

make tests # runs all tests
make unit-tests # runs only unit tests
make js-unit-tests
make php-unit-tests
make php-integration-tests
make php-acceptance-tests

The following make commands are available for TDD which run the unit tests once a file changes

make watch-php-unit-tests
make watch-js-unit-tests

## Distributing the app on the appstore

To package the app for the appstore run:

make appstore

The package is then available in **build/artifacts/appstore/**
10 changes: 6 additions & 4 deletions js/package.json → build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "owncloud-notes",
"description": "ownCloud Notes app",
"name": "notes",
"description": "Notes app",
"version": "0.0.1",
"private": true,
"homepage": "https://github.com/owncloud/notes",
Expand All @@ -14,11 +14,13 @@
"grunt": "*",
"grunt-cli": "*",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-watch": "*",
"grunt-coffeelint": "*",
"karma": "*",
"grunt-karma": "*",
"grunt-wrap": "*",
"phantomjs": "*",
"grunt-phpunit": "*"
},
"engine": "node >= 0.8"
}
}
2 changes: 2 additions & 0 deletions build/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<phpunit bootstrap="../tests/php/autoloader.php">
</phpunit>
Loading

0 comments on commit 269f76e

Please sign in to comment.