nibjs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +45 -0
- data/LICENCE.js +7 -0
- data/LICENCE.md +22 -0
- data/Manifest.txt +16 -0
- data/README.md +64 -0
- data/Rakefile +53 -0
- data/bin/nibjs +4 -0
- data/lib/nibjs/loader.rb +2 -0
- data/lib/nibjs/main.rb +288 -0
- data/lib/nibjs/version.rb +14 -0
- data/lib/nibjs.rb +9 -0
- data/nibjs.gemspec +194 -0
- data/nibjs.noespec +41 -0
- data/src/nibjs.coffee +124 -0
- data/tasks/debug_mail.rake +78 -0
- data/tasks/debug_mail.txt +13 -0
- data/tasks/dist.rake +14 -0
- data/tasks/gem.rake +68 -0
- data/tasks/test.rake +72 -0
- data/tasks/yard.rake +51 -0
- data/test/command/header.js +1 -0
- data/test/command/nibjs_spec.rb +52 -0
- data/test/command/run.rb +3 -0
- data/test/command/sc_coffee_1.exp +31 -0
- data/test/command/sc_coffee_2.exp +26 -0
- data/test/command/sc_coffee_3.exp +25 -0
- data/test/command/sc_coffee_4.exp +26 -0
- data/test/command/sc_coffee_5.exp +24 -0
- data/test/command/sc_common_0.exp +31 -0
- data/test/command/sc_common_1.exp +31 -0
- data/test/command/sc_common_2.exp +32 -0
- data/test/command/sc_common_3.exp +32 -0
- data/test/command/sc_common_4.exp +1 -0
- data/test/command/sc_common_5.exp +1 -0
- data/test/command/scenarios.rb +73 -0
- data/test/fixture.coffee/app.coffee +6 -0
- data/test/fixture.coffee/dependent.coffee +8 -0
- data/test/fixture.coffee/index.coffee +3 -0
- data/test/fixture.js/app.js +9 -0
- data/test/fixture.js/dependent.js +10 -0
- data/test/fixture.js/index.js +3 -0
- data/test/fixture.min.js +28 -0
- data/test/integration/index.html +42 -0
- data/test/integration/integration_test.coffee +29 -0
- data/test/integration/integration_test.js +34 -0
- data/test/integration/integration_test.rb +37 -0
- data/test/integration/jquery-1.4.4.min.js +167 -0
- data/test/jasmine/nibjs_spec.coffee +31 -0
- data/test/jasmine/run.coffee +14 -0
- data/test/nibjs.js +74 -0
- metadata +325 -0
data/nibjs.gemspec
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
# We require your library, mainly to have access to the VERSION number.
|
2
|
+
# Feel free to set $version manually.
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require "nibjs/version"
|
5
|
+
$version = NibJS::Version.to_s
|
6
|
+
|
7
|
+
#
|
8
|
+
# This is your Gem specification. Default values are provided so that your library
|
9
|
+
# should be correctly packaged given what you have described in the .noespec file.
|
10
|
+
#
|
11
|
+
Gem::Specification.new do |s|
|
12
|
+
|
13
|
+
################################################################### ABOUT YOUR GEM
|
14
|
+
|
15
|
+
# Gem name (required)
|
16
|
+
s.name = "nibjs"
|
17
|
+
|
18
|
+
# Gem version (required)
|
19
|
+
s.version = $version
|
20
|
+
|
21
|
+
# A short summary of this gem
|
22
|
+
#
|
23
|
+
# This is displayed in `gem list -d`.
|
24
|
+
s.summary = "nib.js - Package and embed node.js or coffeescript libraries in the browser"
|
25
|
+
|
26
|
+
# A long description of this gem (required)
|
27
|
+
#
|
28
|
+
# The description should be more detailed than the summary. For example,
|
29
|
+
# you might wish to copy the entire README into the description.
|
30
|
+
s.description = "nib.js is a NibJS javascript library allowing to maintain javascript projects ala 'node.js'\n(modules, exports, require) while also targetting a web browser as execution platform. It\ncontains a simple packager command (nibjs) that will convert your sources to a single and\nminified .js file to be embedded in the browser. Node.js's exports and require are correctly\nbounded."
|
31
|
+
|
32
|
+
# The URL of this gem home page (optional)
|
33
|
+
s.homepage = "http://github.com/blambeau/nib.js"
|
34
|
+
|
35
|
+
# Gem publication date (required but auto)
|
36
|
+
#
|
37
|
+
# Today is automatically used by default, uncomment only if
|
38
|
+
# you know what you do!
|
39
|
+
#
|
40
|
+
# s.date = Time.now.strftime('%Y-%m-%d')
|
41
|
+
|
42
|
+
# The license(s) for the library. Each license must be a short name, no
|
43
|
+
# more than 64 characters.
|
44
|
+
#
|
45
|
+
# s.licences = %w{}
|
46
|
+
|
47
|
+
# The rubyforge project this gem lives under (optional)
|
48
|
+
#
|
49
|
+
# s.rubyforge_project = nil
|
50
|
+
|
51
|
+
################################################################### ABOUT THE AUTHORS
|
52
|
+
|
53
|
+
# The list of author names who wrote this gem.
|
54
|
+
#
|
55
|
+
# If you are providing multiple authors and multiple emails they should be
|
56
|
+
# in the same order.
|
57
|
+
#
|
58
|
+
s.authors = ["Bernard Lambeau"]
|
59
|
+
|
60
|
+
# Contact emails for this gem
|
61
|
+
#
|
62
|
+
# If you are providing multiple authors and multiple emails they should be
|
63
|
+
# in the same order.
|
64
|
+
#
|
65
|
+
# NOTE: Somewhat strangly this attribute is always singular!
|
66
|
+
# Don't replace by s.emails = ...
|
67
|
+
s.email = ["blambeau@gmail.com"]
|
68
|
+
|
69
|
+
################################################################### PATHS, FILES, BINARIES
|
70
|
+
|
71
|
+
# Paths in the gem to add to $LOAD_PATH when this gem is
|
72
|
+
# activated (required).
|
73
|
+
#
|
74
|
+
# The default 'lib' is typically sufficient.
|
75
|
+
s.require_paths = ["lib"]
|
76
|
+
|
77
|
+
# Files included in this gem.
|
78
|
+
#
|
79
|
+
# By default, we take all files included in the Manifest.txt file on root
|
80
|
+
# of the project. Entries of the manifest are interpreted as Dir[...]
|
81
|
+
# patterns so that lazy people may use wilcards like lib/**/*
|
82
|
+
#
|
83
|
+
here = File.expand_path(File.dirname(__FILE__))
|
84
|
+
s.files = File.readlines(File.join(here, 'Manifest.txt')).
|
85
|
+
inject([]){|files, pattern| files + Dir[File.join(here, pattern.strip)]}.
|
86
|
+
collect{|x| x[(1+here.size)..-1]}
|
87
|
+
|
88
|
+
# Test files included in this gem.
|
89
|
+
#
|
90
|
+
s.test_files = Dir["test/**/*"] + Dir["spec/**/*"]
|
91
|
+
|
92
|
+
# The path in the gem for executable scripts (optional)
|
93
|
+
#
|
94
|
+
s.bindir = "bin"
|
95
|
+
|
96
|
+
# Executables included in the gem.
|
97
|
+
#
|
98
|
+
s.executables = (Dir["bin/*"]).collect{|f| File.basename(f)}
|
99
|
+
|
100
|
+
################################################################### REQUIREMENTS & INSTALL
|
101
|
+
# Remember the gem version requirements operators and schemes:
|
102
|
+
# = Equals version
|
103
|
+
# != Not equal to version
|
104
|
+
# > Greater than version
|
105
|
+
# < Less than version
|
106
|
+
# >= Greater than or equal to
|
107
|
+
# <= Less than or equal to
|
108
|
+
# ~> Approximately greater than
|
109
|
+
#
|
110
|
+
# Don't forget to have a look at http://lmgtfy.com/?q=Ruby+Versioning+Policies
|
111
|
+
# for setting your gem version.
|
112
|
+
#
|
113
|
+
# For your requirements to other gems, remember that
|
114
|
+
# ">= 2.2.0" (optimistic: specify minimal version)
|
115
|
+
# ">= 2.2.0", "< 3.0" (pessimistic: not greater than the next major)
|
116
|
+
# "~> 2.2" (shortcut for ">= 2.2.0", "< 3.0")
|
117
|
+
# "~> 2.2.0" (shortcut for ">= 2.2.0", "< 2.3.0")
|
118
|
+
#
|
119
|
+
|
120
|
+
#
|
121
|
+
# One call to add_dependency('gem_name', 'gem version requirement') for each
|
122
|
+
# runtime dependency. These gems will be installed with your gem.
|
123
|
+
# One call to add_development_dependency('gem_name', 'gem version requirement')
|
124
|
+
# for each development dependency. These gems are required for developers
|
125
|
+
#
|
126
|
+
s.add_development_dependency("rake", "~> 0.8.7")
|
127
|
+
s.add_development_dependency("rspec", "~> 2.4.0")
|
128
|
+
s.add_development_dependency("rcov", "~> 0.9")
|
129
|
+
s.add_development_dependency("yard", "~> 0.6.4")
|
130
|
+
s.add_development_dependency("bluecloth", "~> 2.0.9")
|
131
|
+
s.add_development_dependency("wlang", "~> 0.10.1")
|
132
|
+
s.add_development_dependency("sinatra", "> 0")
|
133
|
+
s.add_development_dependency("bundler", "~> 1.0")
|
134
|
+
s.add_development_dependency("quickl", "~> 0.2.0")
|
135
|
+
s.add_dependency("bundler", "~> 1.0")
|
136
|
+
s.add_dependency("quickl", "~> 0.2.0")
|
137
|
+
|
138
|
+
# The version of ruby required by this gem
|
139
|
+
#
|
140
|
+
# Uncomment and set this if your gem requires specific ruby versions.
|
141
|
+
#
|
142
|
+
# s.required_ruby_version = ">= 0"
|
143
|
+
|
144
|
+
# The RubyGems version required by this gem
|
145
|
+
#
|
146
|
+
# s.required_rubygems_version = ">= 0"
|
147
|
+
|
148
|
+
# The platform this gem runs on. See Gem::Platform for details.
|
149
|
+
#
|
150
|
+
# s.platform = nil
|
151
|
+
|
152
|
+
# Extensions to build when installing the gem.
|
153
|
+
#
|
154
|
+
# Valid types of extensions are extconf.rb files, configure scripts
|
155
|
+
# and rakefiles or mkrf_conf files.
|
156
|
+
#
|
157
|
+
s.extensions = []
|
158
|
+
|
159
|
+
# External (to RubyGems) requirements that must be met for this gem to work.
|
160
|
+
# It’s simply information for the user.
|
161
|
+
#
|
162
|
+
s.requirements = nil
|
163
|
+
|
164
|
+
# A message that gets displayed after the gem is installed
|
165
|
+
#
|
166
|
+
# Uncomment and set this if you want to say something to the user
|
167
|
+
# after gem installation
|
168
|
+
#
|
169
|
+
s.post_install_message = nil
|
170
|
+
|
171
|
+
################################################################### SECURITY
|
172
|
+
|
173
|
+
# The key used to sign this gem. See Gem::Security for details.
|
174
|
+
#
|
175
|
+
# s.signing_key = nil
|
176
|
+
|
177
|
+
# The certificate chain used to sign this gem. See Gem::Security for
|
178
|
+
# details.
|
179
|
+
#
|
180
|
+
# s.cert_chain = []
|
181
|
+
|
182
|
+
################################################################### RDOC
|
183
|
+
|
184
|
+
# An ARGV style array of options to RDoc
|
185
|
+
#
|
186
|
+
# See 'rdoc --help' about this
|
187
|
+
#
|
188
|
+
s.rdoc_options = []
|
189
|
+
|
190
|
+
# Extra files to add to RDoc such as README
|
191
|
+
#
|
192
|
+
s.extra_rdoc_files = Dir["README.md"] + Dir["CHANGELOG.md"] + Dir["LICENCE.md"]
|
193
|
+
|
194
|
+
end
|
data/nibjs.noespec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# See 'noe help prepare' and 'noe help show-spec' for more information.
|
2
|
+
template-info:
|
3
|
+
name: "ruby"
|
4
|
+
version: 1.3.0
|
5
|
+
manifest:
|
6
|
+
Rakefile:
|
7
|
+
safe-override: false
|
8
|
+
|
9
|
+
# The following entries are template-related variables. Update to match your
|
10
|
+
# own configuration.
|
11
|
+
variables:
|
12
|
+
lower:
|
13
|
+
nibjs
|
14
|
+
upper:
|
15
|
+
NibJS
|
16
|
+
version:
|
17
|
+
1.0.0
|
18
|
+
summary:
|
19
|
+
nib.js - Package and embed node.js or coffeescript libraries in the browser
|
20
|
+
description: |-
|
21
|
+
nib.js is a NibJS javascript library allowing to maintain javascript projects ala 'node.js'
|
22
|
+
(modules, exports, require) while also targetting a web browser as execution platform. It
|
23
|
+
contains a simple packager command (nibjs) that will convert your sources to a single and
|
24
|
+
minified .js file to be embedded in the browser. Node.js's exports and require are correctly
|
25
|
+
bounded.
|
26
|
+
authors:
|
27
|
+
- name: Bernard Lambeau
|
28
|
+
email: blambeau@gmail.com
|
29
|
+
links:
|
30
|
+
- http://github.com/blambeau/nib.js
|
31
|
+
dependencies:
|
32
|
+
# Rake is required for developers, as usual
|
33
|
+
- {name: rake, version: "~> 0.8.7", groups: [development]}
|
34
|
+
- {name: rspec, version: "~> 2.4.0", groups: [development]}
|
35
|
+
- {name: rcov, version: "~> 0.9", groups: [development]}
|
36
|
+
- {name: yard, version: "~> 0.6.4", groups: [development]}
|
37
|
+
- {name: bluecloth, version: "~> 2.0.9", groups: [development]}
|
38
|
+
- {name: wlang, version: "~> 0.10.1", groups: [development]}
|
39
|
+
- {name: sinatra, version: "> 0", groups: [development]}
|
40
|
+
- {name: bundler, version: "~> 1.0", groups: [development, runtime]}
|
41
|
+
- {name: quickl, version: "~> 0.2.0", groups: [development, runtime]}
|
data/src/nibjs.coffee
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
exports.NibJS = {
|
2
|
+
|
3
|
+
#
|
4
|
+
# Package builders.
|
5
|
+
#
|
6
|
+
# Package builders are simply unary functions registered via NibJS.define.
|
7
|
+
# These functions are expected to build the package thanks to a Builder
|
8
|
+
# instance that they receive as first argument.
|
9
|
+
#
|
10
|
+
# @see define
|
11
|
+
# @see Builder
|
12
|
+
#
|
13
|
+
pkgBuilders: []
|
14
|
+
|
15
|
+
#
|
16
|
+
# Built packages.
|
17
|
+
#
|
18
|
+
# Once the package are built (lazily, at first 'require' invocation), the
|
19
|
+
# results is put in the following array for subsequent requiring.
|
20
|
+
#
|
21
|
+
packages: []
|
22
|
+
|
23
|
+
#
|
24
|
+
# Defines a package via a name and a builder function.
|
25
|
+
#
|
26
|
+
# Builder functions are expected to build the package thanks to a Builder
|
27
|
+
# instance received as first argument. They are expected to make the first
|
28
|
+
# require to the package index file.
|
29
|
+
#
|
30
|
+
# Example:
|
31
|
+
# NibJS.define('foo', function(nibjs){
|
32
|
+
# nibjs.register('bar', function(exports, require){
|
33
|
+
# /* content of bar.js comes here */
|
34
|
+
# });
|
35
|
+
# nibjs.register('index', function(exports, require){
|
36
|
+
# /* content of index.js come here */
|
37
|
+
# });
|
38
|
+
# /* Load the package at end */
|
39
|
+
# nibjs.require('index');
|
40
|
+
# });
|
41
|
+
#
|
42
|
+
define: (name, buildFn)->
|
43
|
+
NibJS.pkgBuilders[name] = buildFn
|
44
|
+
|
45
|
+
#
|
46
|
+
# Returns a package, building it if required (equivalent to Node's _require_).
|
47
|
+
#
|
48
|
+
# Example:
|
49
|
+
# Foo = NibJS.require('foo')
|
50
|
+
# Foo.Bar = ...
|
51
|
+
#
|
52
|
+
require: (name)->
|
53
|
+
NibJS.packages[name] ?= NibJS._build_one(name)
|
54
|
+
|
55
|
+
#
|
56
|
+
# Internal implementation of require, when invoked the first time on
|
57
|
+
# a given library.
|
58
|
+
#
|
59
|
+
_build_one: (name)->
|
60
|
+
builder = new Builder
|
61
|
+
NibJS.pkgBuilders[name](builder)
|
62
|
+
|
63
|
+
# Application control
|
64
|
+
pending: []
|
65
|
+
|
66
|
+
running: []
|
67
|
+
|
68
|
+
ready: (fn)->
|
69
|
+
NibJS.pending.push(fn)
|
70
|
+
|
71
|
+
start: ()->
|
72
|
+
for fn in NibJS.pending
|
73
|
+
NibJS.running.push(fn())
|
74
|
+
NibJS.pending = []
|
75
|
+
|
76
|
+
isRunning: (fn)->
|
77
|
+
for c in NibJS.running
|
78
|
+
return true if c is fn
|
79
|
+
return false
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
#
|
84
|
+
# Intra-package builder, passed as first argument of NibJS.define
|
85
|
+
#
|
86
|
+
# This builder helps registrering functions for building individual
|
87
|
+
# files, as well as requiring them.
|
88
|
+
#
|
89
|
+
class Builder
|
90
|
+
|
91
|
+
#
|
92
|
+
# Builds a builder instance
|
93
|
+
#
|
94
|
+
constructor: ()->
|
95
|
+
@builders = []
|
96
|
+
@built = []
|
97
|
+
|
98
|
+
#
|
99
|
+
# Register a builder function for _file_.
|
100
|
+
#
|
101
|
+
# The builder function will be called when the file will be required later.
|
102
|
+
# It takes two parameters as arguments, exports and require. The first one
|
103
|
+
# allows the file to exports artifacts while the second one mimics the
|
104
|
+
# Node's require function.
|
105
|
+
#
|
106
|
+
register: (file, builder)=>
|
107
|
+
@builders[file] = builder
|
108
|
+
|
109
|
+
#
|
110
|
+
# Mimics Node's require in the context of this building.
|
111
|
+
#
|
112
|
+
# This function returns the result of requiring _file_, building it with
|
113
|
+
# the function previously registered (if not previously done).
|
114
|
+
#
|
115
|
+
require: (file)=>
|
116
|
+
@built[file] ?= this.build_file(file)
|
117
|
+
|
118
|
+
#
|
119
|
+
# Private functions that ensures the building of a file.
|
120
|
+
#
|
121
|
+
build_file: (file)=>
|
122
|
+
exports = {}
|
123
|
+
@builders[file](exports, this.require)
|
124
|
+
exports
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Installs a rake task for debuging the announcement mail.
|
2
|
+
#
|
3
|
+
# This file installs the 'rake debug_mail' that flushes an announcement mail
|
4
|
+
# for your library on the standard output. It is automatically generated
|
5
|
+
# by Noe from your .noespec file, and should therefore be configured there,
|
6
|
+
# under the variables/rake_tasks/debug_mail entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# debug_mail:
|
11
|
+
# rx_changelog_sections: /^#/
|
12
|
+
# nb_changelog_sections: 1
|
13
|
+
# ...
|
14
|
+
#
|
15
|
+
# If you have specific needs requiring manual intervention on this file,
|
16
|
+
# don't forget to set safe-override to false in your noe specification:
|
17
|
+
#
|
18
|
+
# template-info:
|
19
|
+
# manifest:
|
20
|
+
# tasks/debug_mail.rake:
|
21
|
+
# safe-override: false
|
22
|
+
#
|
23
|
+
# The mail template used can be found in debug_mail.txt. That file may be
|
24
|
+
# changed to tune the mail you want to send. If you do so, don't forget to
|
25
|
+
# add a manifest entry in your .noespec file to avoid overriding you
|
26
|
+
# changes. The mail template uses wlang, with parentheses for block
|
27
|
+
# delimiters.
|
28
|
+
#
|
29
|
+
# template-info:
|
30
|
+
# manifest:
|
31
|
+
# tasks/debug_mail.txt:
|
32
|
+
# safe-override: false
|
33
|
+
#
|
34
|
+
begin
|
35
|
+
require 'wlang'
|
36
|
+
require 'yaml'
|
37
|
+
|
38
|
+
desc "Debug the release announcement mail"
|
39
|
+
task :debug_mail do
|
40
|
+
# Check that a .noespec file exists
|
41
|
+
noespec_file = File.expand_path('../../nibjs.noespec', __FILE__)
|
42
|
+
unless File.exists?(noespec_file)
|
43
|
+
raise "Unable to find .noespec project file, sorry."
|
44
|
+
end
|
45
|
+
|
46
|
+
# Load it as well as variables and options
|
47
|
+
noespec = YAML::load(File.read(noespec_file))
|
48
|
+
vars = noespec['variables'] || {}
|
49
|
+
|
50
|
+
# Changes are taken from CHANGELOG
|
51
|
+
logs = Dir[File.expand_path("../../CHANGELOG.*", __FILE__)]
|
52
|
+
unless logs.size == 1
|
53
|
+
abort "Unable to find a changelog file"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Load interesting changesets
|
57
|
+
changes, end_found = [], 0
|
58
|
+
File.readlines(logs.first).select{|line|
|
59
|
+
if line =~ /^#/
|
60
|
+
break if end_found >= 1
|
61
|
+
end_found += 1
|
62
|
+
end
|
63
|
+
changes << line
|
64
|
+
}
|
65
|
+
vars['changes'] = changes.join
|
66
|
+
|
67
|
+
# WLang template
|
68
|
+
template = File.expand_path('../debug_mail.txt', __FILE__)
|
69
|
+
|
70
|
+
# Let's go!
|
71
|
+
$stdout << WLang::file_instantiate(template, vars, "wlang/active-text")
|
72
|
+
end
|
73
|
+
|
74
|
+
rescue LoadError
|
75
|
+
task :debug_mail do
|
76
|
+
abort "wlang is not available. Try 'gem install wlang'"
|
77
|
+
end
|
78
|
+
end
|
data/tasks/dist.rake
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
|
3
|
+
desc "Build dist/nibjs-#{$gemspec.version}.js"
|
4
|
+
task :dist do
|
5
|
+
|
6
|
+
# compile
|
7
|
+
target = _("dist/nibjs-#{$gemspec.version}.js")
|
8
|
+
dist(target)
|
9
|
+
|
10
|
+
# minimize now
|
11
|
+
target2 = _("dist/nibjs-#{$gemspec.version}.min.js")
|
12
|
+
shell_safe_exec("uglifyjs #{target} > #{target2}")
|
13
|
+
|
14
|
+
end
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Installs rake tasks for gemming and packaging
|
2
|
+
#
|
3
|
+
# This file installs the 'rake package', 'rake gem' tasks and associates
|
4
|
+
# (clobber_package, repackage, ...). It is automatically generated by Noe
|
5
|
+
# from your .noespec file, and should therefore be configured there, under
|
6
|
+
# the variables/rake_tasks/gem entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# gem:
|
11
|
+
# package_dir: pkg
|
12
|
+
# need_tar: false
|
13
|
+
# need_tar_gz: false
|
14
|
+
# need_tar_bz2: false
|
15
|
+
# need_zip: false
|
16
|
+
# ...
|
17
|
+
#
|
18
|
+
# If you have specific needs requiring manual intervention on this file,
|
19
|
+
# don't forget to set safe-override to false in your noe specification:
|
20
|
+
#
|
21
|
+
# template-info:
|
22
|
+
# manifest:
|
23
|
+
# tasks/gem.rake:
|
24
|
+
# safe-override: false
|
25
|
+
#
|
26
|
+
begin
|
27
|
+
require 'rubygems/package_task'
|
28
|
+
Gem::PackageTask.new($gemspec) do |t|
|
29
|
+
|
30
|
+
# Name of the package
|
31
|
+
t.name = $gemspec.name
|
32
|
+
|
33
|
+
# Version of the package
|
34
|
+
t.version = $gemspec.version
|
35
|
+
|
36
|
+
# Directory used to store the package files
|
37
|
+
t.package_dir = "pkg"
|
38
|
+
|
39
|
+
# True if a gzipped tar file (tgz) should be produced
|
40
|
+
t.need_tar = false
|
41
|
+
|
42
|
+
# True if a gzipped tar file (tar.gz) should be produced
|
43
|
+
t.need_tar_gz = false
|
44
|
+
|
45
|
+
# True if a bzip2'd tar file (tar.bz2) should be produced
|
46
|
+
t.need_tar_bz2 = false
|
47
|
+
|
48
|
+
# True if a zip file should be produced (default is false)
|
49
|
+
t.need_zip = false
|
50
|
+
|
51
|
+
# List of files to be included in the package.
|
52
|
+
t.package_files = $gemspec.files
|
53
|
+
|
54
|
+
# Tar command for gzipped or bzip2ed archives.
|
55
|
+
t.tar_command = "tar"
|
56
|
+
|
57
|
+
# Zip command for zipped archives.
|
58
|
+
t.zip_command = "zip"
|
59
|
+
|
60
|
+
end
|
61
|
+
rescue LoadError
|
62
|
+
task :gem do
|
63
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
64
|
+
end
|
65
|
+
task :package do
|
66
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
67
|
+
end
|
68
|
+
end
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
begin
|
2
|
+
|
3
|
+
desc "Compile test/nibjs.js"
|
4
|
+
task :"test:dist" do
|
5
|
+
dist(_('test/nibjs.js'))
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Compile test/fixture.js"
|
9
|
+
task :"test:fixture" do
|
10
|
+
shell_safe_exec("coffee --compile --bare -o #{_('test/fixture.js')} #{_('test/fixture.coffee')}")
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require "rspec/core/rake_task"
|
15
|
+
desc "Run RSpec code examples"
|
16
|
+
RSpec::Core::RakeTask.new(:"test:rspec" => :"test:fixture") do |t|
|
17
|
+
t.pattern = "test/command/*_spec.rb"
|
18
|
+
t.rspec_opts = ["--color", "--backtrace"]
|
19
|
+
end
|
20
|
+
rescue LoadError => ex
|
21
|
+
task :"test:rspec" do
|
22
|
+
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Run spec coverage"
|
27
|
+
task :"test:coverage" do
|
28
|
+
shell_safe_exec("rcov #{_('test/command/run.rb')}")
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Compile test/fixture.min.js"
|
32
|
+
task :"test:fixture.min" => :"test:fixture" do
|
33
|
+
require "fileutils"
|
34
|
+
fix = _('test/fixture.min.js')
|
35
|
+
FileUtils.rm_rf fix
|
36
|
+
shell_safe_exec("./bin/nibjs --libname=fixture --output=#{fix} test/fixture.js")
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Run Jasmine spec examples"
|
40
|
+
task :"test:jasmine" do
|
41
|
+
shell_safe_exec("coffee #{_('test/jasmine/run.coffee')}")
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Run integration tests"
|
45
|
+
task :"test:integration" do
|
46
|
+
shell_safe_exec("coffee --compile #{_('test/integration')}")
|
47
|
+
puts "#"*100
|
48
|
+
puts "Please open the URL below in your browser"
|
49
|
+
puts "#"*100
|
50
|
+
puts shell_safe_exec("ruby #{_('test/integration/integration_test.rb')}").inspect
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Bootstrap the test suite (rebuild command/*.exp)"
|
54
|
+
task :"test:bootstrap" => :"test:fixture" do
|
55
|
+
require _("test/command/scenarios")
|
56
|
+
|
57
|
+
def boot_nibjs(options, i)
|
58
|
+
output = _("test/command/#{i}.exp")
|
59
|
+
nibjs(options, "--output=#{output}")
|
60
|
+
end
|
61
|
+
|
62
|
+
scs = NibJS::Scenarios.new
|
63
|
+
scs.common_tests_with_index{|options, i| boot_nibjs(options, i) }
|
64
|
+
scs.coffee_tests_with_index{|options, i| boot_nibjs(options, i) }
|
65
|
+
end
|
66
|
+
|
67
|
+
ensure
|
68
|
+
task :test => :"test:dist"
|
69
|
+
task :test => :"test:fixture"
|
70
|
+
task :test => :"test:rspec"
|
71
|
+
task :test => :"test:jasmine"
|
72
|
+
end
|
data/tasks/yard.rake
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Installs a rake task to generate API documentation using yard.
|
2
|
+
#
|
3
|
+
# This file installs the 'rake yard' task. It is automatically generated by Noe from
|
4
|
+
# your .noespec file, and should therefore be configured there, under the
|
5
|
+
# variables/rake_tasks/yard entry, as illustrated below:
|
6
|
+
#
|
7
|
+
# variables:
|
8
|
+
# rake_tasks:
|
9
|
+
# yard:
|
10
|
+
# files: lib/**/*.rb
|
11
|
+
# options: []
|
12
|
+
# ...
|
13
|
+
#
|
14
|
+
# If you have specific needs requiring manual intervention on this file,
|
15
|
+
# don't forget to set safe-override to false in your noe specification:
|
16
|
+
#
|
17
|
+
# template-info:
|
18
|
+
# manifest:
|
19
|
+
# tasks/yard.rake:
|
20
|
+
# safe-override: false
|
21
|
+
#
|
22
|
+
# This file has been written to conform to yard v0.6.4. More information about
|
23
|
+
# yard and the rake task installed below can be found on http://yardoc.org/
|
24
|
+
#
|
25
|
+
begin
|
26
|
+
require "yard"
|
27
|
+
desc "Generate yard documentation"
|
28
|
+
YARD::Rake::YardocTask.new(:yard) do |t|
|
29
|
+
# Array of options passed to yardoc commandline. See 'yardoc --help' about this
|
30
|
+
t.options = ["--output-dir", "doc/api", "-", "README.md", "CHANGELOG.md", "LICENCE.md"]
|
31
|
+
|
32
|
+
# Array of ruby source files (and any extra documentation files
|
33
|
+
# separated by '-')
|
34
|
+
t.files = ["lib/**/*.rb"]
|
35
|
+
|
36
|
+
# A proc to call before running the task
|
37
|
+
# t.before = proc{ }
|
38
|
+
|
39
|
+
# A proc to call after running the task
|
40
|
+
# r.after = proc{ }
|
41
|
+
|
42
|
+
# An optional lambda to run against all objects being generated.
|
43
|
+
# Any object that the lambda returns false for will be excluded
|
44
|
+
# from documentation.
|
45
|
+
# t.verifier = lambda{|obj| true}
|
46
|
+
end
|
47
|
+
rescue LoadError
|
48
|
+
task :yard do
|
49
|
+
abort 'yard is not available. In order to run yard, you must: gem install yard'
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/* this is a header */
|