Skip to content

Commit

Permalink
try to migrate to oc7
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Posselt committed Nov 8, 2014
1 parent 4b247c4 commit 7627c57
Show file tree
Hide file tree
Showing 38 changed files with 292 additions and 744 deletions.
File renamed without changes.
20 changes: 5 additions & 15 deletions app/notes.php → appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @copyright Bernhard Posselt 2012, 2014
*/

namespace OCA\Notes\App;
namespace OCA\Notes\AppInfo;

use \OC\Files\View;

Expand All @@ -23,10 +23,8 @@

use \OCA\Notes\Utility\FileSystemUtility;

use \OCA\Notes\Middleware\CORSMiddleware;


class Notes extends App {
class Application extends App {


/**
Expand All @@ -42,7 +40,7 @@ public function __construct(array $urlParams=array()){
*/
$container->registerService('PageController', function($c){
return new PageController(
$c->query('AppName'),
$c->query('AppName'),
$c->query('Request'),
$c->query('NotesService'),
$c->query('CoreConfig'),
Expand All @@ -52,7 +50,7 @@ public function __construct(array $urlParams=array()){

$container->registerService('NotesController', function($c){
return new NotesController(
$c->query('AppName'),
$c->query('AppName'),
$c->query('Request'),
$c->query('NotesService'),
$c->query('CoreConfig'),
Expand All @@ -62,7 +60,7 @@ public function __construct(array $urlParams=array()){

$container->registerService('NotesApiController', function($c){
return new NotesApiController(
$c->query('AppName'),
$c->query('AppName'),
$c->query('Request'),
$c->query('NotesService')
);
Expand Down Expand Up @@ -117,14 +115,6 @@ public function __construct(array $urlParams=array()){
return new FileSystemUtility($c->query('FileSystem'));
});

/**
* Middleware
*/
$container->registerService('CORSMiddleware', function($c){
return new CORSMiddleware($c->query('Request'));
});

$container->registerMiddleWare('CORSMiddleware');

}

Expand Down
12 changes: 7 additions & 5 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
* @copyright Bernhard Posselt 2012, 2014
*/

namespace OCA\Notes;
namespace OCA\Notes\AppInfo;

use \OCA\Notes\App\Notes;
use \OCA\Notes\AppInfo\Application;

$application = new Notes();
$application = new Application();
$application->registerRoutes($this, array('routes' => array(
// page
array('name' => 'page#index', 'url' => '/', 'verb' => 'GET'),
Expand All @@ -33,6 +33,8 @@
array('name' => 'notes_api#get', 'url' => '/api/v0.2/notes/{id}', 'verb' => 'GET'),
array('name' => 'notes_api#create', 'url' => '/api/v0.2/notes', 'verb' => 'POST'),
array('name' => 'notes_api#update', 'url' => '/api/v0.2/notes/{id}', 'verb' => 'PUT'),
array('name' => 'notes_api#destroy', 'url' => '/api/v0.2/notes/{id}', 'verb' => 'DELETE'),
array('name' => 'notes_api#cors', 'url' => '/api/v0.2/{path}', 'verb' => 'OPTIONS', 'requirements' => array('path' => '.+')),
array('name' => 'notes_api#destroy', 'url' => '/api/v0.2/notes/{id}', 'verb' => 'DELETE'),
array('name' => 'notes_api#preflighted_cors',
'url' => '/api/v0.2/{path}', 'verb' => 'OPTIONS',
'requirements' => array('path' => '.+')),
)));
4 changes: 0 additions & 4 deletions build/.bowerrc

This file was deleted.

45 changes: 0 additions & 45 deletions build/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions build/phpunit.xml

This file was deleted.

10 changes: 5 additions & 5 deletions controller/notesapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace OCA\Notes\Controller;

use \OCP\AppFramework\Controller;
use \OCP\AppFramework\ApiController;
use \OCP\AppFramework\Http\JSONResponse;
use \OCP\AppFramework\Http\Response;
use \OCP\AppFramework\Http;
Expand All @@ -21,12 +21,12 @@
use \OCA\Notes\Service\NoteDoesNotExistException;


class NotesApiController extends Controller {
class NotesApiController extends ApiController {

private $notesService;
private $settings;

public function __construct($appName,
public function __construct($appName,
IRequest $request,
NotesService $notesService){
parent::__construct($appName, $request);
Expand Down Expand Up @@ -151,11 +151,11 @@ public function cors() {

$response = new Response();
$response->addHeader('Access-Control-Allow-Origin', $origin);
$response->addHeader('Access-Control-Allow-Methods',
$response->addHeader('Access-Control-Allow-Methods',
'PUT, POST, GET, DELETE');
$response->addHeader('Access-Control-Allow-Credentials', 'true');
$response->addHeader('Access-Control-Max-Age', '1728000');
$response->addHeader('Access-Control-Allow-Headers',
$response->addHeader('Access-Control-Allow-Headers',
'Authorization, Content-Type');
return $response;
}
Expand Down
4 changes: 4 additions & 0 deletions js/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "vendor"

}
28 changes: 14 additions & 14 deletions build/Gruntfile.js → js/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = function(grunt) {
meta: {
pkg: grunt.file.readJSON('package.json'),
version: '<%= meta.pkg.version %>',
production: '../js/public/'
production: 'public/'
},

concat: {
Expand All @@ -48,9 +48,9 @@ module.exports = function(grunt) {
},
dist: {
src: [
'../js/polyfills/**/*.js',
'../js/config/app.js',
'../js/app/**/*.js'
'polyfills/**/*.js',
'config/app.js',
'app/**/*.js'
],
dest: '<%= meta.production %>app.js'
}
Expand All @@ -70,9 +70,9 @@ module.exports = function(grunt) {
jshint: {
files: [
'Gruntfile.js',
'../js/app/**/*.js',
'../js/config/*.js',
'../tests/js/unit/**/*.js'
'app/**/*.js',
'config/*.js',
'tests/js/unit/**/*.js'
],
options: {
// options here to override JSHint defaults
Expand All @@ -87,11 +87,11 @@ module.exports = function(grunt) {
// and wrap tasks if something changed
concat: {
files: [
'../js/polyfills/**/*.js',
'../js/app/**/*.js',
'../js/config/*.js',
'../css/**/*.css',
'../templates/**/*.php'
'polyfills/**/*.js',
'app/**/*.js',
'config/*.js',
'css/**/*.css',
'templates/**/*.php'
],
options: {
livereload: true
Expand All @@ -115,10 +115,10 @@ module.exports = function(grunt) {

karma: {
unit: {
configFile: '../tests/js/config/karma.js'
configFile: 'karma.conf.js'
},
continuous: {
configFile: '../tests/js/config/karma.js',
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['PhantomJS'],
reporters: ['progress']
Expand Down
File renamed without changes.
26 changes: 13 additions & 13 deletions tests/js/config/karma.js → js/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
module.exports = function(config) {
config.set({
frameworks: ['jasmine'],
basePath: '../../../',
basePath: '',
// list of files / patterns to load in the browser
files: [
'js/polyfills/**/*.js',
'js/vendor/jquery/dist/jquery.js',
'js/vendor/markdown/lib/markdown.js',
'js/vendor/angular/angular.js',
'js/vendor/underscore/underscore.js',
'js/vendor/angular-route/angular-route.js',
'js/vendor/restangular/dist/restangular.js',
'js/vendor/angular-mocks/angular-mocks.js',
'tests/js/stubs/**/*.js',
'js/app/**/*.js',
'tests/js/unit/**/*.js'
'polyfills/**/*.js',
'vendor/jquery/dist/jquery.js',
'vendor/markdown/lib/markdown.js',
'vendor/angular/angular.js',
'vendor/underscore/underscore.js',
'vendor/angular-route/angular-route.js',
'vendor/restangular/dist/restangular.js',
'vendor/angular-mocks/angular-mocks.js',
'tests/stubs/**/*.js',
'app/**/*.js',
'tests/unit/**/*.js'
],

// list of files to exclude
Expand Down Expand Up @@ -73,7 +73,7 @@ module.exports = function(config) {
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
browsers: ['Firefox'],

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 5000,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
55 changes: 0 additions & 55 deletions middleware/corsmiddleware.php

This file was deleted.

2 changes: 2 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<phpunit bootstrap="tests/autoloader.php">
</phpunit>
Loading

0 comments on commit 7627c57

Please sign in to comment.