jax 1.0.1 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/.travis.yml +32 -0
- data/CHANGELOG +126 -0
- data/README.md +1 -1
- data/Rakefile +125 -19
- data/bin/jax +1 -1
- data/builtin/{shaders → app/shaders}/basic/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/basic/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/basic/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/material.js +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/fog/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/fog/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/fog/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/fog/material.js +0 -0
- data/builtin/{shaders → app/shaders}/fog/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/functions/depth_map.ejs +0 -0
- data/builtin/{shaders → app/shaders}/functions/lights.ejs +0 -0
- data/builtin/{shaders → app/shaders}/functions/noise.ejs +0 -0
- data/builtin/{shaders → app/shaders}/lighting/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/lighting/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/lighting/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/lighting/material.js +0 -0
- data/builtin/{shaders → app/shaders}/lighting/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/material.js +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/material.js +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/picking/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/picking/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/picking/material.js +0 -0
- data/builtin/{shaders → app/shaders}/picking/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/material.js +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/texture/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/texture/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/texture/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/texture/material.js +0 -0
- data/builtin/{shaders → app/shaders}/texture/vertex.ejs +0 -0
- data/jax.gems +1 -1
- data/jax.gemspec +9 -7
- data/lib/jax.rb +23 -9
- data/lib/jax/application.rb +118 -60
- data/lib/jax/application/builtin.rb +12 -0
- data/lib/jax/application/builtin/configurable.rb +5 -0
- data/lib/jax/application/builtin/configuration.rb +5 -0
- data/lib/jax/application/configurable.rb +19 -0
- data/lib/jax/application/configuration.rb +46 -13
- data/lib/jax/application/railties.rb +26 -0
- data/lib/jax/core_ext/kernel.rb +7 -0
- data/lib/jax/engine.rb +64 -0
- data/lib/jax/engine/configurable.rb +19 -0
- data/lib/jax/engine/configuration.rb +49 -0
- data/lib/jax/generators/app.rb +3 -2
- data/lib/jax/generators/app/app_generator.rb +9 -2
- data/lib/jax/generators/app/templates/config/environment.rb.tt +5 -0
- data/lib/jax/generators/app/templates/public/index.html.tt +26 -0
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +8726 -1
- data/lib/jax/generators/app/templates/public/stylesheets/%file_name%.css.tt +11 -0
- data/lib/jax/generators/app/templates/public/webgl_not_supported.html +1 -1
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine.yml +1 -0
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js +13 -5
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_helper.js +6 -10
- data/lib/jax/generators/commands.rb +168 -42
- data/lib/jax/generators/controller/controller_generator.rb +9 -2
- data/lib/jax/generators/interactions.rb +56 -0
- data/lib/jax/generators/light_source/light_source_generator.rb +1 -2
- data/lib/jax/generators/material/material_generator.rb +1 -2
- data/lib/jax/generators/model/model_generator.rb +1 -3
- data/lib/jax/generators/packager/package_generator.rb +32 -0
- data/lib/jax/generators/plugin/USAGE +4 -0
- data/lib/jax/generators/plugin/all.rb +113 -0
- data/lib/jax/generators/plugin/credentials.rb +108 -0
- data/lib/jax/generators/plugin/plugin_generator.rb +72 -0
- data/lib/jax/generators/plugin/plugin_manager.rb +254 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/controllers/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/helpers/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/models/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/resources/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/views/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/config/routes.rb +3 -0
- data/lib/jax/generators/plugin/templates/new_plugin/init.rb +1 -0
- data/lib/jax/generators/plugin/templates/new_plugin/install.rb +2 -0
- data/lib/jax/generators/plugin/templates/new_plugin/public/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/spec/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/uninstall.rb +2 -0
- data/lib/jax/generators/script_jax_loader.rb +17 -0
- data/lib/jax/generators/shader/shader_generator.rb +2 -3
- data/lib/jax/monkeypatch/jasmine/config.rb +25 -1
- data/lib/jax/monkeypatch/jasmine/server.rb +1 -1
- data/lib/jax/packager.rb +12 -11
- data/lib/jax/packager/sprockets_template.rb +15 -6
- data/lib/jax/plugin.rb +49 -0
- data/lib/jax/plugin/manifest.rb +71 -0
- data/lib/jax/resource_compiler.rb +24 -14
- data/lib/jax/routes.rb +1 -0
- data/lib/jax/shader.rb +16 -1
- data/lib/jax/tasks/rake.rb +1 -1
- data/lib/jax/version.rb +3 -3
- data/spec/benchmark.htm +93 -0
- data/spec/fixtures/web/plugins/404.http +39 -0
- data/spec/fixtures/web/plugins/all.xml +106 -0
- data/spec/fixtures/web/plugins/author/create_account.xml.http +20 -0
- data/spec/fixtures/web/plugins/author/create_new_plugin.xml.http +27 -0
- data/spec/fixtures/web/plugins/author/login_existing_account.xml.http +19 -0
- data/spec/fixtures/web/plugins/author/login_not_found.xml.http +14 -0
- data/spec/fixtures/web/plugins/author/login_password_invalid.xml.http +12 -0
- data/spec/fixtures/web/plugins/clouds.xml +51 -0
- data/spec/fixtures/web/plugins/example.tgz.http +0 -0
- data/spec/fixtures/web/plugins/example.tgz.http.old +0 -0
- data/spec/fixtures/web/plugins/none.http +13 -0
- data/spec/fixtures/web/plugins/vert.xml +68 -0
- data/spec/fixtures/web/plugins/vertex-blob.xml +37 -0
- data/spec/fixtures/web/plugins/vertex-height-map.xml +44 -0
- data/spec/generators/app_generator_test.rb +42 -0
- data/spec/generators/controller_generator_test.rb +47 -0
- data/spec/generators/light_generator_test.rb +37 -0
- data/spec/generators/material_generator_test.rb +22 -0
- data/spec/generators/model_generator_test.rb +26 -0
- data/spec/generators/plugin_generator_test.rb +114 -0
- data/spec/generators/plugin_manager/push_test.rb +59 -0
- data/spec/generators/plugin_manager_test.rb +192 -0
- data/spec/generators/shader_generator_test.rb +38 -0
- data/spec/lib/jax/application_test.rb +18 -0
- data/spec/lib/jax/generators/plugin/credentials_test.rb +72 -0
- data/spec/lib/jax/packager_test.rb +87 -0
- data/spec/lib/jax/plugin_test.rb +27 -0
- data/spec/lib/jax/reloading_test.rb +23 -0
- data/spec/lib/jax/routes_test.rb +28 -0
- data/spec/lib/jax/shader_test.rb +29 -0
- data/spec/lib/jax/tasks/jax_rake_test.rb +85 -0
- data/spec/support/bases/generator_test_case.rb +108 -0
- data/spec/support/bases/isolated_test_case.rb +148 -0
- data/spec/support/fixtures_helper.rb +21 -0
- data/spec/support/spec_shell.rb +14 -1
- data/spec/test_app.rb +3 -0
- data/spec/test_helper.rb +55 -0
- metadata +200 -92
- data/spec/generators/app_generator_spec.rb +0 -47
- data/spec/generators/controller_generator_spec.rb +0 -68
- data/spec/generators/light_generator_spec.rb +0 -51
- data/spec/generators/material_generator_spec.rb +0 -35
- data/spec/generators/model_generator_spec.rb +0 -43
- data/spec/lib/jax/routes_spec.rb +0 -24
- data/spec/lib/jax/shader_spec.rb +0 -57
- data/spec/lib/jax/tasks/jax_rake_spec.rb +0 -92
- data/spec/spec_helper.rb +0 -11
data/.gitmodules
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html)
|
2
|
+
# bundler_args: --binstubs
|
3
|
+
|
4
|
+
# Specify which versions of Ruby to run the tests on; each version will be used
|
5
|
+
rvm:
|
6
|
+
- 1.8.7
|
7
|
+
- 1.9.2
|
8
|
+
|
9
|
+
# Define how to run the tests (defaults to `bundle exec rake` or `rake` depending on whether you have a `Gemfile`)
|
10
|
+
# script: "bundle exec rake rspec node"
|
11
|
+
|
12
|
+
# Define tasks to be completed before and after tests run. Will allow folding of content on frontend
|
13
|
+
# before_script:
|
14
|
+
# - command_1
|
15
|
+
# - command_2
|
16
|
+
|
17
|
+
# after_script:
|
18
|
+
# - command_1
|
19
|
+
# - command_2
|
20
|
+
|
21
|
+
# Specify an ENV variable to run before: 'bundle install' and 'rake' (or your defined 'script')
|
22
|
+
# env: "RAILS_ENV='test' "
|
23
|
+
|
24
|
+
# Specify the recipients for email notification
|
25
|
+
# notifications:
|
26
|
+
# recipients:
|
27
|
+
# - email-address-1
|
28
|
+
# - email-address-2
|
29
|
+
|
30
|
+
# Disable email notifications
|
31
|
+
# notifications:
|
32
|
+
# disabled: true
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,126 @@
|
|
1
|
+
* 1.1.0 *
|
2
|
+
|
3
|
+
* If a mesh #init method does not specify any vertex normals for the mesh, and
|
4
|
+
Jax.Mesh#getNormalBuffer() is called, Jax.Mesh will automatically calculate
|
5
|
+
vertex normals for the mesh. This is a relatively expensive operation (though
|
6
|
+
only for the first frame or so), so you should still strive to give your own set
|
7
|
+
of normals when possible.
|
8
|
+
|
9
|
+
* Jax.Mesh#setColor now accepts the color as a single RGBA array or as 4 separate R, G, B, A
|
10
|
+
arguments.
|
11
|
+
|
12
|
+
* Added Jax.Geometry.Triangle, and exposed Jax.Mesh#getTriangles(). This class comes
|
13
|
+
complete with triangle/triangle, triangle/ray, triangle/sphere, and triangle/point
|
14
|
+
intersection tests! See API documentation. Jax.Geometry.Triangle can also return
|
15
|
+
its face normal.
|
16
|
+
|
17
|
+
* Added Jax.DataRegion, Jax.DataSegment, and Jax.DataBuffer, all of which are now used
|
18
|
+
internally by Jax.Mesh to manage its mesh data. This has cut memory usage for any
|
19
|
+
given Jax.Mesh in half, makes the additional memory footprint of Jax.Geometry.Triangle
|
20
|
+
negligible, and even nets a minor performance gain. Moreover, altering vertex data
|
21
|
+
in the Jax.Mesh is now immediately reflected in Jax.Geometry.Triangle and
|
22
|
+
Jax.Geometry.Plane, since they are sharing the same region of memory.
|
23
|
+
|
24
|
+
* Made most instance methods of Jax.Geometry.Plane faster and more memory efficient. Also
|
25
|
+
altered Jax.Geometry.Plane to take advantage of Jax.DataSegment for further memory gains.
|
26
|
+
|
27
|
+
* Exposed Jax.Mesh#validate(), which makes sure the mesh has been built and builds it
|
28
|
+
immediately if it hasn't, or if it is out of date.
|
29
|
+
|
30
|
+
* Thoroughly documented all Jax-specific extensions to the glMatrix library.
|
31
|
+
|
32
|
+
* Exposed and improved Jax.Mesh#getBounds() to calculate an axis-aligned bounding box
|
33
|
+
(AABB) in object space, and to handle meshes with no vertices (in which case all values
|
34
|
+
are set to zero).
|
35
|
+
|
36
|
+
* Added lib/**/*.js to the generated jasmine.yml file. (New applications only.)
|
37
|
+
|
38
|
+
* Exposed Jax.Camera#frustum to the API. Improved Jax.Frustum and thoroughly documented
|
39
|
+
its use.
|
40
|
+
|
41
|
+
* Vastly simplified usage of built-in Perlin noise. Replace all previous code with:
|
42
|
+
|
43
|
+
Jax.noise.bind(context, uniforms);
|
44
|
+
|
45
|
+
Previous code is still compatible, but should be considered deprecated.
|
46
|
+
|
47
|
+
* Helpers can optionally be defined as arrays, rather than as functions which return
|
48
|
+
arrays. For example, the following two lines are equivalent to one another:
|
49
|
+
|
50
|
+
helpers: [ UserInputHelper ]
|
51
|
+
helpers: function() { return [ UserInputHelper]; }
|
52
|
+
|
53
|
+
This addition is purely to reduce typing. Use the old, function-based approach to defer
|
54
|
+
execution until runtime; use the array-based approach if you don't care.
|
55
|
+
|
56
|
+
* Jax.Camera now uses quaternions instead of calculating the transform matrix directly.
|
57
|
+
This nets some potential performance improvements, but since the matrix still has to
|
58
|
+
eventually be calculated, it's more for internal efficiency and code maintenence than
|
59
|
+
anything. Using quaternions does significantly reduce the Jax.Camera memory footprint,
|
60
|
+
however.
|
61
|
+
|
62
|
+
* Jax.Camera now uses a fixed yaw axis by default. Use Jax.Camera#setFixedYawAxis(false)
|
63
|
+
to disable. The new default represents the standard camera orientation, as in first-person
|
64
|
+
and third-person demos. Disabling fixed yaw axis will result in a more "flight simulator"
|
65
|
+
type of camera.
|
66
|
+
|
67
|
+
* Some minor movement-related bugfixes for Jax.Camera.
|
68
|
+
|
69
|
+
* Renamed Jax.IDENTITY_MATRIX to mat4.IDENTITY for clarity and consistency.
|
70
|
+
|
71
|
+
* Temporarily disabled calls to Jax.Context#checkForRenderErrors() in development under
|
72
|
+
Chrome, because the calls have proven far too detrimental to performance. When the
|
73
|
+
issue is fixed in Chrome, I'll re-enable this. In the meantime, do performance testing
|
74
|
+
in Chrome, but expect an overall more robust development cycle using Firefox.
|
75
|
+
|
76
|
+
* App generator: added a default but customizable stylesheet and index.html used when
|
77
|
+
packaging apps. Affects new applications only.
|
78
|
+
|
79
|
+
* Jax JavaScript library is no longer minified; this is left for developers to do after
|
80
|
+
packaging an application for production. This change makes it much simpler to track
|
81
|
+
errors in the field. May consider auto-minifying the entire package when
|
82
|
+
`rake package` is executed, but I'm not ready to do that yet.
|
83
|
+
|
84
|
+
* New error handling API lets developers hook directly into (and recover gracefully
|
85
|
+
from) otherwise catastrophic errors
|
86
|
+
|
87
|
+
* Developers can hook into "webgl not supported" errors to customize the framework's
|
88
|
+
response. By default, Jax redirects to an error page as per v1.0.0.
|
89
|
+
|
90
|
+
* Added Rails as a dependency; Jax now internally takes advantage of Railtie
|
91
|
+
to implement a highly modular application structure; Jax::Plugin and
|
92
|
+
Jax::Application both inherit from Railtie. This is not to be confused with
|
93
|
+
support for or integration with Ruby on Rails.
|
94
|
+
|
95
|
+
* Controller generator now accepts the `--root` option to automatically make it the
|
96
|
+
root controller
|
97
|
+
|
98
|
+
* Improved the light source API so that developers can replace this:
|
99
|
+
this.world.addLightSource(LightSource.find("sun"));
|
100
|
+
with:
|
101
|
+
this.world.addLightSource("sun");
|
102
|
+
|
103
|
+
* Jax now supports both Ruby 1.9.2 and Ruby 1.8.7.
|
104
|
+
|
105
|
+
* Added a benchmark script. Internal use only, but it also demonstrates a bare-bones,
|
106
|
+
JavaScript-only [no Ruby counterpart] Jax application. Check it out:
|
107
|
+
https://github.com/sinisterchipmunk/jax/blob/1-1-stable/spec/benchmark.htm
|
108
|
+
|
109
|
+
* Tons of documentation for the JavaScript API
|
110
|
+
|
111
|
+
* Plugin generator to create new plugins
|
112
|
+
|
113
|
+
* Plugin manager to search for, install, publish and remove plugins
|
114
|
+
|
115
|
+
* Plugin Repository (http://plugins.jaxgl.com)
|
116
|
+
|
117
|
+
* Plugin Guide (http://guides.jaxgl.com/plugins.html)
|
118
|
+
|
119
|
+
* Jax.Context now Unregisters event handlers upon disposal
|
120
|
+
|
121
|
+
* If a Jax.Context has been disposed, it will no longer render or update.
|
122
|
+
|
123
|
+
|
1
124
|
* 1.0.1 *
|
2
125
|
|
3
126
|
* If a render error is encountered while generating shadow maps, the corresponding
|
@@ -7,6 +130,9 @@
|
|
7
130
|
a fatal error. Note that this condition is only triggered by a hard error during
|
8
131
|
shadowmap generation; soft errors like drastically low framerates are not handled.
|
9
132
|
|
133
|
+
* Driver bug workaround: avoid early returning from void functions. Apparently some
|
134
|
+
drivers crash when void functions encounter a `return` statement. See issue #20:
|
135
|
+
https://github.com/sinisterchipmunk/jax/issues/20
|
10
136
|
|
11
137
|
|
12
138
|
* 1.0.0 *
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ rescue LoadError
|
|
10
10
|
puts " *** You don't seem to have Bundler installed. ***"
|
11
11
|
puts " Please run the following command:"
|
12
12
|
puts
|
13
|
-
puts " gem install bundler --version=1.0.
|
13
|
+
puts " gem install bundler --version=1.0.15"
|
14
14
|
exit
|
15
15
|
end
|
16
16
|
|
@@ -59,20 +59,25 @@ task :compile do
|
|
59
59
|
:load_path => ["src"],
|
60
60
|
:source_files => ["src/jax.js", "builtin/**/*.js"]
|
61
61
|
)
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
jax_root = File.expand_path(File.dirname(__FILE__))
|
63
|
+
rm_rf File.join(jax_root, "dist")
|
64
|
+
mkdir_p File.join(jax_root, "dist")
|
65
|
+
secretary.concatenation.save_to File.join(jax_root, "dist/jax.js")
|
66
|
+
|
67
|
+
mkdir_p File.join(jax_root, "tmp") unless File.directory?(File.join(jax_root, "tmp"))
|
65
68
|
|
66
69
|
# generate the built-in shaders for testing against (these are not added to the real jax dist because they are
|
67
70
|
# regenerated in the user's app)
|
68
|
-
rm File.join(File.
|
69
|
-
File.open(File.join(
|
71
|
+
rm File.join(jax_root, "tmp/shaders.js") if File.file?(File.join(jax_root, "tmp/shaders.js"))
|
72
|
+
File.open(File.join(jax_root, "tmp/shaders.js"), "w") do |f|
|
70
73
|
Jax.application.shaders.each { |shader| shader.save_to f }
|
71
74
|
end
|
72
75
|
|
73
|
-
puts "generated #{File.
|
74
|
-
|
75
|
-
|
76
|
+
puts "generated #{File.join(jax_root, "dist/jax.js")}"
|
77
|
+
|
78
|
+
# make sure the app generator copies the correct jax
|
79
|
+
cp File.join(jax_root, "dist/jax.js"),
|
80
|
+
File.join(jax_root, "lib/jax/generators/app/templates/public/javascripts/jax.js")
|
76
81
|
|
77
82
|
puts "(project built)"
|
78
83
|
end
|
@@ -81,17 +86,85 @@ desc "compile and minify Jax into dist/jax.js and dist/jax-min.js"
|
|
81
86
|
task :minify => :compile do
|
82
87
|
puts "(minifying...)"
|
83
88
|
if system("java", "-jar", File.join(File.dirname(__FILE__), "vendor/yuicompressor-2.4.2.jar"), "dist/jax.js", "-o", "dist/jax-min.js")
|
84
|
-
|
85
|
-
File.join(File.dirname(__FILE__), "lib/jax/generators/app/templates/public/javascripts/jax.js")
|
86
|
-
puts "(done.)"
|
89
|
+
puts "(done. saved to: dist/jax-min.js)"
|
87
90
|
else
|
88
91
|
puts "(Error while minifying!)"
|
89
92
|
end
|
90
93
|
end
|
91
94
|
|
95
|
+
### HACK to add redcloth support to pdoc without changing pdoc itself
|
96
|
+
class PDoc::Generators::Html::Website < PDoc::Generators::AbstractGenerator
|
97
|
+
alias _set_markdown_parser set_markdown_parser
|
98
|
+
|
99
|
+
def set_markdown_parser(parser = nil)
|
100
|
+
if parser && parser.to_sym == :redcloth
|
101
|
+
require 'redcloth'
|
102
|
+
self.class.markdown_parser = RedCloth
|
103
|
+
else
|
104
|
+
_set_markdown_parser(parser)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
92
109
|
namespace :doc do
|
110
|
+
desc "check for common pdoc typos"
|
111
|
+
task :check do
|
112
|
+
candidates = [
|
113
|
+
/\/\*\*(.*?)\*\*\//m,
|
114
|
+
/\s*\*.*?\)\s+:/, # * - object (Jax.Model) : description
|
115
|
+
/\s*\*\s*\-.*?\)\s*\-/, # * - object (Jax.Model) - description
|
116
|
+
/\s*\*\s*\-[^\n]*?\n\s*\*\*\//m, # * - object (Jax.Model): description\n **/
|
117
|
+
]
|
118
|
+
|
119
|
+
errors = false
|
120
|
+
|
121
|
+
Dir[File.expand_path("src/**/*.js", File.dirname(__FILE__))].each do |fi|
|
122
|
+
next unless File.file?(fi)
|
123
|
+
lfi = fi.sub(/^#{Regexp::escape File.expand_path("src/", File.dirname(__FILE__))}\/?/, '')
|
124
|
+
candidates.each do |candidate|
|
125
|
+
if candidate.multiline?
|
126
|
+
content = File.read(fi)
|
127
|
+
offset = 0
|
128
|
+
lineno = 1
|
129
|
+
while m = candidate.match(content[offset...content.length])
|
130
|
+
offset += m.offset(0)[1]
|
131
|
+
lineno += $`.lines.to_a.length
|
132
|
+
|
133
|
+
if candidate == candidates.first
|
134
|
+
full = $~[0]
|
135
|
+
# special case -- we're looking for parameters followed by an empty line. If it's missing,
|
136
|
+
# pdoc will not correctly parse the params.
|
137
|
+
inner = $~[1]
|
138
|
+
|
139
|
+
if inner =~ /^\s*\*\s*\-.*/m
|
140
|
+
lineno += $`.lines.to_a.length
|
141
|
+
inner = $~[0]
|
142
|
+
if inner !~ /\*\s*(\*|$)/m
|
143
|
+
errors = true
|
144
|
+
puts "#{lfi}:#{lineno} >\n#{full}"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
else
|
148
|
+
errors = true
|
149
|
+
puts "#{lfi}:#{lineno} >\n#{$~[0]}"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else
|
153
|
+
File.read(fi).lines.each_with_index do |line,no|
|
154
|
+
if line =~ candidate
|
155
|
+
errors = true
|
156
|
+
puts "#{lfi}:#{no+1} > #{$~[0]}"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
exit if errors
|
164
|
+
end
|
165
|
+
|
93
166
|
desc "build the Jax JavaScript documentation"
|
94
|
-
task :js do
|
167
|
+
task :js => 'doc:check' do
|
95
168
|
require 'erb'
|
96
169
|
FileUtils.rm_rf 'doc'
|
97
170
|
|
@@ -105,7 +178,8 @@ namespace :doc do
|
|
105
178
|
:destination => "doc",
|
106
179
|
# :index_page => 'src/README.markdown',
|
107
180
|
:syntax_highlighter => 'coderay',
|
108
|
-
:markdown_parser
|
181
|
+
:markdown_parser => :redcloth,
|
182
|
+
# :markdown_parser => :bluecloth,
|
109
183
|
:src_code_text => "View source on GitHub →",
|
110
184
|
:src_code_href => proc { |obj|
|
111
185
|
"https://github.com/sinisterchipmunk/jax/tree/master/#{obj.file}#L#{obj.line_number}"
|
@@ -156,14 +230,46 @@ namespace :guides do
|
|
156
230
|
end
|
157
231
|
end
|
158
232
|
|
233
|
+
desc "Run javascript tests using node.js"
|
234
|
+
task :node => :compile do
|
235
|
+
system("node", "spec/javascripts/node_helper.js")
|
236
|
+
end
|
237
|
+
|
238
|
+
FileUtils.rm_rf File.expand_path("spec/fixtures/tmp", File.dirname(__FILE__))
|
239
|
+
require 'rake/testtask'
|
240
|
+
desc "Run ruby tests using Test::Unit"
|
241
|
+
# NOT WORKING due to isolation tests failing. Use test:isolated instead.
|
242
|
+
Rake::TestTask.new("test_unit") do |t|
|
243
|
+
t.pattern = "{test,spec}/**/*_test.rb"
|
244
|
+
t.libs = ["./test", "./spec"].collect { |f| File.expand_path(f) }.select { |f| File.directory?(f) }
|
245
|
+
# t.verbose = true
|
246
|
+
# t.warning = true
|
247
|
+
end
|
248
|
+
|
249
|
+
namespace :test do
|
250
|
+
task :isolated do
|
251
|
+
dir = ENV["TEST_DIR"] || "**"
|
252
|
+
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
|
253
|
+
ENV['DO_NOT_ISOLATE'] = '1'
|
254
|
+
if ENV['TEST']
|
255
|
+
sh(ruby, '-Ispec', ENV['TEST'])
|
256
|
+
else
|
257
|
+
Dir["spec/#{dir}/*_test.rb"].each do |file|
|
258
|
+
next true if file.include?("fixtures")
|
259
|
+
sh(ruby, '-Ispec', File.expand_path(file, File.dirname(__FILE__)))
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
|
159
266
|
# 'Guides' tasks & code borrowed from Railties.
|
160
267
|
desc 'Generate guides (for authors), use ONLY=foo to process just "foo.textile"'
|
161
268
|
task :guides => 'guides:generate'
|
162
269
|
|
163
270
|
task :jasmine => :compile
|
164
|
-
task :build => [:compile, :minify]
|
165
|
-
task :
|
271
|
+
# task :build => [:compile, :minify] # make sure to minify the JS code before going to release
|
272
|
+
task :build => :compile
|
166
273
|
|
167
|
-
#
|
168
|
-
|
169
|
-
# task :release => :minify
|
274
|
+
# disabled node tests for now, since Jax.DataRegion and friends break it. Rake jasmine instead.
|
275
|
+
task :default => ['test:isolated']#, :node]
|
data/bin/jax
CHANGED
@@ -8,4 +8,4 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "../lib/jax/generato
|
|
8
8
|
Jax::Generators::ScriptJaxLoader.exec_script_jax! # this uses exec so, if found, the rest of this file won't load
|
9
9
|
|
10
10
|
require File.join(File.expand_path(File.dirname(__FILE__)), "../lib/jax/generators/app")
|
11
|
-
|
11
|
+
JaxAppGenerator.start
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|