Skip to content

Commit 51648bf

Browse files
author
Andy Tang
committed
Prepared for server side development
1 parent 189115a commit 51648bf

File tree

18 files changed

+265
-97
lines changed

18 files changed

+265
-97
lines changed

Diff for: .bowerrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory": "src/bower_components"
2+
"directory": "src/public/bower_components"
33
}

Diff for: Gruntfile.js

+64-34
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ module.exports = function (grunt) {
4444
return [
4545
lrSnippet,
4646
mountFolder(connect, '.tmp'),
47-
mountFolder(connect, 'src')
47+
mountFolder(connect, 'src/core'),
48+
mountFolder(connect, 'src/public')
4849
];
4950
}
5051
}
@@ -54,7 +55,8 @@ module.exports = function (grunt) {
5455
middleware: function (connect) {
5556
return [
5657
mountFolder(connect, '.tmp'),
57-
mountFolder(connect, 'src')
58+
mountFolder(connect, 'src/core'),
59+
mountFolder(connect, 'src/public')
5860
];
5961
}
6062
}
@@ -75,8 +77,8 @@ module.exports = function (grunt) {
7577
{
7678
expand: true,
7779
dot: true,
78-
cwd: '<%= yeoman.app %>',
79-
dest: '<%= yeoman.dist %>',
80+
cwd: 'src/public',
81+
dest: 'dist',
8082
src: [
8183
'**/*.js',
8284
'**/*.html',
@@ -88,6 +90,15 @@ module.exports = function (grunt) {
8890
'!index.html'
8991
]
9092
},
93+
{
94+
expand: true,
95+
dot: true,
96+
cwd: 'src/core',
97+
dest: 'dist',
98+
src: [
99+
'**/*.js'
100+
]
101+
},
91102
{
92103
expand: true,
93104
cwd: '.tmp/images',
@@ -99,23 +110,23 @@ module.exports = function (grunt) {
99110
{
100111
expand: true,
101112
cwd: '.tmp/fonts',
102-
dest: '<%= yeoman.dist %>/fonts',
113+
dest: 'dist/fonts',
103114
src: [
104115
'*'
105116
]
106117
},
107118
{
108119
expand: true,
109120
cwd: '.tmp/scripts',
110-
dest: '<%= yeoman.dist %>/scripts',
121+
dest: 'dist/scripts',
111122
src: [
112123
'*.js'
113124
]
114125
},
115126
{
116127
expand: true,
117128
cwd: '.tmp/styles',
118-
dest: '<%= yeoman.dist %>/styles',
129+
dest: 'dist/styles',
119130
src: [
120131
'*.css'
121132
]
@@ -124,19 +135,19 @@ module.exports = function (grunt) {
124135
},
125136
images: {
126137
expand: true,
127-
cwd: '<%= yeoman.app %>/images',
138+
cwd: 'src/public/images',
128139
dest: '.tmp/images/',
129140
src: '{,*/}*.{gif,webp,png,jpg}'
130141
},
131142
styles: {
132143
expand: true,
133-
cwd: '<%= yeoman.app %>/styles',
144+
cwd: 'src/public/styles',
134145
dest: '.tmp/styles/',
135146
src: '{,*/}*.css'
136147
},
137148
fonts: {
138149
expand: true,
139-
cwd: '<%= yeoman.app %>/bower_components/bootstrap/dist/fonts',
150+
cwd: 'src/public/bower_components/bootstrap/dist/fonts',
140151
dest: '.tmp/fonts/',
141152
src: '{,*/}*.*'
142153
},
@@ -158,7 +169,7 @@ module.exports = function (grunt) {
158169
out: './'
159170
},
160171
javascript: [
161-
'src/**/*.js', '!src/bower_components/**/*.js', 'README.md'
172+
'src/**/*.js', '!src/public/bower_components/**/*.js', 'README.md'
162173
]
163174
},
164175
jshint: {
@@ -168,7 +179,7 @@ module.exports = function (grunt) {
168179
all: [
169180
'Gruntfile.js',
170181
'src/**/*.js',
171-
'!src/bower_components/**/*.js',
182+
'!**/bower_components/**/*.js',
172183
'test/**/*.js'
173184
]
174185
},
@@ -186,45 +197,52 @@ module.exports = function (grunt) {
186197
main: {
187198
opions: {
188199
paths: [
189-
'src'
200+
'src/public'
190201
]
191202
},
192203
files: {
193-
'.tmp/styles/main.css': 'src/styles/main.less'
204+
'.tmp/styles/main.css': 'src/public/styles/main.less'
194205
}
195206
}
196207
},
208+
mochaTest: {
209+
test: {
210+
options: {
211+
reporter: 'spec'
212+
},
213+
src: ['test/unit/server/**/*.js']
214+
}
215+
},
197216
ngtemplates: {
198217
'4yf': {
199-
src: 'src/views/**/*.html',
218+
src: 'src/public/views/**/*.html',
200219
dest: '.tmp/scripts/templates.js',
201220
options: {
202221
url: function (url) {
203-
return url.replace(/(src\/views\/([\s\S]*?)\/)/, '').replace(/.html/, '');
222+
return url.replace(/(src\/public\/views\/([\s\S]*?)\/)/, '').replace(/.html/, '');
204223
}
205224
}
206225
}
207226
},
208227
processhtml: {
209228
dev: {
210229
files: {
211-
'.tmp/index.html': ['src/index.html']
230+
'.tmp/index.html': ['src/public/index.html']
212231
}
213232
},
214233
dist: {
215234
files: {
216-
'dist/index.html': ['src/index.html']
235+
'dist/index.html': ['src/public/index.html']
217236
}
218237
}
219238
},
220239
uglify: {
221240
dist: {
222241
files: {
223-
'dist/enofjs/min.class.js': [
224-
'src/ClassFactory.js'
225-
],
226-
'dist/enofjs/min.enof.js': [
227-
'src/*.js'
242+
'dist/4yf/min.widgets.js': [
243+
'src/core/**/*.js',
244+
'src/public/**/*.js',
245+
'!**/bower_components/**'
228246
]
229247
}
230248
}
@@ -252,9 +270,9 @@ module.exports = function (grunt) {
252270
files: [
253271
'src/index.html',
254272
'.tmp/**/*.*',
255-
'src/models/{,*/}*.js',
256-
'src/viewModels/{,*/}*.js',
257-
'src/widgets/**/{,*/}*.js',
273+
'src/core/models/**/*.js',
274+
'src/public/viewModels/**/*.js',
275+
'src/public/widgets/**/*.js',
258276
'src/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
259277
]
260278
},
@@ -267,10 +285,19 @@ module.exports = function (grunt) {
267285
karma: {
268286
files: [
269287
'src/**/*.js',
270-
'test/unit/**/*.js'
288+
'!src/server/**',
289+
'test/unit/**/*.js',
290+
'!test/unit/server/**'
271291
],
272292
tasks: ['karma:unitAuto:run']
273293
},
294+
mocha: {
295+
files: [
296+
'src/server/**/*.js',
297+
'test/unit/server/**/*.js'
298+
],
299+
tasks: ['mochaTest:test']
300+
},
274301
styles: {
275302
files: [
276303
'src/**/*.less'
@@ -288,20 +315,23 @@ module.exports = function (grunt) {
288315

289316
grunt.registerTask('build',
290317
'Build all necessary files to actually be able to run the application',
291-
[
292-
'version',
293-
'ngtemplates',
294-
'processhtml',
295-
'less'
296-
]);
318+
function executeBuild() {
319+
require('time-grunt')(grunt);
320+
grunt.task.run([
321+
'version',
322+
'ngtemplates',
323+
'processhtml',
324+
'less'
325+
]);
326+
});
297327

298328
grunt.registerTask('test',
299329
'Testing jshint, unit and e2e tests',
300330
function executeTests() {
301-
require('time-grunt')(grunt);
302331
grunt.task.run([
303332
'jshint',
304333
'karma:unit',
334+
'mochaTest:test',
305335
'uglify'
306336
]);
307337
});

Diff for: README.md

+62-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,65 @@ For Your Feed (4YF)
44
[![Code Climate](https://codeclimate.com/github/EnoF/4YF.png)](https://codeclimate.com/github/EnoF/4YF)
55
[![Coverage Status](https://coveralls.io/repos/EnoF/4YF/badge.png?branch=master)](https://coveralls.io/r/EnoF/4YF?branch=master)
66

7-
4YF is an IRC client - server implementation with focus on messages for you!
7+
4YF is a Chat client with focus on the messages for the user!
8+
9+
Installation
10+
============
11+
Fork and clone the project.
12+
13+
Make sure to install a version of `nodejs` higher then `0.10`.
14+
15+
In the directory where the Gruntfile.js relies, run the following commands:
16+
17+
npm install -g grunt-cli
18+
npm install -g bower
19+
npm install
20+
bower install
21+
22+
You are ready to go!
23+
24+
Running the server
25+
==================
26+
To run the server including serving frontend pages, run the following command:
27+
28+
grunt run
29+
30+
You can now connect to the client at: `http://localhost:9000`.
31+
32+
You can now connect to the server at: `http://localhost:3000`.
33+
34+
Drone.io
35+
========
36+
To connect to your [drone.io](https://drone.io/) account, sign up for free!
37+
*This is an optional step, you can skip if you wish.*
38+
39+
### Setup
40+
On the setup tab set the correct environment variables:
41+
42+
GH_REF=github.com/[your github username]/4YF.git
43+
GH_TOKEN=[your github oauth token]
44+
COVERALLS_SERVICE_NAME=drone.io
45+
COVERALLS_SERVICE_JOB_ID=$BUILD_ID
46+
COVERALLS_REPO_TOKEN=[your coveralls repository token]
47+
COVERALLS_GIT_COMMIT=$GIT_COMMIT
48+
49+
Enter the following commands:
50+
51+
npm install -g bower
52+
npm install -g grunt-cli
53+
sudo pip install Pygments
54+
npm install
55+
bower install
56+
grunt test
57+
grunt coveralls
58+
git checkout master
59+
grunt groc
60+
rm -rf src/**/*.js test .jshintrc bower.json package.json
61+
git config user.name "done.io CI"
62+
git config user.email "[your email used for the commit]"
63+
git add -A
64+
git commit -m "Automatically updated the groc documentation via drone.io"
65+
git push -f --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages
66+
67+
This will test the application on each of your commits! It will also update your documentation on your gh-pages and
68+
update the code coverage on your `coveralls` account!

Diff for: package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
"karma-coverage": "^0",
2727
"karma-jasmine": "^0",
2828
"karma-phantomjs-launcher": "^0",
29-
"time-grunt": "^0"
29+
"time-grunt": "^0",
30+
"grunt-mocha-test": "^0",
31+
"express": "^4",
32+
"supertest": "^0"
3033
},
3134
"engines": {
3235
"node": "^0",
File renamed without changes.
File renamed without changes.

Diff for: src/app.js renamed to src/public/app.js

File renamed without changes.

Diff for: src/index.html renamed to src/public/index.html

File renamed without changes.

Diff for: src/public/styles/main.less

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* For Your Feed (4YF)
3+
* Version: 0.0.1
4+
*
5+
* Copyright (c) 2014.
6+
*/
7+
// Core variables and mixins
8+
@import '/src/public/styles/variables.less';
9+
@import '/src/public/bower_components/bootstrap/less/mixins';
10+
// Reset
11+
@import '/src/public/bower_components/bootstrap/less/normalize';
12+
@import '/src/public/bower_components/bootstrap/less/print';
13+
// Core CSS
14+
@import '/src/public/bower_components/bootstrap/less/scaffolding';
15+
@import '/src/public/bower_components/bootstrap/less/type';
16+
@import '/src/public/bower_components/bootstrap/less/code';
17+
@import '/src/public/bower_components/bootstrap/less/grid';
18+
@import '/src/public/bower_components/bootstrap/less/tables';
19+
@import '/src/public/bower_components/bootstrap/less/forms';
20+
@import '/src/public/bower_components/bootstrap/less/buttons';
21+
// Components
22+
@import '/src/public/bower_components/bootstrap/less/component-animations';
23+
@import '/src/public/bower_components/bootstrap/less/glyphicons';
24+
@import '/src/public/bower_components/bootstrap/less/dropdowns';
25+
@import '/src/public/bower_components/bootstrap/less/button-groups';
26+
@import '/src/public/bower_components/bootstrap/less/input-groups';
27+
@import '/src/public/bower_components/bootstrap/less/navs';
28+
@import '/src/public/bower_components/bootstrap/less/navbar';
29+
@import '/src/public/bower_components/bootstrap/less/breadcrumbs';
30+
@import '/src/public/bower_components/bootstrap/less/pagination';
31+
@import '/src/public/bower_components/bootstrap/less/pager';
32+
@import '/src/public/bower_components/bootstrap/less/labels';
33+
@import '/src/public/bower_components/bootstrap/less/badges';
34+
@import '/src/public/bower_components/bootstrap/less/jumbotron';
35+
@import '/src/public/bower_components/bootstrap/less/thumbnails';
36+
@import '/src/public/bower_components/bootstrap/less/alerts';
37+
@import '/src/public/bower_components/bootstrap/less/progress-bars';
38+
@import '/src/public/bower_components/bootstrap/less/media';
39+
@import '/src/public/bower_components/bootstrap/less/list-group';
40+
@import '/src/public/bower_components/bootstrap/less/panels';
41+
@import '/src/public/bower_components/bootstrap/less/wells';
42+
@import '/src/public/bower_components/bootstrap/less/close';
43+
// Components w/ JavaScript
44+
@import '/src/public/bower_components/bootstrap/less/modals';
45+
@import '/src/public/bower_components/bootstrap/less/tooltip';
46+
@import '/src/public/bower_components/bootstrap/less/popovers';
47+
@import '/src/public/bower_components/bootstrap/less/carousel';
48+
// Utility classes
49+
@import '/src/public/bower_components/bootstrap/less/utilities';
50+
@import '/src/public/bower_components/bootstrap/less/responsive-utilities';
51+
// Widget styles
52+
@import '/src/public/widgets/messageFeed/messageFeed';
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)