jax 1.0.1 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/.travis.yml +32 -0
- data/CHANGELOG +126 -0
- data/README.md +1 -1
- data/Rakefile +125 -19
- data/bin/jax +1 -1
- data/builtin/{shaders → app/shaders}/basic/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/basic/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/basic/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/material.js +0 -0
- data/builtin/{shaders → app/shaders}/depthmap/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/fog/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/fog/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/fog/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/fog/material.js +0 -0
- data/builtin/{shaders → app/shaders}/fog/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/functions/depth_map.ejs +0 -0
- data/builtin/{shaders → app/shaders}/functions/lights.ejs +0 -0
- data/builtin/{shaders → app/shaders}/functions/noise.ejs +0 -0
- data/builtin/{shaders → app/shaders}/lighting/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/lighting/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/lighting/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/lighting/material.js +0 -0
- data/builtin/{shaders → app/shaders}/lighting/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/material.js +0 -0
- data/builtin/{shaders → app/shaders}/normal_map/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/material.js +0 -0
- data/builtin/{shaders → app/shaders}/paraboloid/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/picking/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/picking/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/picking/material.js +0 -0
- data/builtin/{shaders → app/shaders}/picking/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/material.js +0 -0
- data/builtin/{shaders → app/shaders}/shadow_map/vertex.ejs +0 -0
- data/builtin/{shaders → app/shaders}/texture/common.ejs +0 -0
- data/builtin/{shaders → app/shaders}/texture/fragment.ejs +0 -0
- data/builtin/{shaders → app/shaders}/texture/manifest.yml +0 -0
- data/builtin/{shaders → app/shaders}/texture/material.js +0 -0
- data/builtin/{shaders → app/shaders}/texture/vertex.ejs +0 -0
- data/jax.gems +1 -1
- data/jax.gemspec +9 -7
- data/lib/jax.rb +23 -9
- data/lib/jax/application.rb +118 -60
- data/lib/jax/application/builtin.rb +12 -0
- data/lib/jax/application/builtin/configurable.rb +5 -0
- data/lib/jax/application/builtin/configuration.rb +5 -0
- data/lib/jax/application/configurable.rb +19 -0
- data/lib/jax/application/configuration.rb +46 -13
- data/lib/jax/application/railties.rb +26 -0
- data/lib/jax/core_ext/kernel.rb +7 -0
- data/lib/jax/engine.rb +64 -0
- data/lib/jax/engine/configurable.rb +19 -0
- data/lib/jax/engine/configuration.rb +49 -0
- data/lib/jax/generators/app.rb +3 -2
- data/lib/jax/generators/app/app_generator.rb +9 -2
- data/lib/jax/generators/app/templates/config/environment.rb.tt +5 -0
- data/lib/jax/generators/app/templates/public/index.html.tt +26 -0
- data/lib/jax/generators/app/templates/public/javascripts/jax.js +8726 -1
- data/lib/jax/generators/app/templates/public/stylesheets/%file_name%.css.tt +11 -0
- data/lib/jax/generators/app/templates/public/webgl_not_supported.html +1 -1
- data/lib/jax/generators/app/templates/spec/javascripts/support/jasmine.yml +1 -0
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js +13 -5
- data/lib/jax/generators/app/templates/spec/javascripts/support/spec_helpers/jax_spec_helper.js +6 -10
- data/lib/jax/generators/commands.rb +168 -42
- data/lib/jax/generators/controller/controller_generator.rb +9 -2
- data/lib/jax/generators/interactions.rb +56 -0
- data/lib/jax/generators/light_source/light_source_generator.rb +1 -2
- data/lib/jax/generators/material/material_generator.rb +1 -2
- data/lib/jax/generators/model/model_generator.rb +1 -3
- data/lib/jax/generators/packager/package_generator.rb +32 -0
- data/lib/jax/generators/plugin/USAGE +4 -0
- data/lib/jax/generators/plugin/all.rb +113 -0
- data/lib/jax/generators/plugin/credentials.rb +108 -0
- data/lib/jax/generators/plugin/plugin_generator.rb +72 -0
- data/lib/jax/generators/plugin/plugin_manager.rb +254 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/controllers/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/helpers/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/models/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/resources/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/app/views/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/config/routes.rb +3 -0
- data/lib/jax/generators/plugin/templates/new_plugin/init.rb +1 -0
- data/lib/jax/generators/plugin/templates/new_plugin/install.rb +2 -0
- data/lib/jax/generators/plugin/templates/new_plugin/public/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/spec/.empty_directory +0 -0
- data/lib/jax/generators/plugin/templates/new_plugin/uninstall.rb +2 -0
- data/lib/jax/generators/script_jax_loader.rb +17 -0
- data/lib/jax/generators/shader/shader_generator.rb +2 -3
- data/lib/jax/monkeypatch/jasmine/config.rb +25 -1
- data/lib/jax/monkeypatch/jasmine/server.rb +1 -1
- data/lib/jax/packager.rb +12 -11
- data/lib/jax/packager/sprockets_template.rb +15 -6
- data/lib/jax/plugin.rb +49 -0
- data/lib/jax/plugin/manifest.rb +71 -0
- data/lib/jax/resource_compiler.rb +24 -14
- data/lib/jax/routes.rb +1 -0
- data/lib/jax/shader.rb +16 -1
- data/lib/jax/tasks/rake.rb +1 -1
- data/lib/jax/version.rb +3 -3
- data/spec/benchmark.htm +93 -0
- data/spec/fixtures/web/plugins/404.http +39 -0
- data/spec/fixtures/web/plugins/all.xml +106 -0
- data/spec/fixtures/web/plugins/author/create_account.xml.http +20 -0
- data/spec/fixtures/web/plugins/author/create_new_plugin.xml.http +27 -0
- data/spec/fixtures/web/plugins/author/login_existing_account.xml.http +19 -0
- data/spec/fixtures/web/plugins/author/login_not_found.xml.http +14 -0
- data/spec/fixtures/web/plugins/author/login_password_invalid.xml.http +12 -0
- data/spec/fixtures/web/plugins/clouds.xml +51 -0
- data/spec/fixtures/web/plugins/example.tgz.http +0 -0
- data/spec/fixtures/web/plugins/example.tgz.http.old +0 -0
- data/spec/fixtures/web/plugins/none.http +13 -0
- data/spec/fixtures/web/plugins/vert.xml +68 -0
- data/spec/fixtures/web/plugins/vertex-blob.xml +37 -0
- data/spec/fixtures/web/plugins/vertex-height-map.xml +44 -0
- data/spec/generators/app_generator_test.rb +42 -0
- data/spec/generators/controller_generator_test.rb +47 -0
- data/spec/generators/light_generator_test.rb +37 -0
- data/spec/generators/material_generator_test.rb +22 -0
- data/spec/generators/model_generator_test.rb +26 -0
- data/spec/generators/plugin_generator_test.rb +114 -0
- data/spec/generators/plugin_manager/push_test.rb +59 -0
- data/spec/generators/plugin_manager_test.rb +192 -0
- data/spec/generators/shader_generator_test.rb +38 -0
- data/spec/lib/jax/application_test.rb +18 -0
- data/spec/lib/jax/generators/plugin/credentials_test.rb +72 -0
- data/spec/lib/jax/packager_test.rb +87 -0
- data/spec/lib/jax/plugin_test.rb +27 -0
- data/spec/lib/jax/reloading_test.rb +23 -0
- data/spec/lib/jax/routes_test.rb +28 -0
- data/spec/lib/jax/shader_test.rb +29 -0
- data/spec/lib/jax/tasks/jax_rake_test.rb +85 -0
- data/spec/support/bases/generator_test_case.rb +108 -0
- data/spec/support/bases/isolated_test_case.rb +148 -0
- data/spec/support/fixtures_helper.rb +21 -0
- data/spec/support/spec_shell.rb +14 -1
- data/spec/test_app.rb +3 -0
- data/spec/test_helper.rb +55 -0
- metadata +200 -92
- data/spec/generators/app_generator_spec.rb +0 -47
- data/spec/generators/controller_generator_spec.rb +0 -68
- data/spec/generators/light_generator_spec.rb +0 -51
- data/spec/generators/material_generator_spec.rb +0 -35
- data/spec/generators/model_generator_spec.rb +0 -43
- data/spec/lib/jax/routes_spec.rb +0 -24
- data/spec/lib/jax/shader_spec.rb +0 -57
- data/spec/lib/jax/tasks/jax_rake_spec.rb +0 -92
- data/spec/spec_helper.rb +0 -11
@@ -0,0 +1,37 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/xml; charset=utf-8
|
3
|
+
Etag: "cb47c0782df774abbb201d37b9abe155"
|
4
|
+
Cache-Control: max-age=0, private, must-revalidate
|
5
|
+
X-Ua-Compatible: IE=Edge
|
6
|
+
X-Runtime: 0.098555
|
7
|
+
Server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)
|
8
|
+
Date: Fri, 10 Jun 2011 13:30:31 GMT
|
9
|
+
Connection: Keep-Alive
|
10
|
+
|
11
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
12
|
+
<jax-plugins type="array">
|
13
|
+
<jax-plugin>
|
14
|
+
<author-id type="integer">1</author-id>
|
15
|
+
<created-at type="datetime">2011-06-07T10:51:41Z</created-at>
|
16
|
+
<description>Adds a shader that deforms meshes, producing "blobs".</description>
|
17
|
+
<id type="integer">2</id>
|
18
|
+
<name>vertex-blob</name>
|
19
|
+
<updated-at type="datetime">2011-06-07T10:51:41Z</updated-at>
|
20
|
+
<author>
|
21
|
+
<created-at type="datetime">2011-06-07T02:28:44Z</created-at>
|
22
|
+
<email>sinisterchipmunk@gmail.com</email>
|
23
|
+
<id type="integer">Colin MacKenzie IV</id>
|
24
|
+
<login>sinisterchipmunk</login>
|
25
|
+
<updated-at type="datetime">2011-06-07T02:28:44Z</updated-at>
|
26
|
+
</author>
|
27
|
+
<releases type="array">
|
28
|
+
<release>
|
29
|
+
<created-at type="datetime">2011-06-07T10:51:41Z</created-at>
|
30
|
+
<id type="integer">1</id>
|
31
|
+
<jax-plugin-id type="integer">1</jax-plugin-id>
|
32
|
+
<updated-at type="datetime">2011-06-07T10:51:41Z</updated-at>
|
33
|
+
<version>1.0.0</version>
|
34
|
+
</release>
|
35
|
+
</releases>
|
36
|
+
</jax-plugin>
|
37
|
+
</jax-plugins>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Content-Type: application/xml; charset=utf-8
|
3
|
+
Etag: "cb47c0782df774abbb201d37b9abe155"
|
4
|
+
Cache-Control: max-age=0, private, must-revalidate
|
5
|
+
X-Ua-Compatible: IE=Edge
|
6
|
+
X-Runtime: 0.098555
|
7
|
+
Server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)
|
8
|
+
Date: Fri, 10 Jun 2011 13:30:31 GMT
|
9
|
+
Connection: Keep-Alive
|
10
|
+
|
11
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
12
|
+
<jax-plugins type="array">
|
13
|
+
<jax-plugin>
|
14
|
+
<author-id type="integer">1</author-id>
|
15
|
+
<created-at type="datetime">2011-06-07T10:51:41Z</created-at>
|
16
|
+
<description>Adds a height map generated dynamically in the vertex shader using Perlin noise.</description>
|
17
|
+
<id type="integer">1</id>
|
18
|
+
<name>vertex-height-map</name>
|
19
|
+
<updated-at type="datetime">2011-06-07T10:51:41Z</updated-at>
|
20
|
+
<author>
|
21
|
+
<created-at type="datetime">2011-06-07T02:28:44Z</created-at>
|
22
|
+
<email>sinisterchipmunk@gmail.com</email>
|
23
|
+
<id type="integer">Colin MacKenzie IV</id>
|
24
|
+
<login>sinisterchipmunk</login>
|
25
|
+
<updated-at type="datetime">2011-06-07T02:28:44Z</updated-at>
|
26
|
+
</author>
|
27
|
+
<releases type="array">
|
28
|
+
<release>
|
29
|
+
<created-at type="datetime">2011-06-07T10:51:41Z</created-at>
|
30
|
+
<id type="integer">1</id>
|
31
|
+
<jax-plugin-id type="integer">1</jax-plugin-id>
|
32
|
+
<updated-at type="datetime">2011-06-07T10:51:41Z</updated-at>
|
33
|
+
<version>1.0.0</version>
|
34
|
+
</release>
|
35
|
+
<release>
|
36
|
+
<created-at type="datetime">2011-06-07T12:04:22Z</created-at>
|
37
|
+
<id type="integer">2</id>
|
38
|
+
<jax-plugin-id type="integer">1</jax-plugin-id>
|
39
|
+
<updated-at type="datetime">2011-06-07T12:04:22Z</updated-at>
|
40
|
+
<version>1.0.1</version>
|
41
|
+
</release>
|
42
|
+
</releases>
|
43
|
+
</jax-plugin>
|
44
|
+
</jax-plugins>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'test_app'
|
3
|
+
|
4
|
+
pwd = File.join(Dir.pwd, "generator_tests")
|
5
|
+
EXPECTED_FILES = %w(
|
6
|
+
app/controllers/application_controller.js
|
7
|
+
app/helpers/application_helper.js
|
8
|
+
app/models/
|
9
|
+
app/resources/
|
10
|
+
app/views/
|
11
|
+
config/application.rb
|
12
|
+
config/routes.rb
|
13
|
+
config/boot.rb
|
14
|
+
public/webgl_not_supported.html
|
15
|
+
public/index.html
|
16
|
+
public/stylesheets/test_app.css
|
17
|
+
script/jax
|
18
|
+
spec/javascripts/support/jasmine.yml
|
19
|
+
spec/javascripts/support/jasmine_runner.rb
|
20
|
+
spec/javascripts/support/spec_layout.html.erb
|
21
|
+
spec/javascripts/support/spec_helpers/jax_spec_environment_helper.js
|
22
|
+
spec/javascripts/support/spec_helpers/jax_spec_helper.js
|
23
|
+
Rakefile
|
24
|
+
Gemfile
|
25
|
+
)
|
26
|
+
|
27
|
+
class Jax::Generators::App::AppGeneratorTest < Jax::Generators::TestCase
|
28
|
+
test "should generate all expected files" do
|
29
|
+
generate "test_app"
|
30
|
+
|
31
|
+
EXPECTED_FILES.each do |file|
|
32
|
+
assert_file File.join("test_app", file)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
test "should include lib/ in generated spec_layout.html.erb" do
|
37
|
+
generate "test_app"
|
38
|
+
assert_file "test_app/spec/javascripts/support/jasmine.yml" do |f|
|
39
|
+
assert_match /\- lib\/\*\*\/\*\.js/, f
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jax::Generators::Controller::ControllerGeneratorTest < Jax::Generators::TestCase
|
4
|
+
setup :copy_routes
|
5
|
+
|
6
|
+
test "with no arguments" do
|
7
|
+
# since this test was first written, it's become apparent that the 'index' action is
|
8
|
+
# pretty much ubiquitous -- enough so that it's safe to auto-generate it if omitted.
|
9
|
+
|
10
|
+
generate 'welcome'
|
11
|
+
|
12
|
+
assert_file "app/controllers/welcome_controller.js", /^\s*index: function\(\)\s*\{/
|
13
|
+
assert_file "app/views/welcome/index.js"
|
14
|
+
assert_file "config/routes.rb", /^ map ['"]welcome\/index["']/
|
15
|
+
assert_file "spec/javascripts/controllers/welcome_controller_spec.js"
|
16
|
+
end
|
17
|
+
|
18
|
+
test "with --root option" do
|
19
|
+
generate 'welcome', '--root'
|
20
|
+
|
21
|
+
assert_file "config/routes.rb", /root ['"]welcome["']/
|
22
|
+
end
|
23
|
+
|
24
|
+
test "with arguments" do
|
25
|
+
generate "welcome", "index"
|
26
|
+
|
27
|
+
assert_file "app/controllers/welcome_controller.js", /^\s*index: function\(\)\s*\{/
|
28
|
+
assert_file "app/views/welcome/index.js"
|
29
|
+
assert_file "config/routes.rb", /^ map ['"]welcome\/index["']/
|
30
|
+
assert_file "spec/javascripts/controllers/welcome_controller_spec.js"
|
31
|
+
end
|
32
|
+
|
33
|
+
include TestHelpers::Paths
|
34
|
+
include TestHelpers::Generation
|
35
|
+
|
36
|
+
test "in plugin" do
|
37
|
+
build_app
|
38
|
+
plugin_generator 'clouds'
|
39
|
+
boot_app
|
40
|
+
|
41
|
+
generate "welcome", "index"
|
42
|
+
assert_file "vendor/plugins/clouds/app/controllers/welcome_controller.js", /^\s*index: function\(\)\s*\{/
|
43
|
+
assert_file "vendor/plugins/clouds/app/views/welcome/index.js"
|
44
|
+
assert_file "vendor/plugins/clouds/config/routes.rb", /^ map ['"]welcome\/index["']/
|
45
|
+
assert_file "vendor/plugins/clouds/spec/javascripts/controllers/welcome_controller_spec.js"
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Jax::Generators::LightSource::LightSourceGeneratorTest < Jax::Generators::TestCase
|
4
|
+
test "with light name" do
|
5
|
+
generate 'torch'
|
6
|
+
|
7
|
+
assert_file "app/resources/light_sources/torch.yml"
|
8
|
+
end
|
9
|
+
|
10
|
+
test "with directional" do
|
11
|
+
generate 'torch', 'directional'
|
12
|
+
|
13
|
+
assert_file 'app/resources/light_sources/torch.yml' do |content|
|
14
|
+
assert_no_match /position/, content
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
test "with point" do
|
19
|
+
generate 'torch', 'point'
|
20
|
+
|
21
|
+
assert_file 'app/resources/light_sources/torch.yml' do |content|
|
22
|
+
assert_no_match /direction/, content
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
include TestHelpers::Paths
|
27
|
+
include TestHelpers::Generation
|
28
|
+
|
29
|
+
test "in plugin" do
|
30
|
+
build_app
|
31
|
+
plugin_generator 'clouds'
|
32
|
+
boot_app
|
33
|
+
|
34
|
+
generate "torch", "directional"
|
35
|
+
assert_file "vendor/plugins/clouds/app/resources/light_sources/torch.yml"
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'test_app'
|
3
|
+
|
4
|
+
class Jax::Generators::Material::MaterialGeneratorTest < Jax::Generators::TestCase
|
5
|
+
test "with material name" do
|
6
|
+
generate 'brick'
|
7
|
+
|
8
|
+
assert_file "app/resources/materials/brick.yml"
|
9
|
+
end
|
10
|
+
|
11
|
+
include TestHelpers::Paths
|
12
|
+
include TestHelpers::Generation
|
13
|
+
|
14
|
+
test "in plugin" do
|
15
|
+
build_app
|
16
|
+
plugin_generator 'clouds'
|
17
|
+
boot_app
|
18
|
+
|
19
|
+
generate "brick"
|
20
|
+
assert_file "vendor/plugins/clouds/app/resources/materials/brick.yml"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'test_app'
|
3
|
+
|
4
|
+
class Jax::Generators::Model::ModelGeneratorTest < Jax::Generators::TestCase
|
5
|
+
test "with no arguments" do
|
6
|
+
generate 'character'
|
7
|
+
|
8
|
+
assert_file "app/models/character.js"
|
9
|
+
assert_file "app/resources/characters/default.yml"
|
10
|
+
assert_file "spec/javascripts/models/character_spec.js"
|
11
|
+
end
|
12
|
+
|
13
|
+
include TestHelpers::Paths
|
14
|
+
include TestHelpers::Generation
|
15
|
+
|
16
|
+
test "in plugin" do
|
17
|
+
build_app
|
18
|
+
plugin_generator 'clouds'
|
19
|
+
boot_app
|
20
|
+
|
21
|
+
generate "character"
|
22
|
+
assert_file "vendor/plugins/clouds/app/models/character.js"
|
23
|
+
assert_file "vendor/plugins/clouds/app/resources/characters/default.yml"
|
24
|
+
assert_file "vendor/plugins/clouds/spec/javascripts/models/character_spec.js"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'test_app'
|
3
|
+
|
4
|
+
class Jax::Generators::Plugin::PluginGeneratorTest < Jax::Generators::TestCase
|
5
|
+
EXPECTED_FILES = %w(
|
6
|
+
vendor/plugins/cloud/app/controllers
|
7
|
+
vendor/plugins/cloud/app/models
|
8
|
+
vendor/plugins/cloud/app/helpers
|
9
|
+
vendor/plugins/cloud/app/views
|
10
|
+
vendor/plugins/cloud/app/resources
|
11
|
+
vendor/plugins/cloud/public
|
12
|
+
vendor/plugins/cloud/spec
|
13
|
+
vendor/plugins/cloud/manifest.yml
|
14
|
+
vendor/plugins/cloud/init.rb
|
15
|
+
vendor/plugins/cloud/install.rb
|
16
|
+
vendor/plugins/cloud/uninstall.rb
|
17
|
+
vendor/plugins/cloud/config/routes.rb
|
18
|
+
)
|
19
|
+
|
20
|
+
setup do
|
21
|
+
Jax.plugin_repository_url = Jax.default_plugin_repository_url
|
22
|
+
end
|
23
|
+
|
24
|
+
test "remote repo unavailable with confirmation" do
|
25
|
+
Jax.application.plugin_repository_url = "http://nowhere.example.com"
|
26
|
+
|
27
|
+
stdin.returns "y\n"
|
28
|
+
result = generate "cloud"
|
29
|
+
|
30
|
+
assert_match /an error occurred/i, result
|
31
|
+
EXPECTED_FILES.each do |fi|
|
32
|
+
assert_file fi
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
test "remote repo unavailable with abort" do
|
37
|
+
Jax.application.plugin_repository_url = "http://nowhere.example.com"
|
38
|
+
|
39
|
+
stdin.returns "n\n"
|
40
|
+
result = generate "cloud"
|
41
|
+
|
42
|
+
assert_match /aborted/, result
|
43
|
+
EXPECTED_FILES.each do |fi|
|
44
|
+
assert_no_file fi
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
test "a new plugin not in repo" do
|
49
|
+
# is this not a double of 'clean new plugin'? why does that one not fail?
|
50
|
+
# probably screwed up the fixture somehow. wutevs, this test is the real
|
51
|
+
# deal.
|
52
|
+
generate "missing"
|
53
|
+
|
54
|
+
EXPECTED_FILES.each do |fi|
|
55
|
+
assert_file fi.gsub(/cloud/, 'missing')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
test "a clean new plugin" do
|
60
|
+
generate "cloud"
|
61
|
+
|
62
|
+
EXPECTED_FILES.each do |fi|
|
63
|
+
assert_file fi
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
test "files" do
|
68
|
+
generate "cloud"
|
69
|
+
|
70
|
+
EXPECTED_FILES.each do |path|
|
71
|
+
assert_file path
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
test "overwriting a locally conflicting name" do
|
76
|
+
generate "cloud"
|
77
|
+
File.open(File.join(destination_root, "vendor/plugins/cloud/custom"), "w") { |f| f.print "file contents" }
|
78
|
+
stdin.returns "y\n"
|
79
|
+
generate 'cloud'
|
80
|
+
|
81
|
+
assert_no_file "vendor/plugins/cloud/custom"
|
82
|
+
assert_directory "vendor/plugins/cloud"
|
83
|
+
end
|
84
|
+
|
85
|
+
test "using a conflicting name with --local" do
|
86
|
+
result = generate "clouds", "--local"
|
87
|
+
|
88
|
+
assert_no_match /aborted/, result
|
89
|
+
assert_directory "vendor/plugins/clouds"
|
90
|
+
end
|
91
|
+
|
92
|
+
test "without remote name conflicts" do
|
93
|
+
result = generate "cloud"
|
94
|
+
|
95
|
+
assert_no_match /aborted/, result
|
96
|
+
assert_directory "vendor/plugins/cloud"
|
97
|
+
end
|
98
|
+
|
99
|
+
test "aborting remote name conflicts" do
|
100
|
+
stdin.returns "n\n"
|
101
|
+
result = generate "clouds"
|
102
|
+
|
103
|
+
assert_no_directory "vendor/plugins/clouds"
|
104
|
+
assert_match /aborted/, result
|
105
|
+
end
|
106
|
+
|
107
|
+
test "allowing remote name conflicts" do
|
108
|
+
stdin.returns "y\n"
|
109
|
+
result = generate "clouds"
|
110
|
+
|
111
|
+
assert_directory "vendor/plugins/clouds"
|
112
|
+
assert_no_match /aborted/, result
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'test_app'
|
3
|
+
|
4
|
+
class Jax::Generators::Plugin::PluginManagerPushTest < Jax::Generators::TestCase
|
5
|
+
tests Jax::Generators::Plugin::PluginManager
|
6
|
+
|
7
|
+
include TestHelpers::Paths
|
8
|
+
include TestHelpers::Generation
|
9
|
+
|
10
|
+
test "push plugin with edited manifest" do
|
11
|
+
build_app
|
12
|
+
plugin_generator 'clouds'
|
13
|
+
boot_app
|
14
|
+
|
15
|
+
manifest = Jax.application.plugins.first.manifest
|
16
|
+
manifest.description = "a cloudy day"
|
17
|
+
manifest.save
|
18
|
+
|
19
|
+
# how to test success? A file has been uploaded. For now we'll just verify nothing raised...
|
20
|
+
stdin.returns "sinisterchipmunk@gmail.com\npassword\n"
|
21
|
+
assert_nothing_raised do
|
22
|
+
result = generate "push"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
test "push plugin with default manifest" do
|
27
|
+
build_app
|
28
|
+
plugin_generator 'clouds'
|
29
|
+
boot_app
|
30
|
+
|
31
|
+
result = generate "push"
|
32
|
+
|
33
|
+
assert_match /enter a plugin description/, result
|
34
|
+
end
|
35
|
+
|
36
|
+
test "push plugin without manifest" do
|
37
|
+
build_app
|
38
|
+
plugin_generator 'clouds'
|
39
|
+
boot_app
|
40
|
+
|
41
|
+
manifest = File.join(app_path, "vendor/plugins/clouds/manifest.yml")
|
42
|
+
FileUtils.rm manifest if File.file?(manifest)
|
43
|
+
|
44
|
+
result = generate "push"
|
45
|
+
|
46
|
+
assert_match /manifest is missing/i, result
|
47
|
+
assert_match /create/, result
|
48
|
+
assert_file manifest
|
49
|
+
end
|
50
|
+
|
51
|
+
test "push plugin outside plugin dir" do
|
52
|
+
build_app
|
53
|
+
plugin 'clouds'
|
54
|
+
boot_app
|
55
|
+
|
56
|
+
result = generate "push"
|
57
|
+
assert_match /aborted/i, result
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
# require 'test_app'
|
3
|
+
|
4
|
+
class Jax::Generators::Plugin::PluginManagerTest < Jax::Generators::TestCase
|
5
|
+
test "uninstall plugin with install.rb and uninstall.rb calls uninstall.rb but not install.rb" do
|
6
|
+
$install_loaded = $uninstall_loaded = 0
|
7
|
+
stub_file "vendor/plugins/clouds/install.rb", "$install_loaded = 1"
|
8
|
+
stub_file "vendor/plugins/clouds/uninstall.rb", "$uninstall_loaded = 1"
|
9
|
+
|
10
|
+
generate "uninstall", "clouds"
|
11
|
+
assert_equal 0, $install_loaded
|
12
|
+
assert_equal 1, $uninstall_loaded
|
13
|
+
end
|
14
|
+
|
15
|
+
test "uninstall missing plugin" do
|
16
|
+
result = generate "uninstall", "clouds"
|
17
|
+
|
18
|
+
assert_match /aborted/, result
|
19
|
+
assert_match /Plugin 'clouds' does not seem to be installed./, result
|
20
|
+
end
|
21
|
+
|
22
|
+
test "uninstall previously installed with inexact multiple matches, selecting all" do
|
23
|
+
generate 'install', 'clouds'
|
24
|
+
generate 'install', 'vertex-height-map'
|
25
|
+
generate 'install', 'vertex-blob'
|
26
|
+
|
27
|
+
stdin.returns "0\n"
|
28
|
+
generate "uninstall", "vertex"
|
29
|
+
|
30
|
+
assert_no_directory "vendor/plugins/vertex-height-map"
|
31
|
+
assert_no_directory "vendor/plugins/vertex-blob"
|
32
|
+
assert_directory "vendor/plugins/clouds" # because it doesn't match 'vertex*'
|
33
|
+
end
|
34
|
+
|
35
|
+
test "uninstall previously installed with inexact multiple matches, selecting one" do
|
36
|
+
generate 'install', 'clouds'
|
37
|
+
generate 'install', 'vertex-height-map'
|
38
|
+
generate 'install', 'vertex-blob'
|
39
|
+
|
40
|
+
stdin.returns "2\n"
|
41
|
+
generate "uninstall", "vertex"
|
42
|
+
|
43
|
+
assert_no_directory "vendor/plugins/vertex-height-map"
|
44
|
+
assert_directory "vendor/plugins/vertex-blob"
|
45
|
+
assert_directory "vendor/plugins/clouds"
|
46
|
+
end
|
47
|
+
|
48
|
+
test "uninstall previously installed with inexact single match aborted" do
|
49
|
+
generate 'install', 'clouds'
|
50
|
+
generate 'install', 'vertex-height-map'
|
51
|
+
generate 'install', 'vertex-blob'
|
52
|
+
|
53
|
+
stdin.returns "n\n"
|
54
|
+
generate "uninstall", "cloud"
|
55
|
+
|
56
|
+
assert_directory "vendor/plugins/clouds"
|
57
|
+
end
|
58
|
+
|
59
|
+
test "uninstall previously installed with inexact single match confirmed" do
|
60
|
+
generate 'install', 'clouds'
|
61
|
+
generate 'install', 'vertex-height-map'
|
62
|
+
generate 'install', 'vertex-blob'
|
63
|
+
|
64
|
+
stdin.returns "y\n"
|
65
|
+
generate "uninstall", "cloud"
|
66
|
+
|
67
|
+
assert_no_directory "vendor/plugins/clouds"
|
68
|
+
end
|
69
|
+
|
70
|
+
test "uninstall exact match" do
|
71
|
+
generate 'install', 'clouds'
|
72
|
+
generate 'install', 'vertex-height-map'
|
73
|
+
generate 'install', 'vertex-blob'
|
74
|
+
generate "uninstall", "clouds"
|
75
|
+
|
76
|
+
assert_directory "vendor/plugins/vertex-height-map"
|
77
|
+
assert_directory "vendor/plugins/vertex-blob"
|
78
|
+
assert_no_directory "vendor/plugins/clouds"
|
79
|
+
end
|
80
|
+
|
81
|
+
test "install with install.rb and uninstall.rb" do
|
82
|
+
$install_loaded = $uninstall_loaded = 0
|
83
|
+
generate "install", "clouds"
|
84
|
+
|
85
|
+
assert_equal 1, $install_loaded
|
86
|
+
assert_equal 0, $uninstall_loaded
|
87
|
+
end
|
88
|
+
|
89
|
+
test 'install with default multiple matches' do
|
90
|
+
stdin.returns "2"
|
91
|
+
generate "install", "vert"
|
92
|
+
|
93
|
+
assert_directory "vendor/plugins/vertex-blob"
|
94
|
+
assert_no_directory "vendor/plugins/vertex-height-map"
|
95
|
+
end
|
96
|
+
|
97
|
+
test 'install with default single inexact match confirmed' do
|
98
|
+
stdin.returns "y\n"
|
99
|
+
generate "install", "cloud"
|
100
|
+
|
101
|
+
assert_directory "vendor/plugins/clouds"
|
102
|
+
end
|
103
|
+
|
104
|
+
test 'install with default single inexact match aborted' do
|
105
|
+
stdin.returns "n\n"
|
106
|
+
generate 'install', 'cloud'
|
107
|
+
|
108
|
+
assert_no_directory "vendor/plugins/clouds"
|
109
|
+
end
|
110
|
+
|
111
|
+
test "install with default exact match" do
|
112
|
+
result = generate 'install', 'clouds'
|
113
|
+
|
114
|
+
assert_directory 'vendor/plugins/clouds'
|
115
|
+
assert_match /1\.0\.2/, result
|
116
|
+
end
|
117
|
+
|
118
|
+
test "install with old version exact match" do
|
119
|
+
result = generate 'install', 'clouds', '--version=1.0.0'
|
120
|
+
|
121
|
+
assert_directory "vendor/plugins/clouds"
|
122
|
+
assert_match /1\.0\.0/, result
|
123
|
+
end
|
124
|
+
|
125
|
+
test "install with old version shorthand exact match" do
|
126
|
+
result = generate 'install', 'clouds', '-v=1.0.0'
|
127
|
+
|
128
|
+
assert_directory "vendor/plugins/clouds"
|
129
|
+
assert_match /1\.0\.0/, result
|
130
|
+
end
|
131
|
+
|
132
|
+
test 'list local only with plugins installed with a filter' do
|
133
|
+
generate 'install', 'vertex-blob', 'vertex-height-map'
|
134
|
+
result = generate 'list', 'vertex-b', '--local'
|
135
|
+
|
136
|
+
assert_match /vertex-blob/, result
|
137
|
+
assert_match /#{Regexp::escape 'Adds a shader that deforms meshes, producing "blobs".'}/, result
|
138
|
+
assert_no_match /vertex-height-map/, result
|
139
|
+
assert_no_match /#{Regexp::escape 'Adds a height map generated dynamically in the vertex sha'}/, result
|
140
|
+
end
|
141
|
+
|
142
|
+
test 'list local only with plugins installed' do
|
143
|
+
generate 'install', 'vertex-blob', 'vertex-height-map'
|
144
|
+
result = generate 'list', '--local'
|
145
|
+
|
146
|
+
assert_match /vertex-blob/, result
|
147
|
+
assert_match /#{Regexp::escape 'Adds a shader that deforms meshes, producing "blobs".'}/, result
|
148
|
+
assert_match /vertex-height-map/, result
|
149
|
+
assert_match /#{Regexp::escape 'Adds a height map generated dynamically in the vertex sha'}/, result
|
150
|
+
assert_no_match /clouds/, result
|
151
|
+
assert_no_match /#{Regexp::escape 'Adds a shader for dynamic cloud generation.'}/, result
|
152
|
+
end
|
153
|
+
|
154
|
+
test "list local only with no plugins installed" do
|
155
|
+
result = generate "list", "--local"
|
156
|
+
|
157
|
+
assert_match /There do not seem to be any plugins installed for this application./, result
|
158
|
+
end
|
159
|
+
|
160
|
+
test "list summary" do
|
161
|
+
result = generate 'list'
|
162
|
+
|
163
|
+
assert_match /Adds a height map generated dynamically in the vertex sha\.\.\./, result
|
164
|
+
end
|
165
|
+
|
166
|
+
test 'list detail' do
|
167
|
+
result = generate 'list', '--detailed'
|
168
|
+
|
169
|
+
assert_match /Adds a height map generated dynamically in the vertex shader using Perlin noise\./, result
|
170
|
+
end
|
171
|
+
|
172
|
+
test 'list (all)' do
|
173
|
+
result = generate 'list'
|
174
|
+
|
175
|
+
assert_match /vertex-height-map/, result
|
176
|
+
assert_match /clouds/, result
|
177
|
+
end
|
178
|
+
|
179
|
+
test 'list vertex-height-map' do
|
180
|
+
result = generate 'list', 'vertex-height-map'
|
181
|
+
|
182
|
+
assert_match /vertex-height-map/, result
|
183
|
+
assert_no_match /clouds/, result
|
184
|
+
end
|
185
|
+
|
186
|
+
test 'list clouds' do
|
187
|
+
result = generate 'list', 'clouds'
|
188
|
+
|
189
|
+
assert_no_match /vertex-height-map/, result
|
190
|
+
assert_match /clouds/, result
|
191
|
+
end
|
192
|
+
end
|