Skip to content

Commit d81c48b

Browse files
committed
initial buildout/npm/grunt/bower attempt
1 parent 0cc6c32 commit d81c48b

File tree

7 files changed

+225
-32
lines changed

7 files changed

+225
-32
lines changed

Gruntfile.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ var mountFolder = function (connect, dir) {
66
return connect.static(require('path').resolve(dir));
77
};
88

9+
// removed grunt-bower-requirejs ~0.4.1
10+
// remoevd grunt-requirejs ~0.3.5
11+
// removed grunt-contrib-livereload 0.1.2 - grunt-contrib-watch supercedes it
12+
913
// # Globbing
1014
// for performance reasons we're only matching one level down:
1115
// 'test/spec/{,*/}*.js'
@@ -148,31 +152,6 @@ module.exports = function (grunt) {
148152
}
149153
},
150154

151-
152-
// require
153-
requirejs: {
154-
dist: {
155-
// Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
156-
options: {
157-
// `name` and `out` is set by grunt-usemin
158-
baseUrl: 'app/scripts',
159-
optimize: 'none',
160-
paths: {
161-
'templates': '../../.tmp/scripts/templates'
162-
},
163-
// TODO: Figure out how to make sourcemaps work with grunt-usemin
164-
// https://github.com/yeoman/grunt-usemin/issues/30
165-
//generateSourceMaps: true,
166-
// required to support SourceMaps
167-
// http://requirejs.org/docs/errors.html#sourcemapcomments
168-
preserveLicenseComments: false,
169-
useStrict: true,
170-
wrap: true,
171-
//uglify2: {} // https://github.com/mishoo/UglifyJS2
172-
}
173-
}
174-
},
175-
176155
useminPrepare: {
177156
html: '<%= yeoman.app %>/index.html',
178157
options: {

README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
wwc
2+
===
3+
4+
Websocket chat using cenrifuge, sockJS, and backbone-marionette.
5+
6+
::
7+
$ /opt/python3.3/bin/pyvenv-3.3 --upgrade .
8+
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | bin/python3.3
9+
$ bin/python3.3 bootstrap.py
10+
$ bin/buildout
11+
$ rm setuptools-1.1.6.tar.gz

bootstrap.py

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
##############################################################################
2+
#
3+
# Copyright (c) 2006 Zope Foundation and Contributors.
4+
# All Rights Reserved.
5+
#
6+
# This software is subject to the provisions of the Zope Public License,
7+
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8+
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9+
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10+
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11+
# FOR A PARTICULAR PURPOSE.
12+
#
13+
##############################################################################
14+
"""Bootstrap a buildout-based project
15+
16+
Simply run this script in a directory containing a buildout.cfg.
17+
The script accepts buildout command-line options, so you can
18+
use the -c option to specify an alternate configuration file.
19+
"""
20+
21+
import os
22+
import shutil
23+
import sys
24+
import tempfile
25+
26+
from optparse import OptionParser
27+
28+
tmpeggs = tempfile.mkdtemp()
29+
30+
usage = '''\
31+
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
32+
33+
Bootstraps a buildout-based project.
34+
35+
Simply run this script in a directory containing a buildout.cfg, using the
36+
Python that you want bin/buildout to use.
37+
38+
Note that by using --find-links to point to local resources, you can keep
39+
this script from going over the network.
40+
'''
41+
42+
parser = OptionParser(usage=usage)
43+
parser.add_option("-v", "--version", help="use a specific zc.buildout version")
44+
45+
parser.add_option("-t", "--accept-buildout-test-releases",
46+
dest='accept_buildout_test_releases',
47+
action="store_true", default=False,
48+
help=("Normally, if you do not specify a --version, the "
49+
"bootstrap script and buildout gets the newest "
50+
"*final* versions of zc.buildout and its recipes and "
51+
"extensions for you. If you use this flag, "
52+
"bootstrap and buildout will get the newest releases "
53+
"even if they are alphas or betas."))
54+
parser.add_option("-c", "--config-file",
55+
help=("Specify the path to the buildout configuration "
56+
"file to be used."))
57+
parser.add_option("-f", "--find-links",
58+
help=("Specify a URL to search for buildout releases"))
59+
60+
61+
options, args = parser.parse_args()
62+
63+
######################################################################
64+
# load/install setuptools
65+
66+
to_reload = False
67+
try:
68+
import pkg_resources
69+
import setuptools
70+
except ImportError:
71+
ez = {}
72+
73+
try:
74+
from urllib.request import urlopen
75+
except ImportError:
76+
from urllib2 import urlopen
77+
78+
# XXX use a more permanent ez_setup.py URL when available.
79+
exec(urlopen('https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py'
80+
).read(), ez)
81+
setup_args = dict(to_dir=tmpeggs, download_delay=0)
82+
ez['use_setuptools'](**setup_args)
83+
84+
if to_reload:
85+
reload(pkg_resources)
86+
import pkg_resources
87+
# This does not (always?) update the default working set. We will
88+
# do it.
89+
for path in sys.path:
90+
if path not in pkg_resources.working_set.entries:
91+
pkg_resources.working_set.add_entry(path)
92+
93+
######################################################################
94+
# Install buildout
95+
96+
ws = pkg_resources.working_set
97+
98+
cmd = [sys.executable, '-c',
99+
'from setuptools.command.easy_install import main; main()',
100+
'-mZqNxd', tmpeggs]
101+
102+
find_links = os.environ.get(
103+
'bootstrap-testing-find-links',
104+
options.find_links or
105+
('http://downloads.buildout.org/'
106+
if options.accept_buildout_test_releases else None)
107+
)
108+
if find_links:
109+
cmd.extend(['-f', find_links])
110+
111+
setuptools_path = ws.find(
112+
pkg_resources.Requirement.parse('setuptools')).location
113+
114+
requirement = 'zc.buildout'
115+
version = options.version
116+
if version is None and not options.accept_buildout_test_releases:
117+
# Figure out the most recent final version of zc.buildout.
118+
import setuptools.package_index
119+
_final_parts = '*final-', '*final'
120+
121+
def _final_version(parsed_version):
122+
for part in parsed_version:
123+
if (part[:1] == '*') and (part not in _final_parts):
124+
return False
125+
return True
126+
index = setuptools.package_index.PackageIndex(
127+
search_path=[setuptools_path])
128+
if find_links:
129+
index.add_find_links((find_links,))
130+
req = pkg_resources.Requirement.parse(requirement)
131+
if index.obtain(req) is not None:
132+
best = []
133+
bestv = None
134+
for dist in index[req.project_name]:
135+
distv = dist.parsed_version
136+
if _final_version(distv):
137+
if bestv is None or distv > bestv:
138+
best = [dist]
139+
bestv = distv
140+
elif distv == bestv:
141+
best.append(dist)
142+
if best:
143+
best.sort()
144+
version = best[-1].version
145+
if version:
146+
requirement = '=='.join((requirement, version))
147+
cmd.append(requirement)
148+
149+
import subprocess
150+
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
151+
raise Exception(
152+
"Failed to execute command:\n%s",
153+
repr(cmd)[1:-1])
154+
155+
######################################################################
156+
# Import and run buildout
157+
158+
ws.add_entry(tmpeggs)
159+
ws.require(requirement)
160+
import zc.buildout.buildout
161+
162+
if not [a for a in args if '=' not in a]:
163+
args.append('bootstrap')
164+
165+
# if -c was provided, we push it back into args for buildout' main function
166+
if options.config_file is not None:
167+
args[0:0] = ['-c', options.config_file]
168+
169+
zc.buildout.buildout.main(args)
170+
shutil.rmtree(tmpeggs)

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"chai": "~1.7.2",
1919
"sinonjs": "~1.7.1",
2020
"sinon-chai": "~2.4.0",
21-
"socksjs-client": "[email protected]:dobrite/socksjs-client.git#master",
22-
"centrifuge-client": "[email protected]:dobrite/centrifuge-client.git#master"
21+
"socksjs-client": "[email protected]:dobrite/socksjs-client.git",
22+
"centrifuge-client": "[email protected]:dobrite/centrifuge-client.git"
2323
},
2424
"devDependencies": {}
2525
}

buildout.cfg

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[buildout]
2+
extensions = mr.developer
3+
unzip = true
4+
extends =
5+
https://raw.github.com/reebalazs/buildout.javascript.yeoman/master/yeoman.cfg
6+
parts+ =
7+
eggs
8+
bower_modules
9+
develop = wwc
10+
eggs-directory = eggs
11+
auto-checkout = *
12+
always-checkout = false
13+
versions = versions
14+
prefer-final = false
15+
find-links += http://pypi.crate.io/simple
16+
eggs = wwc
17+
18+
[versions]
19+
zc.buildout = 2.2.0
20+
zc.recipe.egg = 2.0.0
21+
six = 1.3.0
22+
23+
[eggs]
24+
recipe = zc.recipe.egg
25+
unzip = true
26+
dependent-scripts = true
27+
eggs =
28+
wwc
29+
pytest
30+
pytest-cov
31+
webtest
32+
mock
33+
pep8
34+
flake8
35+
36+
interpreter = py

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"name": "bone-chat",
2+
"name": "wwc",
33
"version": "0.0.1",
44
"devDependencies": {
5+
"bower": "~1.2.6",
56
"grunt": "~0.4.1",
67
"grunt-contrib-copy": "~0.4.0",
78
"grunt-contrib-concat": "~0.2.0",
@@ -15,11 +16,8 @@
1516
"grunt-contrib-clean": "0.4.0",
1617
"grunt-contrib-htmlmin": "0.1.3",
1718
"grunt-contrib-imagemin": "0.1.4",
18-
"grunt-contrib-livereload": "0.1.2",
1919
"grunt-mocha": "~0.3.1",
20-
"grunt-bower-requirejs": "~0.4.1",
2120
"grunt-usemin": "~0.1.10",
22-
"grunt-requirejs": "~0.3.5",
2321
"grunt-open": "~0.2.0",
2422
"grunt-express-server": "~0.4.1",
2523
"matchdep": "~0.1.2",

0 commit comments

Comments
 (0)