Skip to content
New issue

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

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

Already on GitHub? # to your account

gen index #10

Merged
merged 19 commits into from
Oct 18, 2015
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: all_dists
all: all_dists index

all_dists: go-ipfs ipfs-app

Expand All @@ -10,5 +10,10 @@ go-ipfs:
echo "** making $@ **"
cd dists/$@ && make

index:
echo "** making index.html **"
node gen-index.js >releases/index.html
cp -r static releases/.

publish: all_dists
ipfs add -q -r build | tail -n1 >>versions
ipfs add -s rabin -q -r build | tail -n1 >>versions
6 changes: 6 additions & 0 deletions dists/go-ipfs/dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "go-ipfs",
"name": "go-ipfs",
"tagline": "IPFS implementation and toolchain in Go",
"description": "go-ipfs is the main implementation of IPFS. It is the base distribution, and includes:\n- an IPFS core implementation\n- an IPFS daemon server\n- extensive command line tooling\n- an HTTP API for controlling the node\n- an HTTP Gateway for serving content to HTTP browsers\n"
}
25 changes: 22 additions & 3 deletions dists/go-ipfs/go-ipfs-dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

# constants
repo="github.com/ipfs/go-ipfs"
gpath="github.com/ipfs/go-ipfs/cmd/ipfs"
releases="../../releases/go-ipfs"

Expand Down Expand Up @@ -31,13 +32,15 @@ ipfs swarm peers >/dev/null || die "please run: ipfs daemon"

dist_version() {
# get version from input
cwd=`pwd`
version=$1
dest_path="$releases/$version"
dest_path_src="$dest_path/go-ipfs_${version}_src.zip"

# check version is ok
cat versions | grep "$version" >/dev/null || die "versions not in listing"

stat "$releases/$version/hashes" >/dev/null 2>&1
stat "$releases/$version/dist.json" >/dev/null 2>&1
if [ "$?" -eq 0 ]; then
echo "--> have $version in $dest_path"
return
Expand All @@ -47,21 +50,37 @@ dist_version() {

# get archives from gobuilder
echo "---> preparing $dest_path"
mkdir -p "$dest_path"

echo "---> getting archives from gobuilder..."
bin/gobuilder-cli get-all "$gpath" "$dest_path" "$version"
if [ "$?" -ne 0 ]; then
echo "---> failed."
return -1
fi

# move gobuilder archives; they start with "ipfs_", not "go-ipfs_"
cd "$dest_path"
for f in ipfs_*.zip ; do mv "$f" "go-$f"; done
echo "mmv ipfs_*.zip go-ipfs_*.zip"
cd "$cwd"

# get OSX installer (TODO)
# echo "---> building OSX installer..."

echo "---> getting source tarball"
wget -q -O "$dest_path_src" "https://$repo/zipball/$version.zip"
echo "wrote $dest_path_src"

# generate hashes file
cwd=`pwd`
echo "---> generating hashes"
cd "$dest_path"
ipfs add --only-hash * >hashes
ipfs add -s rabin --only-hash * >hashes
cd "$cwd"

# generate dist.json file
echo "---> generating dist.json"
./mkdist.js "$version"
}

if [ "$1" = "all" ]; then
Expand Down
30 changes: 30 additions & 0 deletions dists/go-ipfs/mkdist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env node

var mkdist = require('../../mkdist')

if (process.argv.length != 3) {
console.log("usage: mkdist.js <version>")
process.exit(1)
}

var dist = require('./dist.json')
dist.version = process.argv[2]

mkdist({
dist: dist,
path: "../..",
platforms: {
oses: [
{id: 'darwin', name: "Mac OSX App", browser:'OS X', icon: 'apple'},
{id: 'linux', name: "Linux App", browser:'Linux', icon: 'linux'},
{id: 'openbsd', name: "OpenBSD App", browser:'OpenBSD', icon: 'circle-o'},
{id: 'freebsd', name: "FreeBSD App", browser:'FreeBSD', icon: 'circle-o'},
{id: 'windows', name: "Windows App", browser:'Windows', icon: 'windows'},
],
archs: [
{id: '386', name: '32 bit', browser: '32'},
{id: 'amd64', name: '64 bit', browser: '64'},
{id: 'arm', name: 'ARM', browser: 'ARM'},
]
}
})
7 changes: 5 additions & 2 deletions dists/ipfs-app/app-release
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# constants
releases="../../releases/ipfs-app"
repo = "http://github.com/ipfs/electron-app"
archive = "$repo/archive/"
repo="http://github.com/ipfs/electron-app"
archive="$repo/archive/"

if [ "$#" -eq 0 ]; then
echo "usage: $0 <version>"
Expand Down Expand Up @@ -65,6 +65,9 @@ release_version() {
mkdir -p ../../../../../../releases/electron-app/
mv * ../../../../../../releases/electron-app/

echo "--> making dist.json"
./mkdist.js "$version"

cd "$cwd"
}

Expand Down
6 changes: 6 additions & 0 deletions dists/ipfs-app/dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "ipfs-app",
"name": "IPFS Node",
"tagline": "IPFS Node Desktop App",
"description": "IPFS Node is a cross-platform native desktop app. Features:\n- Use it to run an IPFS Node on your computer\n- Can drag-and-drop files straight to the menu bar! \n- Menu bar for easy control of the node\n- Includes the [Web UI](#webui) interface\n- Includes the [go-ipfs](#go-ipfs) commandline tools\n"
}
30 changes: 30 additions & 0 deletions dists/ipfs-app/mkdist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env node

var mkdist = require('../../mkdist')

if (process.argv.length != 3) {
console.log("usage: mkdist.js <version>")
process.exit(1)
}

var dist = require('./dist.json')
dist.version = process.argv[2]

mkdist({
dist: dist,
path: "../..",
platforms: {
oses: [
{id: 'darwin', name: "Mac OSX App", browser:'OS X', icon: 'apple'},
{id: 'linux', name: "Linux App", browser:'Linux', icon: 'linux'},
{id: 'openbsd', name: "OpenBSD App", browser:'OpenBSD', icon: 'circle-o'},
{id: 'freebsd', name: "FreeBSD App", browser:'FreeBSD', icon: 'circle-o'},
{id: 'windows', name: "Windows App", browser:'Windows', icon: 'windows'},
],
archs: [
{id: '386', name: '32 bit', browser: '32'},
{id: 'amd64', name: '64 bit', browser: '64'},
{id: 'arm', name: 'ARM', browser: 'ARM'},
]
}
})
21 changes: 21 additions & 0 deletions gen-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var fs = require('fs')
var marked = require('marked')
var nunjucks = require('nunjucks')
var njmd = require('nunjucks-markdown')

var njx = nunjucks.configure('.')
njmd.register(njx, marked)

var spec = {
template: "tmpl/index.html",
data: { dists: {} },
}

var goipfsPath = './releases/go-ipfs/v0.3.7/dist.json'
spec.data.dists['go-ipfs'] = require(goipfsPath)

njx.render(spec.template, spec.data, function(err, res) {
if (err) throw err
process.stdout.write(res)
process.exit(0)
})
106 changes: 106 additions & 0 deletions mkdist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
var fs = require('fs')

module.exports = mkdist

function mkdist(opts, cb) {
if (!opts) throw new Error("no options given")
if (!opts.dist) throw new Error("no dist given")
if (!opts.dist.id) throw new Error("no dist.id given")
if (!opts.dist.version) throw new Error("no dist.version given")
if (!opts.path) throw new Error("no path given")
if (!opts.platforms) throw new Error("no platforms given")
if (!cb) cb = noopcb

var dist = opts.dist
var ver = dist.version
if (ver.match(/^v/)) ver = ver.substring(1)

dist.releaseLink = 'releases/' + dist.id + '/v' + ver
var releasePath = opts.path + '/' + dist.releaseLink
dist.platforms = []

var dir = fs.readdirSync(releasePath)

// add osx installer
var f = findFile(/\.pkg$/)
if (f) {
dist.platforms.push({
id: 'osxpkg',
name: 'Mac OSX Installer (.pkg)',
icon: 'apple',
archs: [{
name: 'Universal',
link: f,
}]
})
}

// TODO: windows msi installer

// add standard os binaries
addOSBinaries(dir, opts.platforms, dist.platforms)

// add source
dist.platforms.push({
id: 'src',
name: 'Source Code (.zip)',
icon: 'archive',
archs: [{
name: 'src',
link: dist.id + '_v' + ver + '_src.zip'
}]
})

writeDist(releasePath + '/dist.json', dist, function (err) {
if (err) return cb(err)
cb(null, dist)
})
}

function writeDist(path, dist) {
fs.writeFileSync(path, JSON.stringify(dist, null, ' '))
console.log('wrote', path)
}

function addOSBinaries(dir, src, dst) {
for (var osi in src.oses) {
var os = src.oses[osi]
var p = {
id: os.id,
name: os.name,
icon: os.icon,
archs: [],
}

for (var a in src.archs) {
var arch = src.archs[a]
var f = findFile(dir, os.id + '-' + arch.id) // e.g. darwin-amd64
if (!f) continue // does not exist

console.log('found', f)
p.archs.push({
id: arch.id,
name: arch.name,
link: f,
})
}

if (p.archs.length > 0) {
dst.push(p) // do have releases for this os.
}
}
return dst
}

function findFile(dir, pattern) {
for (var e in dir) {
if (dir[e].match(pattern)) {
return dir[e]
}
}
return null
}

function noopcb(err) {
if (err) throw err
}
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "dist.ipfs.io",
"version": "1.0.0",
"description": "Script to build the dist.ipfs.io pages.",
"main": "gen-index.js",
"dependencies": {
"nunjucks": "^1.3.4",
"marked": "^0.3.5",
"nunjucks-markdown": "^1.1.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/distributions.git"
},
"keywords": [
"ipfs"
],
"author": "Juan Benet <juan@benet.ai> (http://juan.benet.ai/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/ipfs/distributions/issues"
},
"homepage": "https://github.com/ipfs/distributions#readme"
}
Binary file added static/img/go-ipfs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/go-ipfs.shortdemo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ipfs-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ipfs-cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ipfs-logo-512-ice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ipfs-logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/ipfs-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions static/lib/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

Loading