jax 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rvmrc +2 -3
- data/.travis.yml +8 -22
- data/README.md +2 -2
- data/Rakefile +128 -96
- data/app/assets/javascripts/jax/controller-list.js.coffee +22 -0
- data/app/assets/javascripts/jax/dom-helpers.js.coffee +17 -0
- data/app/assets/javascripts/jax/jasmine_runner.js +177 -0
- data/app/assets/javascripts/jax/runtime.js +6 -0
- data/app/assets/javascripts/jax/shader_editor.js.coffee +33 -0
- data/app/assets/stylesheets/jax/controller-list.css +5 -0
- data/app/assets/stylesheets/jax/jasmine.css +16 -0
- data/app/assets/stylesheets/jax/nav.css +41 -0
- data/app/assets/stylesheets/jax/runtime.css +47 -0
- data/app/assets/stylesheets/jax/shader_editor.css +3 -0
- data/app/assets/stylesheets/jax/suite.css +82 -0
- data/app/controllers/jax/suite_controller.rb +48 -0
- data/app/views/jax/suite/jasmine.html.erb +38 -0
- data/app/views/jax/suite/run_webgl.html.erb +49 -0
- data/app/views/jax/suite/shader_editor.html.erb +24 -0
- data/app/views/layouts/jax.html.erb +40 -0
- data/bin/jax +8 -4
- data/config/routes.rb +2 -0
- data/config.ru +5 -0
- data/features/rails/resources.feature +45 -0
- data/features/rails/shaders.feature +13 -0
- data/features/rails/specs.feature +24 -0
- data/features/runtime.feature +15 -0
- data/features/step_definitions/environment_steps.rb +15 -0
- data/features/step_definitions/response_steps.rb +13 -0
- data/features/step_definitions/runtime.rb +11 -0
- data/features/step_definitions/web_steps.rb +223 -0
- data/features/support/env.rb +75 -0
- data/features/support/paths.rb +30 -0
- data/features/support/rails_environment.rb +3 -0
- data/features/support/selectors.rb +39 -0
- data/features/support/setup.rb +17 -0
- data/jax.gemspec +22 -16
- data/lib/assets/javascripts/jax/anim_frame.js +64 -0
- data/lib/assets/javascripts/jax/application.js +16 -0
- data/lib/assets/javascripts/jax/builtin/all.js +21 -0
- data/lib/assets/javascripts/jax/builtin/meshes/cube.js +83 -0
- data/lib/assets/javascripts/jax/builtin/meshes/plane.js +67 -0
- data/lib/assets/javascripts/jax/builtin/meshes/quad.js +89 -0
- data/lib/assets/javascripts/jax/builtin/meshes/sphere.js +65 -0
- data/lib/assets/javascripts/jax/builtin/meshes/teapot.js +48 -0
- data/lib/assets/javascripts/jax/builtin/meshes/torus.js +64 -0
- data/lib/assets/javascripts/jax/compatibility.js +312 -0
- data/lib/assets/javascripts/jax/context.js +741 -0
- data/lib/assets/javascripts/jax/core/base.js +69 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/mat3.js +20 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/mat4.js +10 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/quat4.js +148 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/vec2.js +25 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/vec3.js +86 -0
- data/lib/assets/javascripts/jax/core/glMatrix_ext/vec4.js +28 -0
- data/lib/assets/javascripts/jax/core/helper.js +44 -0
- data/lib/assets/javascripts/jax/core/math.js +61 -0
- data/lib/assets/javascripts/jax/core/matrix_stack.js +310 -0
- data/lib/assets/javascripts/jax/core/util.js +271 -0
- data/lib/assets/javascripts/jax/core.js +43 -0
- data/lib/assets/javascripts/jax/events.js +304 -0
- data/lib/assets/javascripts/jax/geometry/line.js +185 -0
- data/lib/assets/javascripts/jax/geometry/plane.js +371 -0
- data/lib/assets/javascripts/jax/geometry/triangle/inliner.rb +94 -0
- data/lib/assets/javascripts/jax/geometry/triangle/slow_tri_tri_intersect.js +20 -0
- data/lib/assets/javascripts/jax/geometry/triangle/tri_tri_intersect.js +281 -0
- data/lib/assets/javascripts/jax/geometry/triangle/tri_tri_intersect_optimized.js +564 -0
- data/lib/assets/javascripts/jax/geometry/triangle.js +311 -0
- data/lib/assets/javascripts/jax/geometry.js +14 -0
- data/lib/assets/javascripts/jax/mvc/controller.js +188 -0
- data/lib/assets/javascripts/jax/mvc/model.js +302 -0
- data/lib/assets/javascripts/jax/mvc/route_set.js +148 -0
- data/lib/assets/javascripts/jax/mvc/view.js +43 -0
- data/lib/assets/javascripts/jax/mvc/view_manager.js +65 -0
- data/lib/assets/javascripts/jax/noise.js +251 -0
- data/lib/assets/javascripts/jax/prototype/class.js +81 -0
- data/lib/assets/javascripts/jax/prototype/core.js +112 -0
- data/lib/assets/javascripts/jax/prototype/extensions.js +142 -0
- data/lib/assets/javascripts/jax/vendor/ejs.js +1 -0
- data/lib/assets/javascripts/jax/vendor/glMatrix.js +7 -0
- data/lib/assets/javascripts/jax/webgl/camera.js +697 -0
- data/lib/assets/javascripts/jax/webgl/cleanup.js +1 -0
- data/lib/assets/javascripts/jax/webgl/core/buffer.js +292 -0
- data/lib/assets/javascripts/jax/webgl/core/data_region.js +184 -0
- data/lib/assets/javascripts/jax/webgl/core/data_segment.js +255 -0
- data/lib/assets/javascripts/jax/webgl/core/events.js +99 -0
- data/lib/assets/javascripts/jax/webgl/core/framebuffer.js +316 -0
- data/lib/assets/javascripts/jax/webgl/core.js +6 -0
- data/lib/assets/javascripts/jax/webgl/material.js +381 -0
- data/lib/assets/javascripts/jax/webgl/mesh/normals.js +37 -0
- data/lib/assets/javascripts/jax/webgl/mesh/support.js +104 -0
- data/lib/assets/javascripts/jax/webgl/mesh/tangent_space.js +111 -0
- data/lib/assets/javascripts/jax/webgl/mesh.js +440 -0
- data/lib/assets/javascripts/jax/webgl/scene/frustum.js +422 -0
- data/lib/assets/javascripts/jax/webgl/scene/light_manager.js +141 -0
- data/lib/assets/javascripts/jax/webgl/scene/light_source.js +300 -0
- data/lib/assets/javascripts/jax/webgl/scene.js +16 -0
- data/lib/assets/javascripts/jax/webgl/shader/delegator/attribute.js +53 -0
- data/lib/assets/javascripts/jax/webgl/shader/delegator/uniform.js +71 -0
- data/lib/assets/javascripts/jax/webgl/shader/delegator.js +13 -0
- data/lib/assets/javascripts/jax/webgl/shader/manifest.js +70 -0
- data/lib/assets/javascripts/jax/webgl/shader/program.js +138 -0
- data/lib/assets/javascripts/jax/webgl/shader.js +299 -0
- data/lib/assets/javascripts/jax/webgl/shader_chain.js +267 -0
- data/lib/assets/javascripts/jax/webgl/texture.js +506 -0
- data/lib/assets/javascripts/jax/webgl/world.js +279 -0
- data/lib/assets/javascripts/jax/webgl.js +109 -0
- data/lib/assets/javascripts/jax.js +136 -0
- data/{builtin/app/shaders/basic/common.ejs → lib/assets/javascripts/shaders/basic/common.glsl} +0 -0
- data/{builtin/app/shaders/basic/fragment.ejs → lib/assets/javascripts/shaders/basic/fragment.glsl} +0 -0
- data/{builtin/app/shaders/basic/vertex.ejs → lib/assets/javascripts/shaders/basic/vertex.glsl} +1 -1
- data/{builtin/app/shaders/depthmap/common.ejs → lib/assets/javascripts/shaders/depthmap/common.glsl} +0 -0
- data/{builtin/app/shaders/depthmap/fragment.ejs → lib/assets/javascripts/shaders/depthmap/fragment.glsl} +1 -1
- data/{builtin/app → lib/assets/javascripts}/shaders/depthmap/material.js +0 -0
- data/{builtin/app/shaders/depthmap/vertex.ejs → lib/assets/javascripts/shaders/depthmap/vertex.glsl} +0 -0
- data/{builtin/app/shaders/fog/common.ejs → lib/assets/javascripts/shaders/fog/common.glsl} +0 -0
- data/{builtin/app/shaders/fog/fragment.ejs → lib/assets/javascripts/shaders/fog/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/fog/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/fog/material.js +6 -8
- data/{builtin/app/shaders/fog/vertex.ejs → lib/assets/javascripts/shaders/fog/vertex.glsl} +0 -0
- data/{builtin/app/shaders/functions/depth_map.ejs → lib/assets/javascripts/shaders/functions/depth_map.glsl} +0 -0
- data/{builtin/app/shaders/functions/lights.ejs → lib/assets/javascripts/shaders/functions/lights.glsl} +0 -0
- data/{builtin/app/shaders/functions/noise.ejs → lib/assets/javascripts/shaders/functions/noise.glsl} +0 -0
- data/lib/assets/javascripts/shaders/lighting/common.glsl +5 -0
- data/{builtin/app/shaders/lighting/fragment.ejs → lib/assets/javascripts/shaders/lighting/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/lighting/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/lighting/material.js +2 -4
- data/{builtin/app/shaders/lighting/vertex.ejs → lib/assets/javascripts/shaders/lighting/vertex.glsl} +0 -0
- data/{builtin/app/shaders/normal_map/common.ejs → lib/assets/javascripts/shaders/normal_map/common.glsl} +1 -1
- data/{builtin/app/shaders/normal_map/fragment.ejs → lib/assets/javascripts/shaders/normal_map/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/normal_map/manifest.yml +0 -0
- data/lib/assets/javascripts/shaders/normal_map/material.js +11 -0
- data/{builtin/app/shaders/normal_map/vertex.ejs → lib/assets/javascripts/shaders/normal_map/vertex.glsl} +0 -0
- data/{builtin/app/shaders/paraboloid/common.ejs → lib/assets/javascripts/shaders/paraboloid/common.glsl} +0 -0
- data/{builtin/app/shaders/paraboloid/fragment.ejs → lib/assets/javascripts/shaders/paraboloid/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/paraboloid/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/paraboloid/material.js +2 -4
- data/{builtin/app/shaders/paraboloid/vertex.ejs → lib/assets/javascripts/shaders/paraboloid/vertex.glsl} +0 -0
- data/{builtin/app/shaders/picking/common.ejs → lib/assets/javascripts/shaders/picking/common.glsl} +0 -0
- data/{builtin/app/shaders/picking/fragment.ejs → lib/assets/javascripts/shaders/picking/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/picking/material.js +2 -4
- data/{builtin/app/shaders/picking/vertex.ejs → lib/assets/javascripts/shaders/picking/vertex.glsl} +0 -0
- data/{builtin/app/shaders/shadow_map/common.ejs → lib/assets/javascripts/shaders/shadow_map/common.glsl} +2 -1
- data/{builtin/app/shaders/shadow_map/fragment.ejs → lib/assets/javascripts/shaders/shadow_map/fragment.glsl} +1 -1
- data/{builtin/app → lib/assets/javascripts}/shaders/shadow_map/manifest.yml +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/shadow_map/material.js +4 -6
- data/{builtin/app/shaders/shadow_map/vertex.ejs → lib/assets/javascripts/shaders/shadow_map/vertex.glsl} +0 -0
- data/{builtin/app/shaders/texture/common.ejs → lib/assets/javascripts/shaders/texture/common.glsl} +0 -0
- data/{builtin/app/shaders/texture/fragment.ejs → lib/assets/javascripts/shaders/texture/fragment.glsl} +0 -0
- data/{builtin/app → lib/assets/javascripts}/shaders/texture/manifest.yml +0 -0
- data/lib/assets/javascripts/shaders/texture/material.js +17 -0
- data/{builtin/app/shaders/texture/vertex.ejs → lib/assets/javascripts/shaders/texture/vertex.glsl} +0 -0
- data/lib/generators/jax/all.rb +16 -0
- data/lib/generators/jax/application/application_generator.rb +48 -0
- data/lib/generators/jax/base/actions.rb +52 -0
- data/lib/generators/jax/base/coffee_generator.rb +30 -0
- data/lib/generators/jax/base/named_base.rb +17 -0
- data/lib/generators/jax/base/plugin_base.rb +108 -0
- data/lib/generators/jax/base/plugin_credentials.rb +99 -0
- data/lib/generators/jax/base/plugin_manifest.rb +75 -0
- data/lib/generators/jax/base/rails_base.rb +30 -0
- data/lib/generators/jax/base/source_root.rb +5 -0
- data/lib/generators/jax/controller/controller_generator.rb +37 -0
- data/lib/generators/jax/helper/helper_generator.rb +30 -0
- data/lib/generators/jax/install/install_generator.rb +27 -0
- data/lib/generators/jax/jax_generator.rb +13 -0
- data/lib/generators/jax/light/light_generator.rb +23 -0
- data/lib/{jax/generators → generators/jax}/material/USAGE +4 -8
- data/lib/generators/jax/material/material_generator.rb +112 -0
- data/lib/generators/jax/model/model_generator.rb +24 -0
- data/lib/generators/jax/plugin/plugin_generator.rb +72 -0
- data/lib/generators/jax/scaffold/scaffold_generator.rb +35 -0
- data/lib/generators/jax/shader/shader_generator.rb +38 -0
- data/lib/jax/commands/plugin_manager.rb +240 -0
- data/lib/jax/commands.rb +69 -0
- data/lib/jax/configuration.rb +64 -0
- data/lib/jax/directive_processor.rb +53 -0
- data/lib/jax/engine.rb +38 -54
- data/lib/jax/helper_methods.rb +3 -0
- data/lib/jax/rails/application.rb +34 -0
- data/lib/jax/resource_file.rb +29 -0
- data/lib/jax/script_loader.rb +68 -0
- data/lib/jax/server.rb +87 -0
- data/lib/jax/shader.rb +70 -172
- data/lib/jax/testing/rails_environment.rb +94 -0
- data/lib/jax/util/tar.rb +75 -0
- data/lib/jax/util.rb +3 -0
- data/lib/jax/version.rb +7 -8
- data/lib/jax.rb +23 -41
- data/spec/bin/jax_spec.rb +149 -0
- data/{lib/jax/generators/app/templates/app/models/.empty_directory → spec/fixtures/public/favicon.ico} +0 -0
- data/spec/fixtures/public/textures/brickwall.jpg +0 -0
- data/spec/fixtures/public/textures/jacks.jpg +0 -0
- data/spec/fixtures/public/textures/normal_map.jpg +0 -0
- data/spec/fixtures/public/textures/rock.png +0 -0
- data/spec/fixtures/public/textures/rock_normal.png +0 -0
- data/spec/fixtures/public/textures/rss.png +0 -0
- data/spec/generators/jax/application_generator_spec.rb +18 -0
- data/spec/generators/jax/controller_generator_spec.rb +102 -0
- data/spec/generators/jax/helper_generator_spec.rb +55 -0
- data/spec/generators/jax/install_generator_spec.rb +30 -0
- data/spec/generators/jax/jax_generator_spec.rb +21 -0
- data/spec/generators/jax/light_generator_spec.rb +27 -0
- data/spec/generators/jax/material_generator_spec.rb +62 -0
- data/spec/generators/jax/model_generator_spec.rb +72 -0
- data/spec/generators/jax/plugin_generator_spec.rb +143 -0
- data/spec/generators/jax/scaffold_generator_spec.rb +35 -0
- data/spec/generators/jax/shader_generator_spec.rb +37 -0
- data/spec/javascripts/helpers/jasmine_webgl_helper.js +13 -0
- data/{lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers → spec/javascripts/helpers}/jax_spec_environment_helper.js +7 -2
- data/{lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers → spec/javascripts/helpers}/jax_spec_helper.js +0 -0
- data/spec/javascripts/jax/builtin/meshes/cube_spec.js +10 -0
- data/spec/javascripts/jax/builtin/meshes/plane_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/quad_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/sphere_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/teapot_spec.js +8 -0
- data/spec/javascripts/jax/builtin/meshes/torus_spec.js +8 -0
- data/spec/javascripts/jax/compatibility_spec.js +46 -0
- data/spec/javascripts/jax/context_events_spec.js +212 -0
- data/spec/javascripts/jax/context_spec.js +305 -0
- data/spec/javascripts/jax/core/data_region_spec.js +118 -0
- data/spec/javascripts/jax/core/data_segment_spec.js +96 -0
- data/spec/javascripts/jax/core/delegation_spec.js +48 -0
- data/spec/javascripts/jax/core/events_spec.js +17 -0
- data/spec/javascripts/jax/core/glMatrix_extensions_spec.js +8 -0
- data/spec/javascripts/jax/core/helper_spec.js +61 -0
- data/spec/javascripts/jax/core/matrix_stack_spec.js +28 -0
- data/spec/javascripts/jax/core/utils_spec.js +275 -0
- data/spec/javascripts/jax/geometry/line_spec.js +20 -0
- data/spec/javascripts/jax/geometry/plane_spec.js +181 -0
- data/spec/javascripts/jax/geometry/triangle_spec.js +105 -0
- data/spec/javascripts/jax/mvc/controller_spec.js +156 -0
- data/spec/javascripts/jax/mvc/model_spec.js +93 -0
- data/spec/javascripts/jax/mvc/route_set_spec.js +49 -0
- data/spec/javascripts/jax/mvc/view_manager_spec.js +17 -0
- data/spec/javascripts/jax/noise_spec.js +50 -0
- data/spec/javascripts/jax/optimizations/material_limitations_spec.js +85 -0
- data/spec/javascripts/jax/optimizations/shaders/basic_spec.js +65 -0
- data/spec/javascripts/jax/prototype/extensions_spec.js +34 -0
- data/spec/javascripts/jax/webgl/camera_spec.js +237 -0
- data/spec/javascripts/jax/webgl/core/events_spec.js +47 -0
- data/spec/javascripts/jax/webgl/framebuffer_spec.js +44 -0
- data/spec/javascripts/jax/webgl/lighting_spec.js +108 -0
- data/spec/javascripts/jax/webgl/material_spec.js +117 -0
- data/spec/javascripts/jax/webgl/mesh_spec.js +228 -0
- data/spec/javascripts/jax/webgl/shader/manifest_spec.js +57 -0
- data/spec/javascripts/jax/webgl/shader_chain_spec.js +211 -0
- data/spec/javascripts/jax/webgl/shader_spec.js +276 -0
- data/spec/javascripts/jax/webgl/tangent_space_spec.js +142 -0
- data/spec/javascripts/jax/webgl/texture_spec.js +159 -0
- data/spec/javascripts/jax/webgl_spec.js +5 -0
- data/spec/javascripts/jax/world_spec.js +175 -0
- data/spec/javascripts/jax_spec.js +14 -0
- data/spec/javascripts/node/mocks/webgl.js +159 -0
- data/spec/javascripts/node_helper.js +51 -0
- data/spec/javascripts/shaders/core_materials_spec.js +38 -0
- data/spec/javascripts/shaders/fog_spec.js +15 -0
- data/spec/javascripts/shaders/lighting_spec.js +15 -0
- data/spec/javascripts/shaders/normal_map_spec.js +15 -0
- data/spec/javascripts/shaders/paraboloid_spec.js +33 -0
- data/spec/javascripts/shaders/preprocessor_spec.js +45 -0
- data/spec/javascripts/shaders/shadow_map_spec.js +15 -0
- data/spec/javascripts/shaders/texture_spec.js +37 -0
- data/spec/javascripts/suite/controller_select_spec.js.coffee +24 -0
- data/spec/lib/jax/commands/plugin_manager/credentials_spec.rb +56 -0
- data/spec/lib/jax/commands/plugin_manager/push_spec.rb +62 -0
- data/spec/lib/jax/commands/plugin_manager_spec.rb +204 -0
- data/spec/lib/jax/rails/application_spec.rb +23 -0
- data/spec/lib/jax/shader_spec.rb +67 -0
- data/spec/lib/jax/util/tar_spec.rb +26 -0
- data/spec/{test_helper.rb → spec_helper.rb} +37 -28
- data/spec/support/test_model_generator.rb +14 -0
- data/templates/app/Gemfile.tt +17 -0
- data/templates/app/Rakefile +4 -0
- data/templates/app/config/application.rb +16 -0
- data/{lib/jax/generators/app/templates → templates/app}/config/boot.rb +0 -0
- data/templates/app/config/environment.rb +5 -0
- data/templates/app/config/environments/production.rb +4 -0
- data/templates/app/config.ru +6 -0
- data/{lib/jax/generators/app/templates/app/resources → templates/app/public}/.empty_directory +0 -0
- data/templates/app/script/jax +8 -0
- data/{lib/jax/generators/app/templates/app/views → templates/app/spec}/.empty_directory +0 -0
- data/templates/application_controller.js.coffee.erb +3 -0
- data/templates/application_controller.js.erb +6 -0
- data/templates/application_helper.js.coffee.erb +3 -0
- data/templates/application_helper.js.erb +3 -0
- data/templates/controller.js.coffee.erb +9 -0
- data/templates/controller.js.erb +15 -0
- data/templates/controller_spec.js.coffee.erb +9 -0
- data/templates/controller_spec.js.erb +12 -0
- data/templates/helper.js.coffee.erb +2 -0
- data/templates/helper.js.erb +3 -0
- data/templates/helper_spec.js.coffee.erb +8 -0
- data/templates/helper_spec.js.erb +12 -0
- data/{lib/jax/generators/light_source/templates/light.yml.tt → templates/light_source.resource.erb} +3 -3
- data/{lib/jax/generators/material/templates/material.yml.tt → templates/material.resource.erb} +0 -9
- data/templates/model.js.coffee.erb +3 -0
- data/templates/model.js.erb +5 -0
- data/templates/model_defaults.resource.erb +5 -0
- data/templates/model_spec.js.coffee.erb +16 -0
- data/templates/model_spec.js.erb +18 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/controllers/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/helpers/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/models/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/resources/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/app → templates/new_plugin/app/assets/jax}/views/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates → templates}/new_plugin/init.rb +0 -0
- data/{lib/jax/generators/plugin/templates → templates}/new_plugin/install.rb +0 -0
- data/{lib/jax/generators/plugin/templates/new_plugin/public → templates/new_plugin/spec}/.empty_directory +0 -0
- data/{lib/jax/generators/plugin/templates → templates}/new_plugin/uninstall.rb +0 -0
- data/{lib/jax/generators/shader/templates/common.ejs.tt → templates/shader_common.glsl.erb} +0 -0
- data/{lib/jax/generators/shader/templates/fragment.ejs.tt → templates/shader_fragment.glsl.erb} +0 -0
- data/{lib/jax/generators/shader/templates/manifest.yml.tt → templates/shader_manifest.yml.erb} +0 -0
- data/templates/shader_material.js.coffee.erb +22 -0
- data/{lib/jax/generators/shader/templates/material.js.tt → templates/shader_material.js.erb} +0 -0
- data/templates/shader_spec.js.coffee.erb +16 -0
- data/{lib/jax/generators/shader/templates/spec.js.tt → templates/shader_spec.js.erb} +1 -1
- data/{lib/jax/generators/shader/templates/vertex.ejs.tt → templates/shader_vertex.glsl.erb} +0 -0
- data/templates/view.js.coffee.erb +3 -0
- data/{lib/jax/generators/controller/templates/view.js.tt → templates/view.js.erb} +1 -1
- data/vendor/assets/javascripts/ejs.js +505 -0
- data/vendor/assets/javascripts/glMatrix.js +1772 -0
- data/vendor/assets/javascripts/jasmine.js +2476 -0
- data/vendor/assets/stylesheets/jasmine.css +166 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/alias.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/class_property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/constant.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/constructor.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/description.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/information.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/instance_method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/instance_property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/method.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/method_deprecated.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/mixin.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/namespace.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/property.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/related_to.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/search-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/section-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/section.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/selected-section-background.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/subclass.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/superclass.png +0 -0
- data/vendor/pdoc_template/html/assets/images/pdoc/utility.png +0 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/application.js +478 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/prototype.js +4874 -0
- data/vendor/pdoc_template/html/assets/javascripts/pdoc/tabs.js +506 -0
- data/vendor/pdoc_template/html/assets/stylesheets/jax.css +30 -0
- data/vendor/pdoc_template/html/assets/stylesheets/pdoc/api.css +681 -0
- data/vendor/pdoc_template/html/assets/stylesheets/pdoc/pygments.css +62 -0
- data/vendor/pdoc_template/html/helpers.rb +35 -0
- data/vendor/pdoc_template/html/index.erb +18 -0
- data/vendor/pdoc_template/html/item_index.js.erb +6 -0
- data/vendor/pdoc_template/html/layout.erb +67 -0
- data/vendor/pdoc_template/html/leaf.erb +22 -0
- data/vendor/pdoc_template/html/node.erb +30 -0
- data/vendor/pdoc_template/html/partials/class_relationships.erb +19 -0
- data/vendor/pdoc_template/html/partials/classes.erb +7 -0
- data/vendor/pdoc_template/html/partials/constructor.erb +5 -0
- data/vendor/pdoc_template/html/partials/description.erb +5 -0
- data/vendor/pdoc_template/html/partials/link_list.erb +1 -0
- data/vendor/pdoc_template/html/partials/method_signatures.erb +14 -0
- data/vendor/pdoc_template/html/partials/methodized_note.erb +9 -0
- data/vendor/pdoc_template/html/partials/mixins.erb +7 -0
- data/vendor/pdoc_template/html/partials/namespaces.erb +7 -0
- data/vendor/pdoc_template/html/partials/related_utilities.erb +5 -0
- data/vendor/pdoc_template/html/partials/relationships.erb +11 -0
- data/vendor/pdoc_template/html/partials/short_description_list.erb +7 -0
- data/vendor/pdoc_template/html/partials/title.erb +24 -0
- data/vendor/pdoc_template/html/section.erb +18 -0
- metadata +635 -332
- data/builtin/app/shaders/lighting/common.ejs +0 -5
- data/builtin/app/shaders/normal_map/material.js +0 -16
- data/builtin/app/shaders/texture/material.js +0 -18
- data/jax.gems +0 -1
- data/lib/jax/application/builtin/configurable.rb +0 -5
- data/lib/jax/application/builtin/configuration.rb +0 -5
- data/lib/jax/application/builtin.rb +0 -12
- data/lib/jax/application/configurable.rb +0 -19
- data/lib/jax/application/configuration.rb +0 -60
- data/lib/jax/application/railties.rb +0 -26
- data/lib/jax/application.rb +0 -149
- data/lib/jax/core_ext/kernel.rb +0 -7
- data/lib/jax/engine/configurable.rb +0 -19
- data/lib/jax/engine/configuration.rb +0 -49
- data/lib/jax/generators/app/app_generator.rb +0 -96
- data/lib/jax/generators/app/templates/Gemfile.tt +0 -3
- data/lib/jax/generators/app/templates/Rakefile +0 -6
- data/lib/jax/generators/app/templates/app/controllers/application_controller.js.tt +0 -5
- data/lib/jax/generators/app/templates/app/helpers/application_helper.js.tt +0 -3
- data/lib/jax/generators/app/templates/config/application.rb.tt +0 -6
- data/lib/jax/generators/app/templates/config/environment.rb.tt +0 -5
- data/lib/jax/generators/app/templates/config/routes.rb.tt +0 -5
- data/lib/jax/generators/app/templates/public/index.html.tt +0 -26
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +0 -9462
- data/lib/jax/generators/app/templates/public/stylesheets/%file_name%.css.tt +0 -11
- data/lib/jax/generators/app/templates/public/webgl_not_supported.html +0 -26
- data/lib/jax/generators/app/templates/script/jax +0 -7
- data/lib/jax/generators/app/templates/spec/javascripts/controllers/application_controller_spec.js +0 -11
- data/lib/jax/generators/app/templates/spec/javascripts/helpers/application_helper_spec.js +0 -12
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine.yml +0 -91
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine_config.rb +0 -23
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine_runner.rb +0 -32
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_layout.html.erb +0 -104
- data/lib/jax/generators/app.rb +0 -18
- data/lib/jax/generators/commands.rb +0 -220
- data/lib/jax/generators/controller/USAGE +0 -9
- data/lib/jax/generators/controller/controller_generator.rb +0 -66
- data/lib/jax/generators/controller/templates/controller_source.js.tt +0 -16
- data/lib/jax/generators/controller/templates/controller_test.js.tt +0 -11
- data/lib/jax/generators/controller/templates/helper.js.tt +0 -3
- data/lib/jax/generators/controller/templates/helper_test.js.tt +0 -12
- data/lib/jax/generators/interactions.rb +0 -56
- data/lib/jax/generators/light_source/USAGE +0 -14
- data/lib/jax/generators/light_source/light_source_generator.rb +0 -46
- data/lib/jax/generators/material/material_generator.rb +0 -80
- data/lib/jax/generators/material/templates/append.yml.tt +0 -7
- data/lib/jax/generators/model/USAGE +0 -5
- data/lib/jax/generators/model/model_generator.rb +0 -40
- data/lib/jax/generators/model/templates/model.js.tt +0 -11
- data/lib/jax/generators/model/templates/test.js.tt +0 -11
- data/lib/jax/generators/packager/package_generator.rb +0 -32
- data/lib/jax/generators/plugin/USAGE +0 -4
- data/lib/jax/generators/plugin/all.rb +0 -113
- data/lib/jax/generators/plugin/credentials.rb +0 -108
- data/lib/jax/generators/plugin/plugin_generator.rb +0 -72
- data/lib/jax/generators/plugin/plugin_manager.rb +0 -254
- data/lib/jax/generators/plugin/templates/new_plugin/config/routes.rb +0 -3
- data/lib/jax/generators/plugin/templates/new_plugin/spec/.empty_directory +0 -0
- data/lib/jax/generators/script_jax_loader.rb +0 -49
- data/lib/jax/generators/shader/USAGE +0 -4
- data/lib/jax/generators/shader/shader_generator.rb +0 -70
- data/lib/jax/monkeypatch/jasmine/config.rb +0 -45
- data/lib/jax/monkeypatch/jasmine/server.rb +0 -50
- data/lib/jax/monkeypatch/jasmine.rb +0 -3
- data/lib/jax/packager/sprockets_template.rb +0 -77
- data/lib/jax/packager.rb +0 -59
- data/lib/jax/plugin/manifest.rb +0 -71
- data/lib/jax/plugin.rb +0 -49
- data/lib/jax/resource_compiler.rb +0 -60
- data/lib/jax/routes.rb +0 -62
- data/lib/jax/tasks/rake.rb +0 -38
- data/spec/benchmark.htm +0 -93
- data/spec/generators/app_generator_test.rb +0 -42
- data/spec/generators/controller_generator_test.rb +0 -47
- data/spec/generators/light_generator_test.rb +0 -37
- data/spec/generators/material_generator_test.rb +0 -22
- data/spec/generators/model_generator_test.rb +0 -26
- data/spec/generators/plugin_generator_test.rb +0 -114
- data/spec/generators/plugin_manager/push_test.rb +0 -59
- data/spec/generators/plugin_manager_test.rb +0 -192
- data/spec/generators/shader_generator_test.rb +0 -38
- data/spec/javascripts/support/jasmine.yml +0 -85
- data/spec/javascripts/support/jasmine_runner.rb +0 -32
- data/spec/lib/jax/application_test.rb +0 -18
- data/spec/lib/jax/generators/plugin/credentials_test.rb +0 -72
- data/spec/lib/jax/packager_test.rb +0 -87
- data/spec/lib/jax/plugin_test.rb +0 -27
- data/spec/lib/jax/reloading_test.rb +0 -23
- data/spec/lib/jax/routes_test.rb +0 -28
- data/spec/lib/jax/shader_test.rb +0 -29
- data/spec/lib/jax/tasks/jax_rake_test.rb +0 -85
- data/spec/support/bases/generator_test_case.rb +0 -108
- data/spec/support/bases/isolated_test_case.rb +0 -148
- data/spec/support/file_exist_matcher.rb +0 -23
- data/spec/support/spec_shell.rb +0 -110
- data/spec/test_app.rb +0 -3
@@ -1,254 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext'
|
2
|
-
require 'rest_client'
|
3
|
-
require 'jax'
|
4
|
-
require 'archive/tar/minitar'
|
5
|
-
|
6
|
-
module Jax
|
7
|
-
module Generators
|
8
|
-
module Plugin
|
9
|
-
class PluginManager < Thor
|
10
|
-
include Thor::Actions
|
11
|
-
include Jax::Generators::Plugin
|
12
|
-
include Jax::Generators::Interactions
|
13
|
-
|
14
|
-
desc "install NAME [NAME2...]", "Installs the named plugin from the plugin repository"
|
15
|
-
long_desc "Searches for a plugin by the specified name and installs it. The " \
|
16
|
-
"search is case-insensitive. If an exact match (other than case) is " \
|
17
|
-
"found, the matching plugin will be installed. Otherwise, a list of " \
|
18
|
-
"potential matches will be shown, and you will be prompted with a " \
|
19
|
-
"selection."
|
20
|
-
method_option :version, :type => :string, :default => false, :aliases => '-v',
|
21
|
-
:desc => "The exact version to install. If not given, the latest will be used."
|
22
|
-
def install(name, *other_names)
|
23
|
-
catch(:complete) do
|
24
|
-
message = catch(:aborted) do
|
25
|
-
list = matching_plugins(name)
|
26
|
-
if list.empty?
|
27
|
-
raise "No plugin names match or begin with the text '#{name}'."
|
28
|
-
elsif list.length == 1
|
29
|
-
if list[0]['name'] != name
|
30
|
-
prompt_yn "Plugin '#{name}' was not found, but '#{list[0]['name']}' was. Install it instead?"
|
31
|
-
end
|
32
|
-
install_plugin list[0]
|
33
|
-
else
|
34
|
-
say "No plugin was found with the name '#{name}', but the following candidates were found:"
|
35
|
-
menu list.collect { |c| c['name'] } do |selected_name, selected_index|
|
36
|
-
install_plugin list[selected_index]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
throw :complete
|
40
|
-
end
|
41
|
-
say_status :aborted, message, :yellow
|
42
|
-
return # cancel any additional plugins if this one was aborted
|
43
|
-
end
|
44
|
-
|
45
|
-
install *other_names unless other_names.empty?
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "uninstall NAME", "Removes the named plugin from this application"
|
49
|
-
long_desc "Removes the plugin with the given name from this application."
|
50
|
-
def uninstall(name)
|
51
|
-
catch :complete do
|
52
|
-
message = catch :aborted do
|
53
|
-
plugin_path = Jax.root.join("vendor/plugins/#{name}")
|
54
|
-
if File.exist?(plugin_path.to_s)
|
55
|
-
uninstall_plugin name, plugin_path
|
56
|
-
else
|
57
|
-
# see if it's a partial name
|
58
|
-
matches = search installed_plugins, name
|
59
|
-
throw :aborted, "Plugin '#{name}' does not seem to be installed." if matches.empty?
|
60
|
-
|
61
|
-
if matches.length == 1 && match = matches.shift
|
62
|
-
prompt_yn "Plugin '#{name}' is not installed, but '#{match[0]}' was. Delete it instead?"
|
63
|
-
uninstall_plugin *match
|
64
|
-
else
|
65
|
-
say "Plugin '#{name}' is not installed, but the following partial matches are:"
|
66
|
-
menu matches.keys.sort, :allow_all => true do |name,index|
|
67
|
-
uninstall_plugin name, matches[name]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
throw :complete
|
73
|
-
end
|
74
|
-
|
75
|
-
say_status :aborted, message, :yellow
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
desc "push", "Pushes this plugin to the repository, making it available to other people"
|
80
|
-
long_desc "Releases the plugin to the plugin repository. If you do not have an " \
|
81
|
-
"account, you will be prompted to create one. The name of the plugin " \
|
82
|
-
"must be unique."
|
83
|
-
def push
|
84
|
-
if ENV['JAX_CWD'] && ENV['JAX_CWD'] =~ /^#{Regexp::escape Jax.root.join("vendor/plugins").to_s}\/?([^\/]+)(\/|$)/
|
85
|
-
plugin_name = $1
|
86
|
-
plugin_dir = Jax.root.join("vendor/plugins", plugin_name)
|
87
|
-
manifest = plugin_dir.join("manifest.yml").to_s
|
88
|
-
if File.exist? manifest
|
89
|
-
manifest = Jax::Plugin::Manifest.find(plugin_name)
|
90
|
-
if manifest.description.blank?
|
91
|
-
say "Please enter a plugin description in the manifest.yml file"
|
92
|
-
else
|
93
|
-
publish_plugin manifest
|
94
|
-
end
|
95
|
-
else
|
96
|
-
say "Plugin manifest is missing!"
|
97
|
-
say "A default manifest file will be written. Please modify "
|
98
|
-
say "this file before continuing."
|
99
|
-
say ""
|
100
|
-
Jax::Plugin::Manifest.new(plugin_name).save
|
101
|
-
say_status :created, "manifest.yml", :green
|
102
|
-
end
|
103
|
-
else
|
104
|
-
say_status :aborted, "Please run this script from within a plugin directory.", :red
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
desc "list [NAME]", "Lists all plugins, or searches for a plugin by the specified name"
|
109
|
-
long_desc "Lists all plugins, or searches for a plugin that starts with the specified name."
|
110
|
-
method_option :detailed, :type => :boolean, :default => false,
|
111
|
-
:desc => "Lists the plugins with detailed multiline descriptions."
|
112
|
-
method_option :local, :type => :boolean, :default => false,
|
113
|
-
:desc => "Lists only plugins that are currently installed."
|
114
|
-
def list(name = nil)
|
115
|
-
if options[:local] && matching_plugins(name).empty?
|
116
|
-
say_status :missing, "There do not seem to be any plugins installed for this application."
|
117
|
-
return
|
118
|
-
else
|
119
|
-
each_plugin(name) do |plugin|
|
120
|
-
name, description = plugin['name'], plugin['description']
|
121
|
-
|
122
|
-
if options[:detailed]
|
123
|
-
say name
|
124
|
-
say " #{description}"
|
125
|
-
say ""
|
126
|
-
else
|
127
|
-
if description.length > 60
|
128
|
-
description = description[0...57] + "..."
|
129
|
-
end
|
130
|
-
say "#{name.ljust 19} #{description}"
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
say ""
|
135
|
-
end
|
136
|
-
|
137
|
-
def self.source_root
|
138
|
-
File.expand_path("templates", File.dirname(__FILE__))
|
139
|
-
end
|
140
|
-
|
141
|
-
protected
|
142
|
-
def publish_plugin(manifest)
|
143
|
-
credentials = Jax::Generators::Plugin::Credentials.new
|
144
|
-
api_key = credentials.api_key
|
145
|
-
tmp = Jax.application.config.paths.tmp.to_a.first
|
146
|
-
|
147
|
-
file = File.join(tmp, "#{manifest.name}-#{manifest.version}.tgz")
|
148
|
-
FileUtils.mkdir_p File.dirname(file) unless File.directory?(File.dirname(file))
|
149
|
-
tar = Zlib::GzipWriter.new(File.open(file, "wb"))
|
150
|
-
Dir.chdir Jax.root.join("vendor/plugins", manifest.name).to_s do
|
151
|
-
Archive::Tar::Minitar.pack(".", tar) # closes tar
|
152
|
-
end
|
153
|
-
|
154
|
-
plugin = {
|
155
|
-
:single_access_token => api_key,
|
156
|
-
:plugin => {
|
157
|
-
:name => manifest.name,
|
158
|
-
:description => manifest.description,
|
159
|
-
:version => manifest.version,
|
160
|
-
:stream => File.new(file, "r")
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
begin
|
165
|
-
res = Hash.from_xml(credentials.plugins.post plugin).with_indifferent_access
|
166
|
-
if res && res[:hash] && !res[:hash][:error].blank?
|
167
|
-
say_status :error, res[:hash][:error], :red
|
168
|
-
else
|
169
|
-
say_status :done, "Plugin #{File.basename(file)} published", :green
|
170
|
-
end
|
171
|
-
rescue RestClient::RequestFailed
|
172
|
-
res = Hash.from_xml($!.http_body)
|
173
|
-
if error = res['hash'] && res['hash']['error']
|
174
|
-
say_status :error, error, :red
|
175
|
-
else
|
176
|
-
say_status :error, "A server-side error has occurred.", :red
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def uninstall_plugin(name, plugin_path)
|
182
|
-
run_uninstall_script plugin_path
|
183
|
-
FileUtils.rm_rf plugin_path
|
184
|
-
say_status :complete, "Plugin '#{name}' has been removed.", :green
|
185
|
-
end
|
186
|
-
|
187
|
-
def install_plugin(details)
|
188
|
-
name, version = details['name'], plugin_version(details)
|
189
|
-
plugin_dir = Jax.root.join("vendor/plugins/#{name}")
|
190
|
-
overwrite plugin_dir
|
191
|
-
|
192
|
-
Dir.mktmpdir do |tmp|
|
193
|
-
tarfile = download_tgz(name, version, tmp)
|
194
|
-
untar tarfile, plugin_dir
|
195
|
-
run_install_script plugin_dir
|
196
|
-
end
|
197
|
-
|
198
|
-
save_manifest plugin_dir, details unless File.exist?(File.join(plugin_dir, "manifest.yml"))
|
199
|
-
|
200
|
-
say_status :installed, "#{plugin_dir} -v=#{version}", :green
|
201
|
-
end
|
202
|
-
|
203
|
-
def save_manifest(plugin_dir, details)
|
204
|
-
# collect necessary details
|
205
|
-
details = details.inject({}) do |hash,(k,v)|
|
206
|
-
case k.to_s
|
207
|
-
when 'name', 'description', 'version' then hash[k.to_s] = v
|
208
|
-
when 'releases' then
|
209
|
-
version = v.last['version']
|
210
|
-
hash['version'] = version if hash['version'].blank? || hash['version'] < version
|
211
|
-
end
|
212
|
-
hash
|
213
|
-
end
|
214
|
-
|
215
|
-
File.open(File.join(plugin_dir, "manifest.yml"), "w") do |f|
|
216
|
-
f.print details.to_yaml
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
def run_uninstall_script(plugin_dir)
|
221
|
-
run_script plugin_dir, "uninstall.rb"
|
222
|
-
end
|
223
|
-
|
224
|
-
def run_script(plugin_dir, script_filename)
|
225
|
-
script = File.join(plugin_dir, script_filename)
|
226
|
-
load script if File.exist? script
|
227
|
-
end
|
228
|
-
|
229
|
-
def run_install_script(plugin_dir)
|
230
|
-
run_script plugin_dir, "install.rb"
|
231
|
-
end
|
232
|
-
|
233
|
-
def untar(tarfile, destination)
|
234
|
-
tgz = Zlib::GzipReader.new(File.open(tarfile, "rb"))
|
235
|
-
Archive::Tar::Minitar.unpack(tgz, destination.to_s) # closes tgz
|
236
|
-
end
|
237
|
-
|
238
|
-
def download_tgz(name, version, destdir)
|
239
|
-
filename = "#{name}-#{version}.tgz"
|
240
|
-
tgz = rest_resource("plugins/#{name}.tgz").get(:params => { :version => version })
|
241
|
-
tarfile = File.join destdir, filename
|
242
|
-
File.open(tarfile, "wb") { |f| f.print tgz }
|
243
|
-
tarfile
|
244
|
-
end
|
245
|
-
|
246
|
-
class << self
|
247
|
-
def basename
|
248
|
-
"jax plugin"
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
File without changes
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
if ARGV.include? '-v' or ARGV.include? '--version'
|
4
|
-
require 'thor'
|
5
|
-
require File.expand_path("../version", File.dirname(__FILE__))
|
6
|
-
|
7
|
-
class VersionGenerator < Thor
|
8
|
-
map "--version" => :version, "-v" => :version
|
9
|
-
desc "--version, -v", "display the Jax version number"
|
10
|
-
def version
|
11
|
-
say "Jax v#{Jax::VERSION}"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
VersionGenerator.start(['--version'])
|
15
|
-
exit
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
module Jax
|
20
|
-
module Generators
|
21
|
-
# Shamelessly lifted from Ruby on Rails
|
22
|
-
module ScriptJaxLoader
|
23
|
-
RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
|
24
|
-
SCRIPT_JAX = File.join('script', 'jax')
|
25
|
-
|
26
|
-
def self.exec_script_jax!
|
27
|
-
cwd = Dir.pwd
|
28
|
-
ENV['JAX_CWD'] ||= cwd
|
29
|
-
return unless in_jax_application? || in_jax_application_subdirectory?
|
30
|
-
exec RUBY, SCRIPT_JAX, *ARGV if in_jax_application?
|
31
|
-
Dir.chdir("..") do
|
32
|
-
# Recurse in a chdir block: if the search fails we want to be sure
|
33
|
-
# the application is generated in the original working directory.
|
34
|
-
exec_script_jax! unless cwd == Dir.pwd
|
35
|
-
end
|
36
|
-
rescue SystemCallError
|
37
|
-
# could not chdir, no problem just return
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.in_jax_application?
|
41
|
-
File.exists?(SCRIPT_JAX)
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.in_jax_application_subdirectory?(path = Pathname.new(Dir.pwd))
|
45
|
-
File.exists?(File.join(path, SCRIPT_JAX)) || !path.root? && in_jax_application_subdirectory?(path.parent)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext'
|
2
|
-
|
3
|
-
module Jax
|
4
|
-
module Generators
|
5
|
-
module Shader
|
6
|
-
class ShaderGenerator < Jax::Generators::PluggableCommand
|
7
|
-
argument :name, :desc => "The name of this shader", :banner => "[name]"
|
8
|
-
|
9
|
-
def self.source_root
|
10
|
-
File.expand_path("templates", File.dirname(__FILE__))
|
11
|
-
end
|
12
|
-
|
13
|
-
def check_conflicts
|
14
|
-
if Jax.application.shaders.find(file_name) && behavior != :revoke
|
15
|
-
raise ArgumentError, "A shader called '#{file_name}' already exists!"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def common
|
20
|
-
template_to 'common.ejs'
|
21
|
-
end
|
22
|
-
|
23
|
-
def fragment
|
24
|
-
template_to 'fragment.ejs'
|
25
|
-
end
|
26
|
-
|
27
|
-
def manifest
|
28
|
-
template_to 'manifest.yml'
|
29
|
-
end
|
30
|
-
|
31
|
-
def material
|
32
|
-
template_to 'material.js'
|
33
|
-
end
|
34
|
-
|
35
|
-
def vertex
|
36
|
-
template_to 'vertex.ejs'
|
37
|
-
end
|
38
|
-
|
39
|
-
def spec
|
40
|
-
template "spec.js.tt", File.join("spec/javascripts/shaders", "#{file_name}_spec.js")
|
41
|
-
end
|
42
|
-
|
43
|
-
protected
|
44
|
-
def template_to(basename)
|
45
|
-
template "#{basename}.tt", path_to(basename)
|
46
|
-
end
|
47
|
-
|
48
|
-
def path_to(basename)
|
49
|
-
File.join("app/shaders", file_name, basename)
|
50
|
-
end
|
51
|
-
|
52
|
-
def banner
|
53
|
-
"jax generate shader #{self.arguments.map { |a| a.usage }.join(' ')}"
|
54
|
-
end
|
55
|
-
|
56
|
-
def file_name
|
57
|
-
name.underscore
|
58
|
-
end
|
59
|
-
|
60
|
-
def class_name
|
61
|
-
name.camelize
|
62
|
-
end
|
63
|
-
|
64
|
-
def plural_name
|
65
|
-
name.pluralize
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
class Config
|
3
|
-
def plugin_and_app_files(src_files)
|
4
|
-
src_files.collect do |src_file|
|
5
|
-
Jax.application.plugins.inject([]) { |ary, plugin|
|
6
|
-
ary + [File.join(plugin.relative_path, src_file)]
|
7
|
-
} + [src_file]
|
8
|
-
end.flatten
|
9
|
-
end
|
10
|
-
|
11
|
-
# overridden so that we can map source files separately from /public
|
12
|
-
def src_files
|
13
|
-
if simple_config['src_files']
|
14
|
-
match_files(src_dir, plugin_and_app_files(simple_config['src_files'])).collect do |f|
|
15
|
-
File.join("__src__", f)
|
16
|
-
end.uniq
|
17
|
-
else
|
18
|
-
[]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def helpers
|
23
|
-
helpers = simple_config['helpers'] || ['helpers/**/*.js']
|
24
|
-
helpers.collect! { |s| File.expand_path(s, spec_dir).gsub(/^#{Regexp::escape Jax.root.to_s}\/?/, '') }
|
25
|
-
|
26
|
-
match_files(project_root, plugin_and_app_files(helpers)).uniq
|
27
|
-
end
|
28
|
-
|
29
|
-
def spec_files
|
30
|
-
spec_files = simple_config['spec_files'] || ['**/*[sS]pec.js']
|
31
|
-
spec_files.collect! { |s| File.expand_path(s, spec_dir).gsub(/^#{Regexp::escape Jax.root.to_s}\/?/, '') }
|
32
|
-
|
33
|
-
match_files(project_root, plugin_and_app_files(spec_files)).uniq
|
34
|
-
end
|
35
|
-
|
36
|
-
# new, used by overridden 'server.rb' so that we can map /public to root
|
37
|
-
def root_dir
|
38
|
-
if simple_config['root_dir']
|
39
|
-
File.join project_root, simple_config['root_dir']
|
40
|
-
else
|
41
|
-
project_root
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module Jasmine
|
2
|
-
class RunAdapter
|
3
|
-
alias _run run
|
4
|
-
# overridden method so that we can use a custom html file
|
5
|
-
#noinspection RubyUnusedLocalVariable
|
6
|
-
def run(focused_suite = nil)
|
7
|
-
# regenerate volatile files
|
8
|
-
Rake::Task['compile'].execute if $JAX_DEVELOPMENT # rebuild jax itself if we're in gem development
|
9
|
-
Rake::Task['jax:generate_files'].execute if !$JAX_RAKE # rebuild the project resources, routes, etc
|
10
|
-
|
11
|
-
custom_file = Jax.root && Jax.root.join("spec/javascripts/support/spec_layout.html.erb")
|
12
|
-
return _run(focused_suite) if !custom_file || !File.file?(custom_file)
|
13
|
-
|
14
|
-
jasmine_files = @jasmine_files
|
15
|
-
css_files = @jasmine_stylesheets + (@config.css_files || [])
|
16
|
-
js_files = @config.js_files(focused_suite)
|
17
|
-
body = ERB.new(File.read(custom_file)).result(binding)
|
18
|
-
[
|
19
|
-
200,
|
20
|
-
{ 'Content-Type' => 'text/html' },
|
21
|
-
[body]
|
22
|
-
]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# overridden so that we can map source files separately from /public
|
27
|
-
def self.app(config)
|
28
|
-
Rack::Builder.app do
|
29
|
-
use Rack::Head
|
30
|
-
|
31
|
-
map("/run.html") { run Jasmine::Redirect.new('/') }
|
32
|
-
map("/__suite__") { run Jasmine::FocusedSuite.new(config) }
|
33
|
-
|
34
|
-
map("/__JASMINE_ROOT__") { run Rack::File.new(Jasmine.root) }
|
35
|
-
map(config.spec_path) { run Rack::File.new(config.project_root) }
|
36
|
-
map(config.root_path) { run Rack::File.new(config.project_root) }
|
37
|
-
|
38
|
-
map '/' do
|
39
|
-
run Rack::Cascade.new([
|
40
|
-
Rack::URLMap.new(
|
41
|
-
'/' => Rack::File.new(config.root_dir),
|
42
|
-
'/__src__' => Rack::File.new(config.src_dir)
|
43
|
-
),
|
44
|
-
|
45
|
-
Jasmine::RunAdapter.new(config)
|
46
|
-
])
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
class Jax::Packager::SprocketsTemplate < Sprockets::SourceFile
|
2
|
-
def initialize(environment)
|
3
|
-
pathname = environment.pathname_from(File.join(Jax.root, "template.js"))
|
4
|
-
super(environment, pathname)
|
5
|
-
end
|
6
|
-
|
7
|
-
def template
|
8
|
-
added_files.clear
|
9
|
-
@template ||= begin
|
10
|
-
template = [
|
11
|
-
'Jax.environment = Jax.PRODUCTION;',
|
12
|
-
'',
|
13
|
-
asset_paths,
|
14
|
-
''
|
15
|
-
].flatten
|
16
|
-
|
17
|
-
Jax.application.javascript_sources.each { |jsfi| try_to_add_file(template, jsfi) }
|
18
|
-
|
19
|
-
template
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def try_to_add_file(template, jsfi)
|
24
|
-
if File.file?(jsfi) && !already_added?(jsfi)
|
25
|
-
add_file(template, jsfi)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def add_file(template, jsfi)
|
30
|
-
relative_path = jsfi.sub(/^#{Regexp::escape Jax.root.to_s}[\/\\]?/, '')
|
31
|
-
template << "//= require <#{relative_path}>"
|
32
|
-
added_files << jsfi
|
33
|
-
end
|
34
|
-
|
35
|
-
def already_added?(jsfi)
|
36
|
-
added_files.include?(jsfi)
|
37
|
-
end
|
38
|
-
|
39
|
-
def added_files
|
40
|
-
@added_files ||= []
|
41
|
-
end
|
42
|
-
|
43
|
-
def asset_paths
|
44
|
-
Jax.application.asset_paths.collect do |path|
|
45
|
-
if File.directory?(path)
|
46
|
-
"//= provide \"#{File.join(path, "").gsub(/^#{Regexp::escape Jax.root.to_s}\/?/, '')}\""
|
47
|
-
end
|
48
|
-
end.reject do |result|
|
49
|
-
result.nil?
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def source_lines
|
54
|
-
# basically the same as super but with a string instead of a file
|
55
|
-
# TODO would templating be a worthy addition to Sprockets itself?
|
56
|
-
@lines ||= begin
|
57
|
-
lines = []
|
58
|
-
comments = []
|
59
|
-
|
60
|
-
template.each_with_index do |line, lineno|
|
61
|
-
lines << line = Sprockets::SourceLine.new(self, line, lineno+1)
|
62
|
-
if line.begins_pdoc_comment? || comments.any?
|
63
|
-
comments << line
|
64
|
-
end
|
65
|
-
|
66
|
-
if line.ends_multiline_comment?
|
67
|
-
if line.ends_pdoc_comment?
|
68
|
-
comments.each { |l| l.comment! }
|
69
|
-
end
|
70
|
-
comments.clear
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
lines
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
data/lib/jax/packager.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'sprockets'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
class Jax::Packager
|
5
|
-
include FileUtils
|
6
|
-
attr_reader :pkg_path, :path, :project
|
7
|
-
autoload :SprocketsTemplate, File.join(File.dirname(__FILE__), "packager/sprockets_template")
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def invoke
|
11
|
-
puts "DEPRECATED"
|
12
|
-
puts
|
13
|
-
puts "Please invoke the Jax packager with the following command:"
|
14
|
-
puts
|
15
|
-
puts " jax package"
|
16
|
-
puts
|
17
|
-
puts "This notice will be removed sometime around Jax v1.2."
|
18
|
-
puts
|
19
|
-
puts
|
20
|
-
|
21
|
-
Jax::Generators::Packager::PackageGenerator.start([])
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def build!
|
26
|
-
@secretary.preprocessor.require(project)
|
27
|
-
|
28
|
-
mkdir_p File.dirname(@path)
|
29
|
-
@secretary.concatenation.save_to @path
|
30
|
-
|
31
|
-
file = File.open(@path, "a")
|
32
|
-
Jax.application.shaders.each { |shader| shader.save_to file }
|
33
|
-
Jax::ResourceCompiler.new.save(file)
|
34
|
-
Jax.application.routes.compile(file)
|
35
|
-
|
36
|
-
file.close
|
37
|
-
|
38
|
-
@secretary.install_assets
|
39
|
-
end
|
40
|
-
|
41
|
-
def initialize(pkg_path)
|
42
|
-
@pkg_path = pkg_path
|
43
|
-
@manifest = []
|
44
|
-
|
45
|
-
@path = File.join(@pkg_path, "javascripts/#{Jax.application.class.name.underscore}.js")
|
46
|
-
@secretary = Sprockets::Secretary.new(
|
47
|
-
:root => Jax.root,
|
48
|
-
:asset_root => @pkg_path.to_s,
|
49
|
-
:load_path => Jax.application.javascript_load_paths,
|
50
|
-
:source_files => []
|
51
|
-
)
|
52
|
-
@project = Jax::Packager::SprocketsTemplate.new(@secretary.environment)
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
def localized_path(fi)
|
57
|
-
fi.gsub(/^#{Regexp::escape Jax.root.to_s}[\/\\]?/, '')
|
58
|
-
end
|
59
|
-
end
|
data/lib/jax/plugin/manifest.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'active_support/hash_with_indifferent_access'
|
2
|
-
|
3
|
-
class Jax::Plugin::Manifest < ActiveSupport::HashWithIndifferentAccess
|
4
|
-
class << self
|
5
|
-
def find(name)
|
6
|
-
man = new name
|
7
|
-
man.load
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def initialize(plugin_name)
|
12
|
-
super()
|
13
|
-
self[:name] = plugin_name
|
14
|
-
defaults
|
15
|
-
end
|
16
|
-
|
17
|
-
def name
|
18
|
-
self[:name]
|
19
|
-
end
|
20
|
-
|
21
|
-
def name=(n)
|
22
|
-
self[:name] = n
|
23
|
-
end
|
24
|
-
|
25
|
-
def version
|
26
|
-
self[:version]
|
27
|
-
end
|
28
|
-
|
29
|
-
def version=(n)
|
30
|
-
self[:version] = n
|
31
|
-
end
|
32
|
-
|
33
|
-
def description
|
34
|
-
self[:description]
|
35
|
-
end
|
36
|
-
|
37
|
-
def description=(n)
|
38
|
-
self[:description] = n
|
39
|
-
end
|
40
|
-
|
41
|
-
def load
|
42
|
-
load_from path
|
43
|
-
end
|
44
|
-
|
45
|
-
def load_from(path)
|
46
|
-
yml = YAML::load(File.read(path))
|
47
|
-
yml.each do |key, value|
|
48
|
-
self[key] = value
|
49
|
-
end
|
50
|
-
self
|
51
|
-
end
|
52
|
-
|
53
|
-
def save
|
54
|
-
save_to path
|
55
|
-
end
|
56
|
-
|
57
|
-
def save_to(path)
|
58
|
-
File.open(path, "w") { |f| f.print to_yaml }
|
59
|
-
self
|
60
|
-
end
|
61
|
-
|
62
|
-
def path
|
63
|
-
File.join(Jax.root, "vendor/plugins", name, "manifest.yml")
|
64
|
-
end
|
65
|
-
|
66
|
-
def defaults
|
67
|
-
self[:description] ||= ""
|
68
|
-
self[:version] ||= "0.0.1"
|
69
|
-
self
|
70
|
-
end
|
71
|
-
end
|