Skip to content

Commit

Permalink
#1 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mingos777 committed Jul 29, 2014
0 parents commit 079a4ea
Show file tree
Hide file tree
Showing 18 changed files with 430 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "app/components"
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/app/components/
/app/css/
/app/js/
/build/
/dist/
/node_modules/
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "0.10"

install:
- node_modules/protractor/bin/webdriver-manager update
151 changes: 151 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
module.exports = function(grunt) {
grunt.initConfig({
less: {
dev: {
options: {
cleancss: true
},
files: {
"app/css/style.css": [
"app/less/style.less"
]
}
}
},
concat: {
dev: {
files: {
"app/js/script.js": [
"app/components/angular/angular.js",
"app/components/angular-route/angular-route.js",
"app/scripts/**/*.js"
]
}
}
},
connect: {
test: {
options: {
port: 8000,
hostname: "*",
base: "dist"
}
}
},
uglify: {
dist: {
options: {
mangle: true,
compress: {
drop_console: true
}
},
files: {
"dist/js/script.js": [
"app/js/script.js"
]
}
}
},
copy: {
dist: {
files: [
{ expand: true, cwd: "app/css/", src: ["style.css"], dest: "dist/css/" },
{ expand: true, cwd: "app/", src: ["index.html"], dest: "dist/" },
{ expand: true, cwd: "app/views/", src: ["**/*"], dest: "dist/views/" }
]
}
},
jshint: {
test: {
options: {
browser: true,
camelcase: true,
curly: true,
eqeqeq: true,
es3: true,
forin: true,
freeze: true,
immed: true,
indent: 4,
latedef: true,
maxlen: 120,
newcap: true,
noarg: true,
noempty: true,
nomen: true,
nonbsp: false,
nonew: true,
plusplus: false,
quotmark: true,
undef: true,
strict: false,
trailing: true,
unused: true,

globals: {
"$": true,
angular: true,
jQuery: true,
},
},
files: {
src: ["app/scripts/**/*.js"]
}
}
},
karma: {
test: {
configFile: "karma.conf.js",
singleRun: true
}
},
protractor: {
test: {
options: {
configFile: "protractor.conf.js",
}
}
},
bower: {
dev: {
options: {
targetDir: "app/components",
cleanTargetDir: true
}
}
}
});

// Load tasks
grunt.loadNpmTasks("grunt-bower-task");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-protractor-runner");

// Custom tasks
grunt.registerTask("default", []);

grunt.registerTask("dev", [
"bower:dev",
"less:dev",
"concat:dev"
]);
grunt.registerTask("dist", [
"dev",
"uglify:dist",
"copy:dist"
]);
grunt.registerTask("test", [
"dist",
"jshint:test",
"karma:test",
"connect:test",
"protractor:test"
]);
};
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Review Assist - Angular.js frontend

An example frontend interfacing with Review Assist's REST API.

## Installation

* Clone the repository
* `npm install`
* `node_modules/.bin/bower install`
* `node_modules/.bin/grunt dist`

The built files will be available in the `dist` directory.

## Running

### Development

```
node_modules/.bin/grunt dev
```

Your webserver should serve the files from the `app` directory.

### Dist

```
node_modules/.bin/grunt dist
```

Your webserver should serve the files from the `dist` directory.

## Tests

In order to be able to run the e2e tests, you need to have Java installed (required to run Selenium). Also, you should run this command ONCE in order to download Selenium:

```
node_modules/.bin/webdriver-manager update
```

After that's done, all you need to do is run the test script:

```
npm test
```

The above command will build the project and run all the unit and e2e tests. If instead you prefer to run the unit/e2e tests separately, have a look at the available Grunt tasks.
10 changes: 10 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html ng-app="ra">
<head>
<title>Review Assist</title>
</head>
<body>
<div ng-view></div>
<script src="/js/script.js"></script>
</body>
</html>
Empty file added app/less/style.less
Empty file.
25 changes: 25 additions & 0 deletions app/scripts/ra/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
angular.module("ra", ["ngRoute"]);

angular.module("ra").config([
"$routeProvider",
"$locationProvider",
function(
$routeProvider,
$locationProvider
) {
$routeProvider
.when("/", {
templateUrl: "/views/ra/index.html",
controller: "IndexCtrl"
})
.when("/404", {
templateUrl: "/views/ra/404.html",
controller: "PageCtrl"
})
.otherwise({
redirectTo: "/404"
});

$locationProvider.html5Mode(true);
}
]);
4 changes: 4 additions & 0 deletions app/scripts/ra/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
angular.module("ra").controller("IndexCtrl", [
function()
{}
]);
4 changes: 4 additions & 0 deletions app/scripts/ra/controllers/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
angular.module("ra").controller("PageCtrl", [
function()
{}
]);
2 changes: 2 additions & 0 deletions app/views/ra/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>404</h1>
<p>What do Batman's parents and this page have in common?</p>
2 changes: 2 additions & 0 deletions app/views/ra/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Hello, world!</h1>
<p>Lorem ipsum dolor ist amet consectetur adipiscing elit.</p>
24 changes: 24 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "review-assist",
"version": "0.0.0",
"homepage": "https://github.com/dzielne-misie/review-assist",
"authors": [
"Dominik Marczuk <[email protected]>"
],
"description": "Build artifacts and diff aggregator for making code reviews easier and more pleasant.",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "~1.2.20",
"angular-route": "~1.2.20",
"bootstrap": "~3.2.0"
},
"devDependencies": {
"angular-mocks": "~1.2.21"
}
}
88 changes: 88 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Karma configuration
// Generated on Wed Jul 09 2014 14:10:11 GMT+0200 (CEST)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'app/components/angular/angular.js',
'app/components/angular-route/angular-route.js',
'app/components/angular-mocks/angular-mocks.js',
'app/scripts/**/*.js',
'test/spec/**/*.js'
],


// list of files to exclude
exclude: [

],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'app/scripts/**/*.js': ['coverage']
},

// optionally, configure the reporter
coverageReporter: {
type : 'html',
dir : 'build/coverage/js/'
},

junitReporter: {
outputFile: 'build/test-results.xml'
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: [
'progress',
'coverage',
'junit'
],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
Loading

0 comments on commit 079a4ea

Please sign in to comment.