mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
Migrate projects to the new site generator
This commit is contained in:
parent
4e9c53a2f4
commit
27df7f899d
24 changed files with 140 additions and 167 deletions
|
|
@ -43,13 +43,13 @@ Execution, trying TDD for the first time:
|
||||||
|
|
||||||
- [x] check and delete _data.json
|
- [x] check and delete _data.json
|
||||||
|
|
||||||
- [ ] Migrate projects to the new site generator
|
- [x] Migrate projects to the new site generator
|
||||||
|
|
||||||
- [ ] Migrate projects page
|
- [x] Migrate projects page
|
||||||
|
|
||||||
- [ ] Migrate project page
|
- [x] Migrate project page
|
||||||
|
|
||||||
- [ ] Check and delete _data.json
|
- [x] Check and delete _data.json
|
||||||
|
|
||||||
- [ ] Migrate posts to markdown with headers somehow
|
- [ ] Migrate posts to markdown with headers somehow
|
||||||
|
|
||||||
|
|
|
||||||
60
projects.json
Normal file
60
projects.json
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"projects": [
|
||||||
|
{
|
||||||
|
"title": "bin",
|
||||||
|
"description": "my collection of scripts in ~/bin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "config",
|
||||||
|
"description": "important dot files (zsh, emacs, vim, screen)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "compiler",
|
||||||
|
"description": "a compiler targeting x86 in Ruby"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "lake",
|
||||||
|
"description": "a simple implementation of Scheme in C"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "strftime",
|
||||||
|
"description": "strftime for JavaScript"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "format",
|
||||||
|
"description": "printf for JavaScript"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "gitter",
|
||||||
|
"description": "a GitHub client for Node (v3 API)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "mojo.el",
|
||||||
|
"description": "turn emacs into a sweet mojo editor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "ThePusher",
|
||||||
|
"description": "Github post-receive hook router"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "NorthWatcher",
|
||||||
|
"description": "cron for filesystem changes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "repl-edit",
|
||||||
|
"description": "edit Node repl commands with your text editor"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "cheat.el",
|
||||||
|
"description": "cheat from emacs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "batteries",
|
||||||
|
"description": "a general purpose node library"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "samhuri.net",
|
||||||
|
"description": "this site"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -354,10 +354,13 @@ ul.archive {
|
||||||
.project-listing {
|
.project-listing {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
|
||||||
h4, p {
|
h4 {
|
||||||
margin: 0.5rem 0;
|
margin: 0.5rem 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0.5rem 0 2rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.project-stats {
|
.project-stats {
|
||||||
|
|
@ -370,10 +373,8 @@ ul.archive {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.projects:not(.index) .container {
|
article.project {
|
||||||
/* FIXME: find out where this is used and do it differently ... this selector sucks */
|
h1, h4 {
|
||||||
body { background-color: red; }
|
|
||||||
h2, h4 {
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
;(function() {
|
;(function() {
|
||||||
|
|
||||||
if (SJS.projectName) {
|
if (document.addEventListener) {
|
||||||
SJS.ready(initProject)
|
document.addEventListener('DOMContentLoaded', initProject, false)
|
||||||
|
} else if (window.attachEvent) {
|
||||||
|
window.attachEvent('onload', initProject)
|
||||||
}
|
}
|
||||||
|
|
||||||
function initProject() {
|
function initProject() {
|
||||||
|
var projectName = document.getElementById('project').dataset.title
|
||||||
var data = createObjectStore(SJS.projectName)
|
var data = createObjectStore(projectName)
|
||||||
|
|
||||||
function html(id, h) {
|
function html(id, h) {
|
||||||
document.getElementById(id).innerHTML = h
|
document.getElementById(id).innerHTML = h
|
||||||
|
|
@ -63,11 +65,10 @@
|
||||||
|
|
||||||
var Months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ')
|
var Months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ')
|
||||||
|
|
||||||
var t = data.get('t-' + SJS.projectName)
|
var t = data.get('t-' + projectName)
|
||||||
if (!t || +new Date() - t > 3600 * 1000) {
|
if (!t || +new Date() - t > 3600 * 1000) {
|
||||||
console.log('stale ' + String(t))
|
data.set('t-' + projectName, +new Date())
|
||||||
data.set('t-' + SJS.projectName, +new Date())
|
var repo = GITR.repo('samsonjs', projectName)
|
||||||
var repo = GITR.repo('samsonjs', SJS.projectName)
|
|
||||||
repo
|
repo
|
||||||
.fetch(function(err, repo) {
|
.fetch(function(err, repo) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -102,13 +103,13 @@
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
updateBranches(SJS.projectName, data.get('branches'))
|
updateBranches(projectName, data.get('branches'))
|
||||||
updateLangs(data.get('langs'))
|
updateLangs(data.get('langs'))
|
||||||
updateContributors(data.get('contributors'))
|
updateContributors(data.get('contributors'))
|
||||||
updateStars(data.get('stars').length)
|
updateStars(data.get('stars').length)
|
||||||
updateN('fork', data.get('forks').length)
|
updateN('fork', data.get('forks').length)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
data.set('t-' + SJS.projectName, null)
|
data.set('t-' + projectName, null)
|
||||||
initProject()
|
initProject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
{
|
|
||||||
"_scripts": [
|
|
||||||
"https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js",
|
|
||||||
"/js/gitter.js",
|
|
||||||
"/js/store.js",
|
|
||||||
"/js/projects.js"
|
|
||||||
],
|
|
||||||
"index": {
|
|
||||||
"title": "Projects"
|
|
||||||
},
|
|
||||||
"strftime": {
|
|
||||||
"title": "strftime",
|
|
||||||
"description": "strftime for JavaScript"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"title": "bin",
|
|
||||||
"description": "~/bin"
|
|
||||||
},
|
|
||||||
"compiler": {
|
|
||||||
"title": "compiler",
|
|
||||||
"description": "a compiler targeting x86 in Ruby"
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"title": "config",
|
|
||||||
"description": "important dot files (zsh, emacs, vim, screen)"
|
|
||||||
},
|
|
||||||
"format": {
|
|
||||||
"title": "format",
|
|
||||||
"description": "printf for JavaScript"
|
|
||||||
},
|
|
||||||
"gitter": {
|
|
||||||
"title": "gitter",
|
|
||||||
"description": "a GitHub client for Node (v3 API)"
|
|
||||||
},
|
|
||||||
"samhuri.net": {
|
|
||||||
"title": "samhuri.net",
|
|
||||||
"description": "this site"
|
|
||||||
},
|
|
||||||
"samhuri": {
|
|
||||||
"hidden": true,
|
|
||||||
"title": "samhuri.net",
|
|
||||||
"description": "this site"
|
|
||||||
},
|
|
||||||
"ThePusher": {
|
|
||||||
"title": "ThePusher",
|
|
||||||
"description": "Github post-receive hook router"
|
|
||||||
},
|
|
||||||
"lake": {
|
|
||||||
"title": "lake",
|
|
||||||
"description": "A simple implementation of Scheme in C"
|
|
||||||
},
|
|
||||||
"mojo.el": {
|
|
||||||
"title": "mojo.el",
|
|
||||||
"description": "turn emacs into a sweet mojo editor"
|
|
||||||
},
|
|
||||||
"mojo": {
|
|
||||||
"hidden": true,
|
|
||||||
"title": "mojo.el",
|
|
||||||
"description": "turn emacs into a sweet mojo editor"
|
|
||||||
},
|
|
||||||
"NorthWatcher": {
|
|
||||||
"title": "NorthWatcher",
|
|
||||||
"description": "cron for filesystem changes"
|
|
||||||
},
|
|
||||||
"batteries": {
|
|
||||||
"title": "batteries",
|
|
||||||
"description": "a general purpose node library"
|
|
||||||
},
|
|
||||||
"repl-edit": {
|
|
||||||
"title": "repl-edit",
|
|
||||||
"description": "edit Node repl commands with your text editor"
|
|
||||||
},
|
|
||||||
"cheat.el": {
|
|
||||||
"title": "cheat.el",
|
|
||||||
"description": "cheat from emacs"
|
|
||||||
},
|
|
||||||
"cheat": {
|
|
||||||
"hidden": true,
|
|
||||||
"title": "cheat.el",
|
|
||||||
"description": "cheat from emacs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
<h4><%= description %></h4>
|
|
||||||
|
|
||||||
<div class="project-stats">
|
|
||||||
<p>
|
|
||||||
<a href="https://github.com/samsonjs/<%= title %>">GitHub</a>
|
|
||||||
•
|
|
||||||
<a id="nstar" href="https://github.com/samsonjs/<%= title %>/stargazers"></a>
|
|
||||||
•
|
|
||||||
<a id="nfork" href="https://github.com/samsonjs/<%= title %>/network/members"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Last updated on <span id="updated"></span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="project-info row clearfix">
|
|
||||||
<div class="column half">
|
|
||||||
<h3>Contributors</h3>
|
|
||||||
<div id="contributors"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="column half">
|
|
||||||
<h3>Languages</h3>
|
|
||||||
<div id="langs"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
SJS.projectName = '<%= title %>'
|
|
||||||
</script>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<% for (var name in public.projects._data) { %>
|
|
||||||
<% var project = public.projects._data[name] %>
|
|
||||||
<% if (name == 'index' || name[0] == '_' || project.hidden) continue %>
|
|
||||||
<div class="project-listing">
|
|
||||||
<h4><a href="/projects/<%= name %>"><%= name %></a></h4>
|
|
||||||
<p class="description"><%= project.description %></p>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<%- partial('_project') %>
|
|
||||||
42
templates/project.html
Normal file
42
templates/project.html
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
{% extends "samhuri.net.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<article class="container project">
|
||||||
|
<!-- projects.js picks up this data-title attribute and uses it to render all the Github stuff -->
|
||||||
|
<h1 id="project" data-title="{{ project.title }}">{{ project.title }}</h1>
|
||||||
|
<h4>{{ project.description }}</h4>
|
||||||
|
|
||||||
|
<div class="project-stats">
|
||||||
|
<p>
|
||||||
|
<a href="https://github.com/samsonjs/{{ project.title }}">GitHub</a>
|
||||||
|
•
|
||||||
|
<a id="nstar" href="https://github.com/samsonjs/{{ project.title }}/stargazers"></a>
|
||||||
|
•
|
||||||
|
<a id="nfork" href="https://github.com/samsonjs/{{ project.title }}/network/members"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Last updated on <span id="updated"></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="project-info row clearfix">
|
||||||
|
<div class="column half">
|
||||||
|
<h3>Contributors</h3>
|
||||||
|
<div id="contributors"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="column half">
|
||||||
|
<h3>Languages</h3>
|
||||||
|
<div id="langs"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
<div class="row clearfix">
|
||||||
|
<p class="fin"><i class="fa fa-code"></i></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script defer src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
|
||||||
|
<script defer src="/js/gitter.js"></script>
|
||||||
|
<script defer src="/js/store.js"></script>
|
||||||
|
<script defer src="/js/projects.js"></script>
|
||||||
|
{% endblock %}
|
||||||
16
templates/projects.html
Normal file
16
templates/projects.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends "samhuri.net.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<article class="container">
|
||||||
|
<h1>Projects</h1>
|
||||||
|
|
||||||
|
{% for project in projects %}
|
||||||
|
<div class="project-listing">
|
||||||
|
<h4><a href="{{ project.path }}">{{ project.title }}</a></h4>
|
||||||
|
<p class="description">{{ project.description }}</p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</article>
|
||||||
|
<div class="row clearfix">
|
||||||
|
<p class="fin"><i class="fa fa-code"></i></p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
@ -29,18 +29,6 @@
|
||||||
<link rel="dns-prefetch" href="https://use.typekit.net">
|
<link rel="dns-prefetch" href="https://use.typekit.net">
|
||||||
<script src="https://use.typekit.net/tcm1whv.js" crossorigin="anonymous"></script>
|
<script src="https://use.typekit.net/tcm1whv.js" crossorigin="anonymous"></script>
|
||||||
<script>try{Typekit.load({ async: true });}catch(e){}</script>
|
<script>try{Typekit.load({ async: true });}catch(e){}</script>
|
||||||
|
|
||||||
<script>
|
|
||||||
window.SJS = {
|
|
||||||
ready: function(fn) {
|
|
||||||
if (document.addEventListener) {
|
|
||||||
document.addEventListener('DOMContentLoaded', fn, false)
|
|
||||||
} else if (window.attachEvent) {
|
|
||||||
window.attachEvent('onload', fn)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
{% if bodyClassNames %}
|
{% if bodyClassNames %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue