Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lights #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "lib/"
}
48 changes: 48 additions & 0 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = (grunt) ->

grunt.initConfig
options:
buildDir: 'build/'
srcDir: 'src/'

clean:
main: ['<%= options.buildDir %>']

watch:
src:
files: ['server.coffee', 'index.html', '<%= options.srcDir %>**/*.coffee']
tasks: ['default']

coffee:
compile:
files: [{
expand: true
src: ['<%= options.srcDir %>**/*.coffee']
dest: '<%= options.buildDir %>front/'
ext: '.js'
}, {
src: ['server.coffee']
dest: '<%= options.buildDir %>server.js'
}]
copy:
main:
files:[{
expand: true
src: ['lib/**/*.js']
dest: '<%= options.buildDir %>front/'
}, {
src: ['index.html']
dest: '<%= options.buildDir %>front/index.html'
}]


grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-copy')

grunt.registerTask('default', [
'clean:main'
'coffee:compile'
'copy:main'
])
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
Бонусные задания:
* Вернуть светофор в исходное состояние так, как будто бы трамвай не проезжал
* Адекватный возврат в исходное состояние: например, если исходное состояние было "красный" и осталось гореть 5 секунд, то возвращаться в него не стоит

Запуск:
npm install
node build/server.js

Приложение висит на http://localhost:3000/
22 changes: 22 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "1-lights",
"version": "0.0.0",
"homepage": "https://github.com/vladlutkov/1-lights",
"authors": [
"Vladislav Lutkov"
],
"description": "Task",
"main": "src/lights.coffee",
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"eventEmitter": "~4.2.11"
}
}
34 changes: 34 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Lights</title>
<style type="text/css">
.light {
width: 50px;
height: 50px;
border: 1px solid black;
border-radius: 25px;
opacity: 0.3;
margin: 20px;
}
#red {
background-color: red;
}
#yellow {
background-color: yellow;
}
#green {
background-color: green;
}
</style>
</head>
<body>
<div class="light" id="red"></div>
<div class="light" id="yellow"></div>
<div class="light" id="green"></div>
<script type="text/javascript" src="lib/eventEmitter/EventEmitter.js"></script>
<script type="text/javascript" src="src/view.js"></script>
<script type="text/javascript" src="src/lights.js"></script>
</body>
</html>
40 changes: 40 additions & 0 deletions lib/eventEmitter/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "eventEmitter",
"description": "Event based JavaScript for the browser",
"version": "4.2.11",
"main": [
"./EventEmitter.js"
],
"author": {
"name": "Oliver Caldwell",
"web": "http://oli.me.uk/"
},
"licenses": [
{
"type": "Unlicense",
"url": "http://unlicense.org/"
}
],
"keywords": [
"events",
"structure"
],
"ignore": [
"docs",
"tests",
"tools",
".gitignore",
"package.json"
],
"homepage": "https://github.com/Wolfy87/EventEmitter",
"_release": "4.2.11",
"_resolution": {
"type": "version",
"tag": "v4.2.11",
"commit": "5da7b55b628b210f2e9b8bd87ae6e4035321d72b"
},
"_source": "git://github.com/Wolfy87/EventEmitter.git",
"_target": "~4.2.11",
"_originalSource": "eventEmitter",
"_direct": true
}
Loading