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
data/{builtin/app/shaders/picking/common.ejs → lib/assets/javascripts/shaders/picking/common.glsl}
RENAMED
File without changes
|
File without changes
|
@@ -3,12 +3,10 @@ Jax.Material.Picking = Jax.Class.create(Jax.Material, {
|
|
3
3
|
$super({shader:"picking"});
|
4
4
|
},
|
5
5
|
|
6
|
-
|
7
|
-
$super(context, mesh, options, uniforms);
|
8
|
-
|
6
|
+
setVariables: function(context, mesh, options, vars) {
|
9
7
|
model_index = options.model_index;
|
10
8
|
if (model_index == undefined) model_index = -1;
|
11
9
|
|
12
|
-
|
10
|
+
vars.set('INDEX', model_index);
|
13
11
|
}
|
14
12
|
});
|
data/{builtin/app/shaders/picking/vertex.ejs → lib/assets/javascripts/shaders/picking/vertex.glsl}
RENAMED
File without changes
|
File without changes
|
@@ -3,10 +3,8 @@ Jax.Material.ShadowMap = Jax.Class.create(Jax.Material, {
|
|
3
3
|
$super({shader:"shadow_map"});
|
4
4
|
},
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
uniforms.set({
|
6
|
+
setVariables: function(context, mesh, options, vars) {
|
7
|
+
vars.set({
|
10
8
|
DP_SHADOW_NEAR: 0.1, //c.world.lighting.getLight().getDPShadowNear() || 0.1;}},
|
11
9
|
DP_SHADOW_FAR: 500,//c.world.lighting.getLight().getDPShadowFar() || 500;}},
|
12
10
|
|
@@ -20,7 +18,7 @@ Jax.Material.ShadowMap = Jax.Class.create(Jax.Material, {
|
|
20
18
|
front = light.getShadowMapTextures(context)[0];
|
21
19
|
back = light.getShadowMapTextures(context)[1];
|
22
20
|
|
23
|
-
if (front)
|
24
|
-
if (back)
|
21
|
+
if (front) vars.texture('SHADOWMAP0', front, context);
|
22
|
+
if (back) vars.texture('SHADOWMAP1', back, context);
|
25
23
|
}
|
26
24
|
});
|
File without changes
|
data/{builtin/app/shaders/texture/common.ejs → lib/assets/javascripts/shaders/texture/common.glsl}
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Jax.Material.Texture = Jax.Class.create(Jax.Material, {
|
2
|
+
initialize: function($super, texture) {
|
3
|
+
this.texture = Jax.Material.Texture.normalizeTexture(texture);
|
4
|
+
$super({shader:"texture"});
|
5
|
+
},
|
6
|
+
|
7
|
+
setVariables: function(context, mesh, options, vars) {
|
8
|
+
vars.texture('Texture', this.texture, context);
|
9
|
+
vars.set('TextureScaleX', this.texture.options.scale_x || this.texture.options.scale || 1);
|
10
|
+
vars.set('TextureScaleY', this.texture.options.scale_y || this.texture.options.scale || 1);
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
Jax.Material.Texture.normalizeTexture = function(tex) {
|
15
|
+
if (tex.isKindOf && tex.isKindOf(Jax.Texture)) return tex;
|
16
|
+
return new Jax.Texture(tex);
|
17
|
+
};
|
data/{builtin/app/shaders/texture/vertex.ejs → lib/assets/javascripts/shaders/texture/vertex.glsl}
RENAMED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# this is required to make the specs pass on Ruby 1.8. No idea why!!!
|
2
|
+
module Jax
|
3
|
+
module Generators
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'active_support/core_ext'
|
8
|
+
require 'rails/generators'
|
9
|
+
require File.expand_path("base/source_root", File.dirname(__FILE__))
|
10
|
+
require File.expand_path("base/coffee_generator", File.dirname(__FILE__))
|
11
|
+
require File.expand_path("base/named_base", File.dirname(__FILE__))
|
12
|
+
require File.expand_path("base/rails_base", File.dirname(__FILE__))
|
13
|
+
require File.expand_path("base/plugin_base", File.dirname(__FILE__))
|
14
|
+
require File.expand_path("base/actions", File.dirname(__FILE__))
|
15
|
+
|
16
|
+
Dir[File.expand_path("*/*.rb", File.dirname(__FILE__))].each { |generator| require generator }
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'jax/version'
|
2
|
+
require File.expand_path("../all", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
module Jax
|
5
|
+
module Generators
|
6
|
+
class ApplicationGenerator < Jax::Generators::NamedBase
|
7
|
+
class_option :skip_bundle, :type => :boolean, :default => false, :desc => "Don't run bundle install"
|
8
|
+
|
9
|
+
def generate_application
|
10
|
+
directory "app", file_name
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_jax_application_controller
|
14
|
+
coffee_template_with_fallback "application_controller.js",
|
15
|
+
File.join(file_name, 'app/assets/jax/controllers/application_controller.js')
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_jax_application_helper
|
19
|
+
coffee_template_with_fallback "application_helper.js",
|
20
|
+
File.join(file_name, 'app/assets/jax/helpers/application_helper.js')
|
21
|
+
end
|
22
|
+
|
23
|
+
def run_bundle
|
24
|
+
inside file_name do
|
25
|
+
bundle_command('install') unless options[:skip_bundle]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
# this comes from Rails.
|
31
|
+
def bundle_command(command)
|
32
|
+
say_status :run, "bundle #{command}"
|
33
|
+
|
34
|
+
# We are going to shell out rather than invoking Bundler::CLI.new(command)
|
35
|
+
# because `rails new` loads the Thor gem and on the other hand bundler uses
|
36
|
+
# its own vendored Thor, which could be a different version. Running both
|
37
|
+
# things in the same process is a recipe for a night with paracetamol.
|
38
|
+
#
|
39
|
+
# We use backticks and #print here instead of vanilla #system because it
|
40
|
+
# is easier to silence stdout in the existing test suite this way. The
|
41
|
+
# end-user gets the bundler commands called anyway, so no big deal.
|
42
|
+
#
|
43
|
+
# Thanks to James Tucker for the Gem tricks involved in this call.
|
44
|
+
print `"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" #{command}`
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Jax::Generators::Actions
|
2
|
+
def prompt_yn(message, options = {})
|
3
|
+
yn = ask(message).downcase[0]
|
4
|
+
throw :aborted, "Aborted by user." if yn != ?y
|
5
|
+
end
|
6
|
+
|
7
|
+
def menu(items, options = {})
|
8
|
+
min = 1
|
9
|
+
if options[:allow_all]
|
10
|
+
say_option 0, "All candidates"
|
11
|
+
min = 0
|
12
|
+
end
|
13
|
+
|
14
|
+
items.each_with_index do |item, index|
|
15
|
+
say_option index+1, item
|
16
|
+
end
|
17
|
+
which = menu_choice(:min => min, :max => items.length)
|
18
|
+
|
19
|
+
if which == -1
|
20
|
+
items.each_with_index { |item, index| yield item, index }
|
21
|
+
else
|
22
|
+
yield items[which], which
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def menu_choice(*args)
|
27
|
+
options = args.extract_options!
|
28
|
+
caption, addl_caption = *args
|
29
|
+
caption = "Please select an option, or press ctrl+c to cancel >" unless caption
|
30
|
+
|
31
|
+
which = ask("#{addl_caption}#{caption}")
|
32
|
+
sel = which.to_i
|
33
|
+
# if sel.to_s != which then which is non-numeric
|
34
|
+
if sel.to_s != which || options[:min] && sel < options[:min] || options[:max] && sel > options[:max]
|
35
|
+
menu_choice(caption, "Invalid choice. ")
|
36
|
+
else
|
37
|
+
sel - 1
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def say_option(which, caption)
|
42
|
+
say "\t#{which}\t: #{caption}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def overwrite(path)
|
46
|
+
path = path.to_s
|
47
|
+
if File.exist? path
|
48
|
+
prompt_yn "Path '#{path}' already exists! Delete it?"
|
49
|
+
FileUtils.rm_rf path
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jax
|
2
|
+
module Generators
|
3
|
+
module CoffeeGenerator
|
4
|
+
unless defined?(COFFEESCRIPT_AVAILABLE)
|
5
|
+
begin
|
6
|
+
require 'coffee-script'
|
7
|
+
COFFEESCRIPT_AVAILABLE = true
|
8
|
+
rescue LoadError
|
9
|
+
COFFEESCRIPT_AVAILABLE = false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.included(base)
|
14
|
+
base.class_eval do
|
15
|
+
class_option :without_coffeescript, :type => :boolean, :aliases => "-j", :default => false,
|
16
|
+
:desc => "Indicates whether to generate pure JavaScript instead of CoffeeScript"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
def coffee_template_with_fallback(src, dest)
|
22
|
+
if COFFEESCRIPT_AVAILABLE && !options['without_coffeescript']
|
23
|
+
template "#{src}.coffee.erb", "#{dest}.coffee"
|
24
|
+
else
|
25
|
+
template "#{src}.erb", dest
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Jax
|
2
|
+
module Generators
|
3
|
+
class NamedBase < ::Rails::Generators::NamedBase
|
4
|
+
class Error < Thor::Error
|
5
|
+
end
|
6
|
+
|
7
|
+
no_tasks do
|
8
|
+
def exit(message = "")
|
9
|
+
raise Jax::Generators::NamedBase::Error, message
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
extend Jax::Generators::SourceRoot
|
14
|
+
include Jax::Generators::CoffeeGenerator
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require File.expand_path("plugin_manifest", File.dirname(__FILE__))
|
2
|
+
require File.expand_path("plugin_credentials", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
module Jax::Generators::PluginBase
|
5
|
+
class ResponseError < StandardError
|
6
|
+
def initialize(message)
|
7
|
+
super("#{message} Make sure your firewall isn't injecting invalid responses.")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def rest_resource(name, accept = :xml)
|
12
|
+
url = Jax.config.plugin_repository_url
|
13
|
+
url.concat "/" unless url =~ /\/$/
|
14
|
+
url.concat name
|
15
|
+
RestClient::Resource.new(url, :accept => accept)
|
16
|
+
end
|
17
|
+
|
18
|
+
def search_query_rx(query)
|
19
|
+
/^#{Regexp::escape query}/i
|
20
|
+
end
|
21
|
+
|
22
|
+
def search(plugin_list, query)
|
23
|
+
plugin_list.select { |plugin, path_to_plugin|
|
24
|
+
!query || plugin =~ search_query_rx(query)
|
25
|
+
}.inject({}) do |hash, (plugin, path_to_plugin)|
|
26
|
+
hash[plugin] = path_to_plugin
|
27
|
+
hash
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def installed_plugins
|
32
|
+
plugins = []
|
33
|
+
Dir.glob(::Rails.application.root.join("vendor/plugins/*").to_s).each do |path|
|
34
|
+
if File.directory? path
|
35
|
+
plugins.push [File.basename(path), Pathname.new(path)]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
plugins.sort { |a, b| a[0] <=> b[0] }
|
39
|
+
end
|
40
|
+
|
41
|
+
def load_or_infer_manifest(name, plugin_dir)
|
42
|
+
if File.file?(manifest_path = File.join(plugin_dir, "manifest.yml"))
|
43
|
+
YAML::load(File.read(manifest_path)) || { 'name' => name, 'description' => '(Description unavailable)' }
|
44
|
+
else
|
45
|
+
{ 'name' => name, 'description' => '(Manifest file not found!)' }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def installed_plugin_manifests(filter_name = nil)
|
50
|
+
{ 'jax_plugins' => search(installed_plugins, filter_name).collect do |name, path|
|
51
|
+
load_or_infer_manifest(name, path)
|
52
|
+
end
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def matching_plugins(name = nil)
|
57
|
+
if options[:local]
|
58
|
+
hash = installed_plugin_manifests(name)
|
59
|
+
else
|
60
|
+
hash = get_remote_plugins_matching name
|
61
|
+
end
|
62
|
+
|
63
|
+
find_plugin_list(hash)
|
64
|
+
end
|
65
|
+
|
66
|
+
def find_plugin_list(hash_containing_plugin_list)
|
67
|
+
hash_containing_plugin_list['jax_plugins'] ||
|
68
|
+
hash_containing_plugin_list['nil_classes'] ||
|
69
|
+
raise(ResponseError.new("Fatal: couldn't find plugin list."))
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_remote_plugins_matching(name = nil)
|
73
|
+
plugins = rest_resource("plugins")
|
74
|
+
if name
|
75
|
+
extract_hash_from_response plugins['search'][name].get
|
76
|
+
else
|
77
|
+
extract_hash_from_response plugins.get
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def each_plugin(name = nil, &block)
|
82
|
+
matching_plugins(name).each &block
|
83
|
+
end
|
84
|
+
|
85
|
+
def plugin_version(details)
|
86
|
+
if options['version']
|
87
|
+
for release in details['releases']
|
88
|
+
if release['version'] && release['version'] == options['version']
|
89
|
+
return options['version']
|
90
|
+
end
|
91
|
+
end
|
92
|
+
raise "Release information for version #{options['version']} not found for plugin '#{details['name']}'!"
|
93
|
+
else
|
94
|
+
if release = details['releases'].last and release['version']
|
95
|
+
return release['version']
|
96
|
+
end
|
97
|
+
raise "Release information not found for plugin '#{details['name']}'!"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def extract_hash_from_response(response)
|
102
|
+
begin
|
103
|
+
hash = Hash.from_xml(response)
|
104
|
+
rescue
|
105
|
+
raise ResponseError.new("Fatal: response couldn't be parsed. (Maybe it wasn't valid XML?)")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
module Jax::Plugin
|
4
|
+
class Credentials
|
5
|
+
attr_reader :home, :shell
|
6
|
+
|
7
|
+
def api_key
|
8
|
+
@api_key ||= find_api_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@shell = options[:shell] || Thor::Shell::Basic.new
|
13
|
+
@home = home_path(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def config_file
|
17
|
+
File.join(home, ".jax")
|
18
|
+
end
|
19
|
+
|
20
|
+
def home_path(options = {})
|
21
|
+
File.expand_path(options[:home] || Thor::Util.user_home)
|
22
|
+
end
|
23
|
+
|
24
|
+
def plugins
|
25
|
+
@plugins ||= RestClient::Resource.new(File.join(Jax.config.plugin_repository_url, "plugins"), :accept => :xml)
|
26
|
+
end
|
27
|
+
|
28
|
+
def authors
|
29
|
+
@authors ||= RestClient::Resource.new(File.join(Jax.config.plugin_repository_url, "authors"), :accept => :xml)
|
30
|
+
end
|
31
|
+
|
32
|
+
def profile
|
33
|
+
@profile ||= RestClient::Resource.new(File.join(Jax.config.plugin_repository_url, "profile"), :accept => :xml)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def login
|
38
|
+
profile.options[:user] = email
|
39
|
+
profile.options[:password] = password
|
40
|
+
|
41
|
+
begin
|
42
|
+
Hash.from_xml(profile.get).with_indifferent_access
|
43
|
+
rescue RestClient::RequestFailed => err # login doesn't exist
|
44
|
+
message = Hash.from_xml($!.http_body)
|
45
|
+
if message && (message = message['hash']) && (message = message['error']) && (message =~ /Login not found/i)
|
46
|
+
create_account
|
47
|
+
else
|
48
|
+
raise err
|
49
|
+
end
|
50
|
+
rescue RestClient::Unauthorized # bad password
|
51
|
+
raise "Invalid password."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def email
|
56
|
+
@email ||= begin
|
57
|
+
shell.ask "Please enter your email address: "
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def password
|
62
|
+
@password ||= begin
|
63
|
+
shell.ask "Please enter your password: "
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def create_account
|
68
|
+
confirmation = shell.ask "Please confirm your password: "
|
69
|
+
raise "Password and confirmation don't match" if confirmation != password
|
70
|
+
|
71
|
+
login = email && email[/\@/] ? email[0...$~.offset(0)[0]] : email
|
72
|
+
Hash.from_xml(profile.post(:author => {
|
73
|
+
:login => login, :password => password, :password_confirmation => confirmation, :email => email
|
74
|
+
})).with_indifferent_access
|
75
|
+
rescue RestClient::RequestFailed
|
76
|
+
raise Hash.from_xml($!.http_body)['hash']['error']
|
77
|
+
end
|
78
|
+
|
79
|
+
def save_api_key
|
80
|
+
key = login[:author][:single_access_token]
|
81
|
+
yml = { :api_key => key }
|
82
|
+
File.open(config_file, "w") { |f| f.print yml.to_yaml }
|
83
|
+
key
|
84
|
+
end
|
85
|
+
|
86
|
+
def find_api_key
|
87
|
+
if File.file?(config_file)
|
88
|
+
yml = (YAML::load(File.read(config_file)) || {}).with_indifferent_access
|
89
|
+
if yml[:api_key]
|
90
|
+
yml[:api_key]
|
91
|
+
else
|
92
|
+
save_api_key
|
93
|
+
end
|
94
|
+
else
|
95
|
+
save_api_key
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'active_support/hash_with_indifferent_access'
|
2
|
+
|
3
|
+
module Jax::Plugin
|
4
|
+
class Manifest < ActiveSupport::HashWithIndifferentAccess
|
5
|
+
class << self
|
6
|
+
def find(name)
|
7
|
+
man = new name
|
8
|
+
man.load
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(plugin_name = "")
|
13
|
+
super()
|
14
|
+
self[:name] = plugin_name
|
15
|
+
defaults
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
self[:name]
|
20
|
+
end
|
21
|
+
|
22
|
+
def name=(n)
|
23
|
+
self[:name] = n
|
24
|
+
end
|
25
|
+
|
26
|
+
def version
|
27
|
+
self[:version]
|
28
|
+
end
|
29
|
+
|
30
|
+
def version=(n)
|
31
|
+
self[:version] = n
|
32
|
+
end
|
33
|
+
|
34
|
+
def description
|
35
|
+
self[:description]
|
36
|
+
end
|
37
|
+
|
38
|
+
def description=(n)
|
39
|
+
self[:description] = n
|
40
|
+
end
|
41
|
+
|
42
|
+
def load
|
43
|
+
load_from path
|
44
|
+
end
|
45
|
+
|
46
|
+
def load_from(path)
|
47
|
+
yml = YAML::load(File.read(path))
|
48
|
+
yml.each do |key, value|
|
49
|
+
self[key] = value
|
50
|
+
end
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def save
|
55
|
+
save_to path
|
56
|
+
end
|
57
|
+
|
58
|
+
def save_to(path)
|
59
|
+
base = File.dirname(path)
|
60
|
+
FileUtils.mkdir_p(base) unless File.directory?(base)
|
61
|
+
File.open(path, "w") { |f| f.print to_yaml }
|
62
|
+
self
|
63
|
+
end
|
64
|
+
|
65
|
+
def path
|
66
|
+
File.join(::Rails.application.root, "vendor/plugins", name, "manifest.yml")
|
67
|
+
end
|
68
|
+
|
69
|
+
def defaults
|
70
|
+
self[:description] ||= ""
|
71
|
+
self[:version] ||= "0.0.1"
|
72
|
+
self
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jax
|
2
|
+
module Generators
|
3
|
+
class RailsBase < Jax::Generators::NamedBase
|
4
|
+
no_tasks do
|
5
|
+
class_attribute :rails_equivalent_block
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.rails_equivalent(&block)
|
9
|
+
self.rails_equivalent_block = block
|
10
|
+
end
|
11
|
+
|
12
|
+
class_option :rails, :type => :boolean, :aliases => '-r', :default => false,
|
13
|
+
:desc => "If true, the equivalent Rails generator will be invoked also."
|
14
|
+
|
15
|
+
def initialize(args = [], options = {}, config = {})
|
16
|
+
super
|
17
|
+
if self.options[:rails] && equiv = rails_equivalent
|
18
|
+
args << "--skip-namespace" # otherwise everything ends up in jax/, the opposite of what we want
|
19
|
+
::Rails::Generators.invoke(equiv, args, config)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
def rails_equivalent
|
25
|
+
self.class.rails_equivalent_block && instance_eval(&self.class.rails_equivalent_block)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.expand_path("../all", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module Jax
|
4
|
+
module Generators
|
5
|
+
class ControllerGenerator < Jax::Generators::RailsBase
|
6
|
+
argument :actions, :type => :array, :default => [], :banner => "action action"
|
7
|
+
class_option :without_index, :type => :boolean, :default => false,
|
8
|
+
:desc => "skip the default 'index' action unless explicitly specified"
|
9
|
+
rails_equivalent { "controller" }
|
10
|
+
|
11
|
+
def add_index_action
|
12
|
+
actions.unshift 'index' unless actions.include?('index') or options[:without_index]
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_controller_file
|
16
|
+
coffee_template_with_fallback "controller.js",
|
17
|
+
File.join('app/assets/jax/controllers', "#{file_name}_controller.js")
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_spec_file
|
21
|
+
coffee_template_with_fallback "controller_spec.js",
|
22
|
+
File.join('spec/javascripts/jax/controllers', "#{file_name}_controller_spec.js")
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_view_file
|
26
|
+
for action in actions
|
27
|
+
@action_name = action
|
28
|
+
coffee_template_with_fallback "view.js",
|
29
|
+
File.join('app/assets/jax/views', file_name, "#{action}.js")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
attr_reader :action_name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path("../all", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module Jax
|
4
|
+
module Generators
|
5
|
+
class HelperGenerator < Jax::Generators::NamedBase
|
6
|
+
def create_helper
|
7
|
+
coffee_template_with_fallback "helper.js",
|
8
|
+
File.join('app/assets/jax/helpers', "#{underscored_helper_name}.js")
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_spec
|
12
|
+
coffee_template_with_fallback "helper_spec.js",
|
13
|
+
File.join('spec/javascripts/jax/helpers', "#{underscored_helper_name}_spec.js")
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
def underscored_helper_name
|
18
|
+
if file_name =~ /_helper$/
|
19
|
+
file_name
|
20
|
+
else
|
21
|
+
"#{file_name}_helper"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def camelized_helper_name
|
26
|
+
underscored_helper_name.camelize
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|