Skip to content

Commit

Permalink
Added Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Olayvar committed Nov 21, 2014
1 parent 68e9c91 commit 965041a
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
24 changes: 24 additions & 0 deletions Teams/TeamKoders/ABOUT.md
Original file line number Diff line number Diff line change
@@ -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.


29 changes: 29 additions & 0 deletions Teams/TeamKoders/team.json
Original file line number Diff line number Diff line change
@@ -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 changes: 108 additions & 0 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 965041a

Please sign in to comment.