Skip to content

Commit

Permalink
First commit. Good luck!
Browse files Browse the repository at this point in the history
  • Loading branch information
marfago committed Jan 19, 2015
0 parents commit 956f38a
Show file tree
Hide file tree
Showing 94 changed files with 3,623 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": "public/lib"
}
15 changes: 15 additions & 0 deletions .csslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"adjoining-classes": false,
"box-model": false,
"box-sizing": false,
"floats": false,
"font-sizes": false,
"important": false,
"known-properties": false,
"overqualified-elements": false,
"qualified-headings": false,
"regex-selectors": false,
"unique-headings": false,
"universal-selector": false,
"unqualified-attributes": false
}
36 changes: 36 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# EditorConfig is awesome: http://EditorConfig.org

# Howto with your editor:
# Sublime: https://github.com/sindresorhus/editorconfig-sublime

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[**]
end_of_line = lf
insert_final_newline = true

# Standard at: https://github.com/felixge/node-style-guide
[**.js, **.json]
trim_trailing_whitespace = true
indent_style = tab
quote_type = single
curly_bracket_next_line = false
spaces_around_operators = true
space_after_control_statements = true
space_after_anonymous_functions = false
spaces_in_brackets = false

# No Standard. Please document a standard if different from .js
[**.yml, **.html, **.css]
trim_trailing_whitespace = true
indent_style = tab

# No standard. Please document a standard if different from .js
[**.md]
indent_style = tab

# Standard at:
[Makefile]
indent_style = tab
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.nodemonignore
.sass-cache/
npm-debug.log
node_modules/
public/lib
app/tests/coverage/
.bower-*/
.idea/
42 changes: 42 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"quotmark": "single", // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": false, // Warn unused variables.
"strict": true, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
"globals": { // Globals variables.
"jasmine": true,
"angular": true,
"ApplicationConfiguration": true
},
"predef": [ // Extra globals.
"define",
"require",
"exports",
"module",
"describe",
"before",
"beforeEach",
"after",
"afterEach",
"it",
"inject",
"expect"
],
"indent": 4, // Specify indentation spacing
"devel": true, // Allow development statements e.g. `console.log();`.
"noempty": true // Prohibit use of empty blocks.
}
1 change: 1 addition & 0 deletions .slugignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/app/tests
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "0.10"
env:
- NODE_ENV=travis
services:
- mongodb
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM dockerfile/nodejs

MAINTAINER Matthias Luebken, [email protected]

WORKDIR /home/mean

# Install Mean.JS Prerequisites
RUN npm install -g grunt-cli
RUN npm install -g bower

# Install Mean.JS packages
ADD package.json /home/mean/package.json
RUN npm install

# Manually trigger bower. Why doesnt this work via npm install?
ADD .bowerrc /home/mean/.bowerrc
ADD bower.json /home/mean/bower.json
RUN bower install --config.interactive=false --allow-root

# Make everything available for start
ADD . /home/mean

# currently only works for development
ENV NODE_ENV development

# Port 3000 for server
# Port 35729 for livereload
EXPOSE 3000 35729
CMD ["grunt"]
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## License
(The MIT License)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: ./node_modules/.bin/forever -m 5 server.js
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
RESCT-CONVERTER!
===================

Online parser e converter da excel a json/csv. L'applicazione è costruita usando lo stack mean.js [MEANS.JS](http://meanjs.org/) e espone una parte web su [http://localhost:3000](http://localhost:3000) e alcusi servizi REST.

----------


Dipendenze
-------------

Node.js
Npm
MongoDb
Grunt
Bower

Installazione
-------------

Fare riferimento a [installazione means.js](http://meanjs.org/docs.html#getting-started).

Esempi
-------------

-Avviare MongoDb
-Avviare il server con il comando 'grunt'

Il server rest può essere testato utilizzando [Postman per Chrome](https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en) e impostando una chiamata PUT con un parametro di tipo file e name='file' con il riferimento al file excel da converire.




THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file added Taranto QA 2013.xlsx
Binary file not shown.
77 changes: 77 additions & 0 deletions app/controllers/converter.server.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
'use strict';

/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
_ = require('lodash'),
fs = require('fs'),
XLSX = require('XLSX'),
uuid = require('uuid'),
multiparty = require('multiparty'),
temp = require('temp').track()
;

/**
* Create a Converter
*/
exports.convert = function(req, res) {
console.log('convert api called');

var form = new multiparty.Form();
form.parse(req, function(err, fields, files) {
var file = files.file[0].path;
var workbook = XLSX.readFile(file);

var result = {};
var sheet_name_list = workbook.SheetNames;
sheet_name_list.forEach(function(y) {
var sheet = {};
var worksheet = workbook.Sheets[y];
for (var z in worksheet) {
if(z[0] === '!') continue;
sheet[z] = worksheet[z].v;
}
result[y] = sheet;
});
return res.send(result);
});

console.log('Converting xlsx');
return res.status(200);
};

/**
* Create a Converter
*/
exports.create = function(req, res) {

};

/**
* Show the current Converter
*/
exports.read = function(req, res) {

};

/**
* Update a Converter
*/
exports.update = function(req, res) {

};

/**
* Delete an Converter
*/
exports.delete = function(req, res) {

};

/**
* List of Converters
*/
exports.list = function(req, res) {

};
11 changes: 11 additions & 0 deletions app/controllers/core.server.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

/**
* Module dependencies.
*/
exports.index = function(req, res) {
res.render('index', {
user: req.user || null,
request: req
});
};
42 changes: 42 additions & 0 deletions app/controllers/errors.server.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

/**
* Get unique error field name
*/
var getUniqueErrorMessage = function(err) {
var output;

try {
var fieldName = err.err.substring(err.err.lastIndexOf('.$') + 2, err.err.lastIndexOf('_1'));
output = fieldName.charAt(0).toUpperCase() + fieldName.slice(1) + ' already exists';

} catch (ex) {
output = 'Unique field already exists';
}

return output;
};

/**
* Get the error message from error object
*/
exports.getErrorMessage = function(err) {
var message = '';

if (err.code) {
switch (err.code) {
case 11000:
case 11001:
message = getUniqueErrorMessage(err);
break;
default:
message = 'Something went wrong';
}
} else {
for (var errName in err.errors) {
if (err.errors[errName].message) message = err.errors[errName].message;
}
}

return message;
};
16 changes: 16 additions & 0 deletions app/controllers/users.server.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

/**
* Module dependencies.
*/
var _ = require('lodash');

/**
* Extend user's controller
*/
module.exports = _.extend(
require('./users/users.authentication.server.controller'),
require('./users/users.authorization.server.controller'),
require('./users/users.password.server.controller'),
require('./users/users.profile.server.controller')
);
Loading

0 comments on commit 956f38a

Please sign in to comment.