Added Generator

This commit is contained in:
Lee Olayvar
2014-11-21 05:09:19 +00:00
parent 68e9c91bb4
commit 965041aed1
5 changed files with 173 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

24
Teams/TeamKoders/ABOUT.md Normal file
View File

@@ -0,0 +1,24 @@
This is our page
================
We are the Koding team, so we are not really participating. But this page is here
to give you an idea about your own page.
About your team
===========================
Tell us who you are, why you did you decide to join?
Judges will read this page before making a final decision, so write your story, make it emotional and impressive.
Tell us why you want to win.
About your skills and what you are going to do?
=======
Don't reveal too much about your project, this is a competition but maybe
you can tell us the technologies, APIs you are going to use and what kind
of application you are going to build.
You can change your mind, that's ok. Just push an update here when you do.

View File

@@ -0,0 +1,29 @@
{
"teamName": "Team Koders",
"members": [
{
"name": "Emre",
"twitter": "emre",
"koding": "emre",
"location": "Istanbul, TR"
},
{
"name": "Sinan",
"twitter": "sinan",
"koding": "sinan",
"lead": true
},
{
"name": "Devrim",
"twitter": "devrim",
"koding": "devrim",
"location": "SF, US"
},
{
"name": "Stefan",
"twitter": "stefanbc",
"koding": "stefanbc",
"location": "Romania"
}
]
}

108
gulpfile.coffee Normal file
View File

@@ -0,0 +1,108 @@
#
# # Gulpfile
#
path = require 'path'
gulp = require 'gulp'
concat = require 'gulp-concat'
replace = require 'gulp-replace'
tap = require 'gulp-tap'
util = require 'gulp-util'
# The handler for gulp-tap
tap_json = (file, t) ->
filename = path.basename file.path
if filename is 'README.template.md' then return
try
data = JSON.parse file.contents.toString()
catch e
util.log util.colors.red('Warning'), "Failed to parse json file.
Invalid JSON syntax. File: #{file.path}"
file.contents = new Buffer ''
return
str = format_json data, file.path
if not str?
util.log util.colors.red('Warning'), "The JSON data couldn't be formatted
into the table for an unknown reason. File: #{file.path}"
file.contents = new Buffer ''
return
# Everything is successful
file.contents = new Buffer str
# Format a member object into a link
format_member = (member) ->
"[#{member?.name}](https://koding.com/#{member?.koding})"
# Format a data object, and return a string to be
# appended to the readme
format_json = (data, filepath) ->
teamPathName = path.basename path.dirname filepath
# Get the lead, ahead of time.
teamLead = null
if data.members? and data.members instanceof Array
for member in data.members
if member.lead is true
teamLead = member
break
output = '|'
# First column, #TeamName
if data.teamName?
output += " <a target='_blank'
href='https://twitter.com/home?status=Go team
%23#{data.teamName.replace /\W+/g, ""}
for @koding %23hackathon
#{if teamLead?.twitter? then "led by @"+teamLead.twitter}
https://koding.com/Hackathon'>
<img src='https://g.twimg.com/Twitter_logo_blue.png' height='14'/>
##{data.teamName}
</a> |"
else
output += " |"
# Second column, TeamLead
if teamLead?
output += "#{format_member teamLead} |"
else
output += " |"
# Third column, TeamMembers
if data.members? and data.members instanceof Array
for member in data.members
output += "#{format_member member}
#{member.location ? ''}<br>"
output += " |"
# Fourth column, TeamPage
if data.teamName? then teamName = data.teamName
else teamName = teamPathName
output += " [#{teamName}](./Teams/#{teamPathName}/ABOUT.md) |"
# Fifth column, Approved
# Faking for now
output += " |\n"
# Return the final output
output
gulp.task 'run', ->
gulp.src [
'README.template.md'
'./Teams/**/*.json'
]
.pipe tap tap_json
.pipe concat 'README.md', newLine: ''
.pipe gulp.dest './'
gulp.task 'default', ['run']

11
package.json Normal file
View File

@@ -0,0 +1,11 @@
{
"private": true,
"devDependencies": {
"coffee-script": "^1.8.0",
"gulp": "^3.8.10",
"gulp-concat": "^2.4.2",
"gulp-replace": "^0.5.0",
"gulp-tap": "^0.1.3",
"gulp-util": "^3.0.1"
}
}