sproutit-narwhal 0.1.106
Sign up to get free protection for your applications and to get access to all the features.
- data/DISTRIBUTION.yml +15 -0
- data/README.md +86 -0
- data/Rakefile +349 -0
- data/VERSION.yml +7 -0
- data/bin/activate +50 -0
- data/bin/activate.bash +50 -0
- data/bin/activate.cmd +3 -0
- data/bin/js +67 -0
- data/bin/json +2 -0
- data/bin/narwhal +67 -0
- data/bin/narwhal.cmd +29 -0
- data/bin/sea +45 -0
- data/bin/sea.cmd +25 -0
- data/bin/tusk +2 -0
- data/bin/tusk.cmd +5 -0
- data/catalog.json +902 -0
- data/docs/available-packages.md +32 -0
- data/docs/browser-api-plan.md +290 -0
- data/docs/browser-api.md +153 -0
- data/docs/download.md +25 -0
- data/docs/engines.md +32 -0
- data/docs/json-tool.md +121 -0
- data/docs/lib/binary.wiki +242 -0
- data/docs/lib/file.wiki +325 -0
- data/docs/lib/os/popen.md +70 -0
- data/docs/modules.md +38 -0
- data/docs/narwhal.md +487 -0
- data/docs/packages-howto.md +32 -0
- data/docs/packages.md +30 -0
- data/docs/posts/2009-07-29-hello-0.1.md +19 -0
- data/docs/quick-start.md +69 -0
- data/docs/sea.md +49 -0
- data/engines/browser/lib/binary.js +2 -0
- data/engines/browser/lib/reactor.js +21 -0
- data/engines/browser/lib/system.js +3 -0
- data/engines/default/lib/array.js +164 -0
- data/engines/default/lib/binary-engine.js +53 -0
- data/engines/default/lib/binary.js +755 -0
- data/engines/default/lib/date.js +8 -0
- data/engines/default/lib/file-engine.js +119 -0
- data/engines/default/lib/function.js +119 -0
- data/engines/default/lib/global.js +11 -0
- data/engines/default/lib/io-engine.js +26 -0
- data/engines/default/lib/json.js +488 -0
- data/engines/default/lib/object.js +69 -0
- data/engines/default/lib/os-engine.js +3 -0
- data/engines/default/lib/reactor.js +12 -0
- data/engines/default/lib/string.js +84 -0
- data/engines/default/lib/system.js +20 -0
- data/engines/default/lib/worker.js +133 -0
- data/engines/jsc/README.md +18 -0
- data/engines/jsc/bootstrap.js +53 -0
- data/engines/jsc/deps/http-parser/LICENSE +77 -0
- data/engines/jsc/deps/http-parser/README.md +145 -0
- data/engines/jsc/deps/http-parser/http_parser.c +6087 -0
- data/engines/jsc/deps/http-parser/http_parser.h +141 -0
- data/engines/jsc/deps/http-parser/http_parser.rl +500 -0
- data/engines/jsc/deps/http-parser/test.c +858 -0
- data/engines/jsc/include/binary-engine.h +11 -0
- data/engines/jsc/include/io-engine.h +23 -0
- data/engines/jsc/include/narwhal.h +427 -0
- data/engines/jsc/lib/file-engine.js +31 -0
- data/engines/jsc/lib/http.js +1 -0
- data/engines/jsc/lib/io-engine.js +202 -0
- data/engines/jsc/lib/os-engine.js +25 -0
- data/engines/jsc/lib/system.js +18 -0
- data/engines/jsc/lib/zip.js +1 -0
- data/engines/jsc/narwhal-jsc.c +273 -0
- data/engines/jsc/narwhal.c +29 -0
- data/engines/jsc/package.json +8 -0
- data/engines/jsc/src/binary-engine.cc +290 -0
- data/engines/jsc/src/file-engine.cc +405 -0
- data/engines/jsc/src/io-engine.cc +423 -0
- data/engines/jsc/src/jack/handler/jill.cc +710 -0
- data/engines/jsc/src/os-engine.cc +210 -0
- data/engines/rhino/bin/narwhal-rhino +68 -0
- data/engines/rhino/bin/narwhal-rhino.cmd +34 -0
- data/engines/rhino/bootstrap.js +119 -0
- data/engines/rhino/jars/jline.jar +0 -0
- data/engines/rhino/jars/jna.jar +0 -0
- data/engines/rhino/jars/js.jar +0 -0
- data/engines/rhino/lib/binary-engine.js +83 -0
- data/engines/rhino/lib/concurrency.js +6 -0
- data/engines/rhino/lib/event-queue.js +18 -0
- data/engines/rhino/lib/file-engine.js +216 -0
- data/engines/rhino/lib/http-client-engine.js +90 -0
- data/engines/rhino/lib/http-engine.js +10 -0
- data/engines/rhino/lib/io-engine.js +347 -0
- data/engines/rhino/lib/md5-engine.js +40 -0
- data/engines/rhino/lib/os-engine.js +150 -0
- data/engines/rhino/lib/packages-engine.js +71 -0
- data/engines/rhino/lib/sandbox-engine.js +70 -0
- data/engines/rhino/lib/system.js +38 -0
- data/engines/rhino/lib/worker-engine.js +23 -0
- data/engines/rhino/lib/zip.js +78 -0
- data/engines/rhino/package.json +4 -0
- data/engines/secure/lib/file.js +6 -0
- data/engines/secure/lib/system.js +6 -0
- data/engines/template/bin/narwhal-engine-name +32 -0
- data/engines/template/bootstrap.js +40 -0
- data/engines/template/lib/file-engine.js +118 -0
- data/engines/template/lib/system.js +17 -0
- data/examples/browser-deployment-jackconfig.js +35 -0
- data/examples/fibonacci-worker.js +35 -0
- data/examples/fibonacci.js +19 -0
- data/examples/hello +2 -0
- data/examples/narwhal +3 -0
- data/examples/not-quite-a-quine.js +1 -0
- data/extconf.rb +44 -0
- data/gem_bin/narwhal +5 -0
- data/gem_bin/sea +4 -0
- data/gem_bin/tusk +4 -0
- data/lib/args.js +849 -0
- data/lib/base16.js +16 -0
- data/lib/base64.js +120 -0
- data/lib/codec/base64.js +8 -0
- data/lib/crc32.js +60 -0
- data/lib/file-bootstrap.js +187 -0
- data/lib/file.js +659 -0
- data/lib/hash.js +28 -0
- data/lib/hashp.js +65 -0
- data/lib/html.js +16 -0
- data/lib/http-client.js +134 -0
- data/lib/http.js +17 -0
- data/lib/io.js +98 -0
- data/lib/jsmin.js +315 -0
- data/lib/jsonpath.js +89 -0
- data/lib/logger.js +55 -0
- data/lib/md4.js +146 -0
- data/lib/md5.js +164 -0
- data/lib/mime.js +166 -0
- data/lib/narwhal.js +102 -0
- data/lib/narwhal/client.js +261 -0
- data/lib/narwhal/compile.js +99 -0
- data/lib/narwhal/env.js +140 -0
- data/lib/narwhal/inline.js +106 -0
- data/lib/narwhal/json.js +324 -0
- data/lib/narwhal/json.md +178 -0
- data/lib/narwhal/repl.js +96 -0
- data/lib/narwhal/server-test.js +6 -0
- data/lib/narwhal/server.js +270 -0
- data/lib/narwhal/tusk.js +170 -0
- data/lib/narwhal/tusk/bin.js +13 -0
- data/lib/narwhal/tusk/bundle.js +0 -0
- data/lib/narwhal/tusk/catalog.js +22 -0
- data/lib/narwhal/tusk/clone.js +66 -0
- data/lib/narwhal/tusk/consolidate.js +25 -0
- data/lib/narwhal/tusk/create-catalog.js +80 -0
- data/lib/narwhal/tusk/engine.js +42 -0
- data/lib/narwhal/tusk/freeze.js +0 -0
- data/lib/narwhal/tusk/init.js +56 -0
- data/lib/narwhal/tusk/install.js +288 -0
- data/lib/narwhal/tusk/list.js +20 -0
- data/lib/narwhal/tusk/orphans.js +0 -0
- data/lib/narwhal/tusk/reheat.js +15 -0
- data/lib/narwhal/tusk/remove.js +15 -0
- data/lib/narwhal/tusk/search.js +145 -0
- data/lib/narwhal/tusk/update.js +21 -0
- data/lib/narwhal/tusk/upgrade.js +0 -0
- data/lib/os.js +33 -0
- data/lib/packages.js +423 -0
- data/lib/printf.js +169 -0
- data/lib/promise.js +352 -0
- data/lib/querystring.js +176 -0
- data/lib/ref-send.js +257 -0
- data/lib/regexp.js +12 -0
- data/lib/sandbox.js +422 -0
- data/lib/sha.js +112 -0
- data/lib/sha256.js +102 -0
- data/lib/struct.js +228 -0
- data/lib/term.js +179 -0
- data/lib/test/assert.js +95 -0
- data/lib/test/equiv.js +188 -0
- data/lib/test/jsdump.js +165 -0
- data/lib/test/runner.js +129 -0
- data/lib/unload.js +13 -0
- data/lib/uri.js +378 -0
- data/lib/url.js +5 -0
- data/lib/utf8.js +64 -0
- data/lib/util.js +985 -0
- data/lib/uuid.js +89 -0
- data/lib/xregexp.js +521 -0
- data/local.json.template +1 -0
- data/narwhal.gemspec +105 -0
- data/narwhal.js +213 -0
- data/package.json +26 -0
- data/packages/readline/engines/default/lib/readline.js +4 -0
- data/packages/readline/engines/rhino/lib/readline.js +6 -0
- data/packages/readline/package.json +5 -0
- data/sources.json +207 -0
- data/tests/all-tests.js +17 -0
- data/tests/args.js +31 -0
- data/tests/args/domain.js +215 -0
- data/tests/args/options.js +36 -0
- data/tests/args/shifting.js +92 -0
- data/tests/args/validation.js +31 -0
- data/tests/base64.js +23 -0
- data/tests/commonjs.js +3 -0
- data/tests/commonjs/all-tests.js +12 -0
- data/tests/commonjs/bytearray-encodings-tests.js +69 -0
- data/tests/commonjs/bytearray-tests.js +465 -0
- data/tests/commonjs/bytestring-encodings-tests.js +89 -0
- data/tests/commonjs/bytestring-tests.js +263 -0
- data/tests/commonjs/es5/all-tests.js +3 -0
- data/tests/commonjs/es5/bind.js +29 -0
- data/tests/commonjs/file-tests.js +315 -0
- data/tests/commonjs/file/dirname.js +31 -0
- data/tests/commonjs/file/extension.js +45 -0
- data/tests/commonjs/file/is-absolute.js +11 -0
- data/tests/commonjs/file/iterator.js +101 -0
- data/tests/commonjs/file/normal.js +27 -0
- data/tests/commonjs/file/path.js +17 -0
- data/tests/commonjs/file/relative.js +42 -0
- data/tests/commonjs/file/resolve.js +44 -0
- data/tests/commonjs/module-tests.js +9 -0
- data/tests/commonjs/modules/absolute/b.js +1 -0
- data/tests/commonjs/modules/absolute/program.js +5 -0
- data/tests/commonjs/modules/absolute/submodule/a.js +3 -0
- data/tests/commonjs/modules/absolute/test.js +9 -0
- data/tests/commonjs/modules/all-tests.js +47 -0
- data/tests/commonjs/modules/config.js +11 -0
- data/tests/commonjs/modules/cyclic/a.js +4 -0
- data/tests/commonjs/modules/cyclic/b.js +4 -0
- data/tests/commonjs/modules/cyclic/program.js +10 -0
- data/tests/commonjs/modules/cyclic/test.js +9 -0
- data/tests/commonjs/modules/determinism/program.js +3 -0
- data/tests/commonjs/modules/determinism/submodule/a.js +8 -0
- data/tests/commonjs/modules/determinism/submodule/b.js +2 -0
- data/tests/commonjs/modules/determinism/test.js +9 -0
- data/tests/commonjs/modules/exactExports/a.js +3 -0
- data/tests/commonjs/modules/exactExports/program.js +4 -0
- data/tests/commonjs/modules/exactExports/test.js +9 -0
- data/tests/commonjs/modules/hasOwnProperty/hasOwnProperty.js +0 -0
- data/tests/commonjs/modules/hasOwnProperty/program.js +3 -0
- data/tests/commonjs/modules/hasOwnProperty/test.js +9 -0
- data/tests/commonjs/modules/hasOwnProperty/toString.js +0 -0
- data/tests/commonjs/modules/method/a.js +12 -0
- data/tests/commonjs/modules/method/program.js +8 -0
- data/tests/commonjs/modules/method/test.js +9 -0
- data/tests/commonjs/modules/missing/program.js +8 -0
- data/tests/commonjs/modules/missing/test.js +9 -0
- data/tests/commonjs/modules/monkeys/a.js +1 -0
- data/tests/commonjs/modules/monkeys/program.js +4 -0
- data/tests/commonjs/modules/monkeys/test.js +9 -0
- data/tests/commonjs/modules/nested/a/b/c/d.js +3 -0
- data/tests/commonjs/modules/nested/program.js +3 -0
- data/tests/commonjs/modules/nested/test.js +9 -0
- data/tests/commonjs/modules/relative/program.js +5 -0
- data/tests/commonjs/modules/relative/submodule/a.js +1 -0
- data/tests/commonjs/modules/relative/submodule/b.js +2 -0
- data/tests/commonjs/modules/relative/test.js +9 -0
- data/tests/commonjs/modules/transitive/a.js +1 -0
- data/tests/commonjs/modules/transitive/b.js +1 -0
- data/tests/commonjs/modules/transitive/c.js +3 -0
- data/tests/commonjs/modules/transitive/program.js +3 -0
- data/tests/commonjs/modules/transitive/test.js +9 -0
- data/tests/file/all-tests.js +61 -0
- data/tests/file/fnmatch.js +102 -0
- data/tests/file/glob.js +466 -0
- data/tests/file/match.js +102 -0
- data/tests/global.js +6 -0
- data/tests/global/array.js +19 -0
- data/tests/hashes.js +94 -0
- data/tests/html.js +13 -0
- data/tests/io/stringio.js +21 -0
- data/tests/os/all-tests.js +4 -0
- data/tests/os/popen.js +41 -0
- data/tests/os/system.js +22 -0
- data/tests/printf.js +123 -0
- data/tests/query-string.js +87 -0
- data/tests/sandbox/byte-io.js +20 -0
- data/tests/sandbox/fileName.js +3 -0
- data/tests/sandbox/foo.js +0 -0
- data/tests/sandbox/reload.js +79 -0
- data/tests/string.js +35 -0
- data/tests/uri.js +41 -0
- data/tests/util/all-tests.js +79 -0
- data/tests/util/array.js +207 -0
- data/tests/util/array/is-arguments.js +29 -0
- data/tests/util/array/is-array-like.js +29 -0
- data/tests/util/case.js +9 -0
- data/tests/util/collection.js +104 -0
- data/tests/util/eq.js +57 -0
- data/tests/util/expand.js +45 -0
- data/tests/util/object.js +125 -0
- data/tests/util/operator.js +25 -0
- data/tests/util/range.js +19 -0
- data/tests/util/repr.js +26 -0
- data/tests/util/string.js +34 -0
- data/tests/util/unique.js +12 -0
- metadata +434 -0
data/DISTRIBUTION.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file lists all subprojects that need to be installed in the directory
|
2
|
+
# for release. The Rakefile will track Git hash codes for each project in
|
3
|
+
# the VERSION.yml file
|
4
|
+
#
|
5
|
+
# Each entry should have the following format:
|
6
|
+
#
|
7
|
+
# path/to/item:
|
8
|
+
# repo: GIT/SVN URL
|
9
|
+
# scm: git|svn <- type of source control system. defaults to git
|
10
|
+
#
|
11
|
+
|
12
|
+
engines/jsc:
|
13
|
+
repo: git://github.com/tlrobinson/narwhal-jsc.git
|
14
|
+
|
15
|
+
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
Narwhal
|
2
|
+
=======
|
3
|
+
|
4
|
+
A general purpose JavaScript platform
|
5
|
+
-------------------------------------
|
6
|
+
|
7
|
+
Narwhal is a cross-platform, multi-interpreter, general purpose JavaScript platform. It aims to provide a solid foundation for building JavaScript applications, primarily outside the web browser. Narwhal includes a package manager, module system, and standard library for multiple JavaScript interpreters. Currently Narwhal's [Rhino](http://www.mozilla.org/rhino/) support is the most complete, but [other engines](engines.html) are available too.
|
8
|
+
|
9
|
+
Narwhal's standard library conforms to the [CommonJS standard](http://wiki.commonjs.org). It is designed to work with multiple JavaScript interpreters, and to be easy to add support for new interpreters. Wherever possible, it is implemented in pure JavaScript to maximize reuse of code among engines.
|
10
|
+
|
11
|
+
Combined with [Jack](http://jackjs.org/), a [Rack](http://rack.rubyforge.org/)-like [JSGI](http://jackjs.org/jsgi-spec.html) compatible library, Narwhal provides a platform for creating server-side JavaScript web applications and frameworks such as [Nitro](http://www.nitrojs.org/).
|
12
|
+
|
13
|
+
|
14
|
+
### Homepage:
|
15
|
+
|
16
|
+
* [http://narwhaljs.org/](http://narwhaljs.org/)
|
17
|
+
|
18
|
+
### Source & Download:
|
19
|
+
|
20
|
+
* [http://github.com/tlrobinson/narwhal/](http://github.com/tlrobinson/narwhal/)
|
21
|
+
|
22
|
+
### Mailing list:
|
23
|
+
|
24
|
+
* [http://groups.google.com/group/narwhaljs](http://groups.google.com/group/narwhaljs)
|
25
|
+
|
26
|
+
### IRC:
|
27
|
+
|
28
|
+
* [\#narwhal on irc.freenode.net](http://webchat.freenode.net/?channels=narwhal)
|
29
|
+
|
30
|
+
|
31
|
+
Documentation
|
32
|
+
-------------
|
33
|
+
|
34
|
+
* [Quick Start](quick-start.html)
|
35
|
+
* [Packages](packages.html)
|
36
|
+
* [How to Install Packages](packages.html)
|
37
|
+
* [How to Build Packages](packages-howto.html)
|
38
|
+
* [Modules](modules.html)
|
39
|
+
* [Virtual Environments / Seas](sea.html)
|
40
|
+
* [How to Build Engines](engines.html)
|
41
|
+
* [How Narwhal Works](narwhal.html)
|
42
|
+
|
43
|
+
|
44
|
+
Contributors
|
45
|
+
------------
|
46
|
+
|
47
|
+
* [Tom Robinson](http://tlrobinson.net/)
|
48
|
+
* [Kris Kowal](http://askawizard.blogspot.com/)
|
49
|
+
* [George Moschovitis](http://blog.gmosx.com/)
|
50
|
+
* [Kevin Dangoor](http://www.blueskyonmars.com/)
|
51
|
+
* Hannes Wallnöfer
|
52
|
+
* Sébastien Pierre
|
53
|
+
* Irakli Gozalishvili
|
54
|
+
* [Christoph Dorn](http://www.christophdorn.com/)
|
55
|
+
* Zach Carter
|
56
|
+
* Nathan L. Smith
|
57
|
+
* Jan Varwig
|
58
|
+
* Mark Porter
|
59
|
+
* [Isaac Z. Schlueter](http://blog.izs.me/)
|
60
|
+
* [Kris Zyp](http://www.sitepen.com/blog/author/kzyp/)
|
61
|
+
* [Nathan Stott](http://nathan.whiteboard-it.com/)
|
62
|
+
* [Toby Ho](http://tobyho.com)
|
63
|
+
|
64
|
+
|
65
|
+
License
|
66
|
+
-------
|
67
|
+
|
68
|
+
Copyright (c) 2009, 280 North Inc. <[280north.com](http://280north.com/)\>
|
69
|
+
|
70
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
71
|
+
of this software and associated documentation files (the "Software"), to
|
72
|
+
deal in the Software without restriction, including without limitation the
|
73
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
74
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
75
|
+
furnished to do so, subject to the following conditions:
|
76
|
+
|
77
|
+
The above copyright notice and this permission notice shall be included in
|
78
|
+
all copies or substantial portions of the Software.
|
79
|
+
|
80
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
81
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
82
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
83
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
84
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
85
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
86
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,349 @@
|
|
1
|
+
# ===========================================================================
|
2
|
+
# Project: Narwhal Rakefile
|
3
|
+
# Copyright: ©2009 Apple Inc. and contributors
|
4
|
+
# ===========================================================================
|
5
|
+
|
6
|
+
# Rakefile used to build the Narwhal Gem. Requires Jeweler to function.
|
7
|
+
|
8
|
+
ROOT_PATH = File.dirname(__FILE__)
|
9
|
+
PKG_NAME = 'narwhal'
|
10
|
+
|
11
|
+
# files to ignore changes in
|
12
|
+
IGNORE_CHANGES = %w[.gitignore .gitmodules .DS_Store .gemspec VERSION.yml ^pkg ^tmp]
|
13
|
+
|
14
|
+
# Get the DISTRIBUTION info
|
15
|
+
require 'yaml'
|
16
|
+
DIST = YAML.load File.read(File.expand_path(File.join(ROOT_PATH, 'DISTRIBUTION.yml')))
|
17
|
+
|
18
|
+
# Make empty to not use sudo
|
19
|
+
SUDO = 'sudo'
|
20
|
+
|
21
|
+
################################################
|
22
|
+
## LOAD DEPENDENCIES
|
23
|
+
##
|
24
|
+
begin
|
25
|
+
require 'rubygems'
|
26
|
+
require 'jeweler'
|
27
|
+
require 'extlib'
|
28
|
+
require 'fileutils'
|
29
|
+
require 'spec/rake/spectask'
|
30
|
+
|
31
|
+
$:.unshift(ROOT_PATH / 'lib')
|
32
|
+
require 'sproutcore'
|
33
|
+
|
34
|
+
rescue LoadError => e
|
35
|
+
$stderr.puts "WARN: some required gems are not installed (try rake init to setup)"
|
36
|
+
$stderr.puts e
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
################################################
|
41
|
+
## PROJECT DESCRIPTION
|
42
|
+
##
|
43
|
+
|
44
|
+
Jeweler::Tasks.new do |gemspec|
|
45
|
+
gemspec.name = 'sproutit-narwhal'
|
46
|
+
gemspec.authors = 'Published by Sprout Systems Inc. Developed by Tom Robinson and contributors'
|
47
|
+
gemspec.email = 'contact@sproutcore.com'
|
48
|
+
gemspec.homepage = 'http://www.narwhaljs.com'
|
49
|
+
gemspec.summary = "JavaScript Command Line"
|
50
|
+
|
51
|
+
gemspec.add_development_dependency 'extlib', ">= 0.9.9"
|
52
|
+
gemspec.add_development_dependency 'gemcutter', ">= 0.1.0"
|
53
|
+
gemspec.add_development_dependency 'jeweler', ">= 1.0.0"
|
54
|
+
|
55
|
+
gemspec.rubyforge_project = "sproutit-narwhal"
|
56
|
+
|
57
|
+
gemspec.files.include *%w[engines/jsc/**/* extconf.rb]
|
58
|
+
gemspec.files.exclude *%w[.gitignore .gitmodules .DS_Store tmp .hashinfo .svn .git narwhal.conf Makefile]
|
59
|
+
gemspec.files.exclude *%w[engines/jsc/**/*.dylib engines/jsc/**/*.dylib.dSYM engines/jsc/**/*.so engines/jsc/**/*.dll engines/jsc/**/*.o engines/jsc/**/*.s engines/jsc/**/*.ii engines/jsc/bin/*]
|
60
|
+
|
61
|
+
gemspec.description = File.read(ROOT_PATH / 'README.md')
|
62
|
+
|
63
|
+
# name specifically b/c some of the ones in the bin dir aren't useful as gem
|
64
|
+
gemspec.executables = %w(narwhal sea tusk)
|
65
|
+
gemspec.extensions = ['extconf.rb']
|
66
|
+
gemspec.bindir = 'gem_bin'
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
71
|
+
rubyforge.doc_task = 'rdoc'
|
72
|
+
end
|
73
|
+
|
74
|
+
Jeweler::GemcutterTasks.new
|
75
|
+
|
76
|
+
|
77
|
+
def git(path, cmd, log=true)
|
78
|
+
$stdout.puts("#{path.sub(ROOT_PATH, '')}: git #{cmd}") if log
|
79
|
+
git_path = path / '.git'
|
80
|
+
git_index = git_path / 'index'
|
81
|
+
|
82
|
+
# The env can become polluted; breaking git. This will avoid that.
|
83
|
+
%x[GIT_DIR=#{git_path}; GIT_WORK_TREE=#{path}; GIT_INDEX_FILE=#{git_index}; git #{cmd}]
|
84
|
+
end
|
85
|
+
|
86
|
+
################################################
|
87
|
+
## CORE TASKS
|
88
|
+
##
|
89
|
+
|
90
|
+
desc "performs an initial setup on the tools. Installs gems, checkout"
|
91
|
+
task :init => [:install_gems, 'dist:init', 'dist:update']
|
92
|
+
|
93
|
+
task :install_gems do
|
94
|
+
$stdout.puts "Installing gems (may ask for password)"
|
95
|
+
system %[#{SUDO} gem install jeweler gemcutter extlib] # dev req
|
96
|
+
end
|
97
|
+
|
98
|
+
namespace :dist do
|
99
|
+
|
100
|
+
desc "checkout any frameworks in the distribution"
|
101
|
+
task :init do
|
102
|
+
$stdout.puts "Setup distribution"
|
103
|
+
|
104
|
+
DIST.each do |rel_path, opts|
|
105
|
+
path = ROOT_PATH / rel_path
|
106
|
+
repo_url = opts['repo']
|
107
|
+
|
108
|
+
if !File.exists?(path / ".git")
|
109
|
+
$stdout.puts " Creating repo for #{rel_path}"
|
110
|
+
FileUtils.mkdir_p File.dirname(path)
|
111
|
+
|
112
|
+
$stdout.puts "\n> git clone #{repo_url} #{path}"
|
113
|
+
system "GIT_WORK_TREE=#{path}; cd #{File.dirname(path)}; git clone #{repo_url} #{File.basename(path)}"
|
114
|
+
|
115
|
+
else
|
116
|
+
$stdout.puts "Found #{rel_path}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
desc "make the version of each distribution item match the one in VERSION"
|
122
|
+
task :update => 'dist:init' do
|
123
|
+
$stdout.puts "Setup distribution"
|
124
|
+
|
125
|
+
# Use this to get the commit hash
|
126
|
+
version_file = ROOT_PATH / 'VERSION.yml'
|
127
|
+
if File.exist?(version_file)
|
128
|
+
versions = YAML.load File.read(version_file)
|
129
|
+
versions = (versions['dist'] || versions[:dist]) if versions
|
130
|
+
versions ||= {}
|
131
|
+
end
|
132
|
+
|
133
|
+
DIST.each do |rel_path, opts|
|
134
|
+
path = ROOT_PATH / rel_path
|
135
|
+
|
136
|
+
if File.exists?(path / ".git") && versions[rel_path]
|
137
|
+
sha = versions[rel_path]
|
138
|
+
|
139
|
+
$stdout.puts "\n> git fetch"
|
140
|
+
$stdout.puts git(path, 'fetch')
|
141
|
+
|
142
|
+
$stdout.puts "\n> git checkout #{sha}"
|
143
|
+
$stdout.puts git(path, 'checkout #{sha}')
|
144
|
+
else
|
145
|
+
$stdout.puts "WARN: cannot fix version for #{rel_path}"
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
namespace :release do
|
154
|
+
|
155
|
+
desc "tags the current repository and any distribution repositories. if you can push to distribution, then push tag as well"
|
156
|
+
task :tag => :update_version do
|
157
|
+
tag_name = "REL-#{RELEASE_VERSION}"
|
158
|
+
DIST.keys.push(PKG_NAME).each do |rel_path|
|
159
|
+
full_path = rel_path==PKG_NAME ? ROOT_PATH : (ROOT_PATH / rel_path)
|
160
|
+
git(full_path, "tag -f #{tag_name}")
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
task :push_tags => :tag do
|
165
|
+
tag_name = "REL-#{RELEASE_VERSION}"
|
166
|
+
DIST.keys.push(PKG_NAME).each do |rel_path|
|
167
|
+
full_path = rel_path==PKG_NAME ? ROOT_PATH : (ROOT_PATH / rel_path)
|
168
|
+
git(full_path, "push origin #{tag_name}")
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
desc "prepare release. verify clean, update version, tag"
|
174
|
+
task :prepare => ['git:verify_clean', :update_version, :tag, :push_tags]
|
175
|
+
|
176
|
+
desc "release to rubyforge for old skool folks"
|
177
|
+
task :rubyforge => [:prepare, 'rubyforge:release']
|
178
|
+
|
179
|
+
desc "release to gemcutter for new skool kids"
|
180
|
+
task :gemcutter => [:prepare, 'gemcutter:release']
|
181
|
+
|
182
|
+
desc "one release to rule them all"
|
183
|
+
task :all => [:prepare, 'release:gemcutter', 'release:rubyforge']
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
desc "computes the current hash of the code. used to autodetect build changes"
|
188
|
+
task :hash_content do
|
189
|
+
|
190
|
+
require 'yaml'
|
191
|
+
require 'digest/md5'
|
192
|
+
|
193
|
+
ignore = IGNORE_CHANGES.map do |x|
|
194
|
+
if x =~ /^\^/
|
195
|
+
/^#{Regexp.escape(ROOT_PATH / x[1..-1])}/
|
196
|
+
else
|
197
|
+
/#{Regexp.escape(x)}/
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# First, get the hashinfo if it exists. use this to decide if we need to
|
202
|
+
# rehash
|
203
|
+
hashinfo_path = ROOT_PATH / '.hashinfo.yml'
|
204
|
+
hash_date = 0
|
205
|
+
hash_digest = nil
|
206
|
+
|
207
|
+
if File.exist?(hashinfo_path)
|
208
|
+
yaml = YAML.load_file(hashinfo_path)
|
209
|
+
hash_date = yaml['date'] || yaml[:date] || hash_date
|
210
|
+
hash_digest = yaml['digest'] || yaml[:digest] || hash_digest
|
211
|
+
end
|
212
|
+
|
213
|
+
# paths to search
|
214
|
+
paths = Dir.glob(File.join(ROOT_PATH, '**', '*')).reject do |path|
|
215
|
+
File.directory?(path) || (ignore.find { |i| path =~ i })
|
216
|
+
end
|
217
|
+
|
218
|
+
cur_date = 0
|
219
|
+
paths.each do |path|
|
220
|
+
mtime = File.mtime(path)
|
221
|
+
mtime = mtime.nil? ? 0 : mtime.to_i
|
222
|
+
$stdout.puts "detected file change: #{path.gsub(ROOT_PATH,'')}" if mtime > hash_date
|
223
|
+
cur_date = mtime if mtime > cur_date
|
224
|
+
end
|
225
|
+
|
226
|
+
if hash_digest.nil? || (cur_date != hash_date)
|
227
|
+
digests = paths.map do |path|
|
228
|
+
Digest::SHA1.hexdigest(File.read(path))
|
229
|
+
end
|
230
|
+
digests.compact!
|
231
|
+
hash_digest = Digest::SHA1.hexdigest(digests.join)
|
232
|
+
end
|
233
|
+
hash_date = cur_date
|
234
|
+
|
235
|
+
# write cache
|
236
|
+
File.open(hashinfo_path, 'w+') do |f|
|
237
|
+
YAML.dump({ :date => hash_date, :digest => hash_digest }, f)
|
238
|
+
end
|
239
|
+
|
240
|
+
# finally set the hash
|
241
|
+
CONTENT_HASH = hash_digest
|
242
|
+
$stdout.puts "CONTENT_HASH = #{CONTENT_HASH}"
|
243
|
+
end
|
244
|
+
|
245
|
+
desc "updates the VERSION file, bumbing the build rev if the current commit has changed"
|
246
|
+
task :update_version => 'hash_content' do
|
247
|
+
|
248
|
+
path = ROOT_PATH / 'VERSION.yml'
|
249
|
+
|
250
|
+
require 'yaml'
|
251
|
+
|
252
|
+
# first, load the current yaml if possible
|
253
|
+
major = 1
|
254
|
+
minor = 0
|
255
|
+
build = 99
|
256
|
+
rev = '-0-'
|
257
|
+
dist = {}
|
258
|
+
|
259
|
+
if File.exist?(path)
|
260
|
+
yaml = YAML.load_file(path)
|
261
|
+
major = yaml['major'] || yaml[:major] || major
|
262
|
+
minor = yaml['minor'] || yaml[:minor] || minor
|
263
|
+
build = yaml['patch'] || yaml[:patch] || build
|
264
|
+
rev = yaml['digest'] || yaml[:digest] || rev
|
265
|
+
end
|
266
|
+
|
267
|
+
build += 1 if rev != CONTENT_HASH #increment if needed
|
268
|
+
rev = CONTENT_HASH
|
269
|
+
|
270
|
+
# Update distribution versions
|
271
|
+
DIST.each do |rel_path, ignored|
|
272
|
+
dist_path = ROOT_PATH / rel_path
|
273
|
+
if File.exists?(dist_path)
|
274
|
+
dist_rev = git(dist_path, "log HEAD^..HEAD")
|
275
|
+
dist_rev = dist_rev.split("\n").first.scan(/commit ([^\s]+)/)
|
276
|
+
dist_rev = ((dist_rev || []).first || []).first
|
277
|
+
|
278
|
+
if dist_rev.nil?
|
279
|
+
$stdout.puts " WARN: cannot find revision for #{rel_path}"
|
280
|
+
else
|
281
|
+
dist[rel_path] = dist_rev
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
$stdout.puts "write version #{[major, minor, build].join('.')} => #{path}"
|
287
|
+
File.open(path, 'w+') do |f|
|
288
|
+
YAML.dump({
|
289
|
+
:major => major,
|
290
|
+
:minor => minor,
|
291
|
+
:patch => build,
|
292
|
+
:digest => rev,
|
293
|
+
:dist => dist
|
294
|
+
}, f)
|
295
|
+
end
|
296
|
+
|
297
|
+
RELEASE_VERSION = "#{major}.#{minor}.#{build}"
|
298
|
+
|
299
|
+
end
|
300
|
+
|
301
|
+
desc "cleanup the pkg dir"
|
302
|
+
task :clean do
|
303
|
+
path = ROOT_PATH / 'pkg'
|
304
|
+
FileUtils.rm_r(path) if File.directory?(path)
|
305
|
+
`rm #{ROOT_PATH / '*.gem'}`
|
306
|
+
end
|
307
|
+
|
308
|
+
namespace :git do
|
309
|
+
|
310
|
+
desc "verifies there are no pending changes to commit to git"
|
311
|
+
task :verify_clean do
|
312
|
+
DIST.keys.push(PKG_NAME).each do |repo_name|
|
313
|
+
full_path = repo_name==PKG_NAME ? ROOT_PATH : (ROOT_PATH / repo_name)
|
314
|
+
|
315
|
+
result = git(full_path, 'status')
|
316
|
+
|
317
|
+
if !(result =~ /nothing to commit \(working directory clean\)/)
|
318
|
+
if (repo_name != PKG_NAME) ||
|
319
|
+
(!(result =~ /#\n#\tmodified: VERSION.yml\n#\n/))
|
320
|
+
$stderr.puts "\nFATAL: Cannot complete task: changes are still pending in the '#{repo_name}' repository."
|
321
|
+
$stderr.puts " Commit your changes to git to continue.\n\n"
|
322
|
+
exit(1)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
desc "Collects the current SHA1 commit hash into COMMIT_ID"
|
329
|
+
task :collect_commit do
|
330
|
+
log = `git log HEAD^..HEAD`
|
331
|
+
COMMIT_ID = log.split("\n").first.match(/commit ([\w]+)/).to_a[1]
|
332
|
+
if COMMIT_ID.empty?
|
333
|
+
$stderr.puts "\nFATAL: Cannot discover current commit id"
|
334
|
+
exit(1)
|
335
|
+
else
|
336
|
+
$stdout.puts "COMMIT_ID = #{COMMIT_ID}"
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
342
|
+
# Write a new version everytime we generate
|
343
|
+
task 'gemspec:generate' => :update_version
|
344
|
+
task 'rubyforge:setup' => :update_version
|
345
|
+
|
346
|
+
Spec::Rake::SpecTask.new
|
347
|
+
|
348
|
+
|
349
|
+
# EOF
|