Merge pull request #8 from leeolayvar/generating-readmes
Generating readmes
This commit is contained in:
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
@@ -1,7 +0,0 @@
|
||||
APIs
|
||||
=====
|
||||
|
||||
We will provide copy/paste friendly code samples that will help you communicate
|
||||
with various APIs.
|
||||
|
||||
Feel free to push code here, open a PR and we will accept if it's ready to use.
|
||||
@@ -0,0 +1,27 @@
|
||||
KODING'S GLOBAL VIRTUAL HACKATHON
|
||||
================
|
||||
|
||||
Welcome to the git repo for Koding's Global Virtual Hackathon! If that
|
||||
does not ring a bell, please
|
||||
[go here](https://koding.com/Hackathon). You can win more than $35,000 in
|
||||
prizes!
|
||||
|
||||
The purpose of this repo is two-fold:
|
||||
* for us to share share sample code with you
|
||||
* for you to share your team details and eventually your final project
|
||||
code with us
|
||||
|
||||
DO THIS NOW!
|
||||
============
|
||||
Fork this repo and add a new folder in the existing "teams" folder. Name
|
||||
the folder with your team name and inside this folder, create two files:
|
||||
* team.json (see example file for details)
|
||||
* ABOUT.md (see sample file for details)
|
||||
* once the above files are done, make a pull request to get your
|
||||
information merged into the main repo
|
||||
|
||||
We will periodically run a script that will pull your info and populate
|
||||
the lower section of this README.md file.
|
||||
|
||||
| #TeamNameTeam | Team Lead | Team Members | Team Page |
|
||||
|---------------|-----------|--------------|-----------|
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"teamName": "Team Koders",
|
||||
"members": [
|
||||
{
|
||||
"name": "Emre Durmus",
|
||||
"twitter": "emre",
|
||||
"koding": "emre",
|
||||
"location": "Istanbul, TR"
|
||||
},
|
||||
{
|
||||
"name": "Sinan Yasar",
|
||||
"twitter": "sinanyasar",
|
||||
"koding": "sinan",
|
||||
"lead": true
|
||||
},
|
||||
{
|
||||
"name": "Devrim Yasar",
|
||||
"twitter": "devrimyasar",
|
||||
"koding": "devrim",
|
||||
"location": "SF, US"
|
||||
},
|
||||
{
|
||||
"name": "Stefan Cosma",
|
||||
"twitter": "stefanbc",
|
||||
"koding": "stefanbc",
|
||||
"location": "Romania"
|
||||
}
|
||||
]
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# # 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) |"
|
||||
|
||||
# Add a newline to end this row.
|
||||
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']
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user