eris 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +32 -0
- data/lib/eris/js/jasmineEnyoBootstrap.js +37 -0
- data/lib/eris/lib/eris_config.rb +7 -0
- data/lib/eris/lib/jasmine_config_overrides.rb +7 -7
- data/lib/eris/templates/Rakefile +1 -0
- data/lib/eris/templates/eris_config.json +6 -2
- data/lib/eris/templates/jasmine.yml +0 -5
- data/lib/eris/version.rb +1 -1
- data/spec/fixtures/enyo/0.10/framework/enyo.js +2 -1
- data/spec/fixtures/sample_app/eris_config.json +1 -1
- data/spec/fixtures/sample_app/eris_config_overridden_version.json +5 -0
- data/spec/fixtures/sample_app/eris_config_with_launch_params.json +8 -0
- data/spec/javascripts/SetLaunchParamsSpec.js +42 -0
- data/spec/javascripts/helpers/TestResponses.js +29 -0
- data/spec/javascripts/helpers/specHelper.js +0 -0
- data/spec/javascripts/support/jasmine.yml +73 -0
- data/spec/javascripts/support/jasmine_config.rb +21 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/lib/eris/lib/eris_config_spec.rb +17 -0
- data/spec/lib/eris/lib/server_spec.rb +1 -1
- metadata +21 -4
data/Rakefile
CHANGED
@@ -1,2 +1,34 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
namespace :jasmine do
|
5
|
+
task :server do
|
6
|
+
require 'jasmine'
|
7
|
+
|
8
|
+
puts "your tests are here:"
|
9
|
+
puts " http://localhost:8888/"
|
10
|
+
|
11
|
+
c = Jasmine::Config.new
|
12
|
+
puts c.src_dir
|
13
|
+
puts c.src_files
|
14
|
+
c.start_server
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run continuous integration tests"
|
18
|
+
task :ci do
|
19
|
+
require 'jasmine'
|
20
|
+
require "rspec"
|
21
|
+
require "rspec/core/rake_task"
|
22
|
+
require 'eris'
|
23
|
+
ENV['JASMINE_BROWSER'] = 'chrome'
|
24
|
+
|
25
|
+
RSpec::Core::RakeTask.new(:jasmine_continuous_integration_runner) do |t|
|
26
|
+
t.rspec_opts = ["--color", "--format", "progress"]
|
27
|
+
t.verbose = true
|
28
|
+
end
|
29
|
+
Rake::Task["jasmine_continuous_integration_runner"].invoke
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Run specs with local config"
|
34
|
+
task :jasmine => ['jasmine:server']
|
@@ -0,0 +1,37 @@
|
|
1
|
+
var jasmineEnyoBootstrap = jasmineEnyoBootstrap || {};
|
2
|
+
|
3
|
+
jasmineEnyoBootstrap.getXhr = function() {
|
4
|
+
try {
|
5
|
+
return new XMLHttpRequest();
|
6
|
+
} catch (e) {
|
7
|
+
}
|
8
|
+
try {
|
9
|
+
return new ActiveXObject('Msxml2.XMLHTTP');
|
10
|
+
} catch (e) {
|
11
|
+
}
|
12
|
+
try {
|
13
|
+
return new ActiveXObject('Microsoft.XMLHTTP');
|
14
|
+
} catch (e) {
|
15
|
+
}
|
16
|
+
return null;
|
17
|
+
};
|
18
|
+
|
19
|
+
jasmineEnyoBootstrap.setLaunchParams = function() {
|
20
|
+
|
21
|
+
var xhr = jasmineEnyoBootstrap.getXhr();
|
22
|
+
var erisConfig = JSON.parse(xhr.open("GET", "eris_config.json", true).responseText);
|
23
|
+
|
24
|
+
var launchParams = erisConfig.enyoLaunchParams;
|
25
|
+
|
26
|
+
if (!launchParams) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
|
30
|
+
window.history.pushState({}, "Jasmine Suite", "http://localhost:8888?" + buildQueryString());
|
31
|
+
|
32
|
+
function buildQueryString() {
|
33
|
+
return Object.keys(launchParams).map(function(key) {
|
34
|
+
return encodeURIComponent(key) + '=' + encodeURIComponent(launchParams[key]);
|
35
|
+
}).join('&');
|
36
|
+
}
|
37
|
+
};
|
data/lib/eris/lib/eris_config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'pathname'
|
3
|
+
require 'uri'
|
3
4
|
|
4
5
|
class ErisConfig
|
5
6
|
def initialize(opts)
|
@@ -18,4 +19,10 @@ class ErisConfig
|
|
18
19
|
File.join(@app_root, enyo_root_for_environment)
|
19
20
|
end
|
20
21
|
end
|
22
|
+
|
23
|
+
def enyo_js_path
|
24
|
+
version = @config_hash['enyoVersion'] || "0.10"
|
25
|
+
|
26
|
+
"usr/palm/frameworks/enyo/#{version}/framework/enyo.js"
|
27
|
+
end
|
21
28
|
end
|
@@ -3,12 +3,11 @@ require 'eris/lib/eris_config'
|
|
3
3
|
module Jasmine
|
4
4
|
class Config
|
5
5
|
def src_files
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
6
|
+
eris_config = ErisConfig.new(:config_path => 'eris_config.json', :app_root => project_root)
|
7
|
+
|
8
|
+
files = ["/__ERIS_RESOURCES__/jasmineEnyoBootstrap.js", eris_config.enyo_js_path]
|
9
|
+
files += match_files(src_dir, simple_config['src_files']) if simple_config['src_files']
|
10
|
+
files
|
12
11
|
end
|
13
12
|
|
14
13
|
def simple_config_file
|
@@ -31,7 +30,8 @@ module Jasmine
|
|
31
30
|
eris_config = ErisConfig.new(:config_path => 'eris_config.json', :app_root => config.project_root)
|
32
31
|
|
33
32
|
map("/usr/palm/frameworks") { run Rack::File.new(eris_config.enyo_root) }
|
34
|
-
|
33
|
+
map("/__ERIS_RESOURCES__") { run Rack::File.new(File.expand_path(File.dirname(__FILE__), '/../js')) }
|
34
|
+
|
35
35
|
map('/') do
|
36
36
|
run Rack::Cascade.new([
|
37
37
|
Rack::URLMap.new('/' => Rack::File.new(config.src_dir)),
|
data/lib/eris/templates/Rakefile
CHANGED
data/lib/eris/version.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
This is the enyo.js fixture
|
1
|
+
// This is the enyo.js fixture
|
2
|
+
enyo = {};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
describe("setLaunchParams", function () {
|
2
|
+
|
3
|
+
beforeEach(function() {
|
4
|
+
window.history.pushState({}, "Jasmine Suite", "http://localhost:8888/");
|
5
|
+
});
|
6
|
+
|
7
|
+
describe("when no launch parameters are specified", function () {
|
8
|
+
beforeEach(function() {
|
9
|
+
spyOn(jasmineEnyoBootstrap, 'getXhr').andCallFake(function() {
|
10
|
+
return {
|
11
|
+
open: function() {
|
12
|
+
return testResponses.erisConfig.noLaunchParams.success;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
});
|
16
|
+
|
17
|
+
jasmineEnyoBootstrap.setLaunchParams();
|
18
|
+
});
|
19
|
+
|
20
|
+
it("should not put any params onto the window's query string", function() {
|
21
|
+
expect(window.location.search).toEqual("");
|
22
|
+
});
|
23
|
+
});
|
24
|
+
|
25
|
+
describe("when launch parameters are specified", function () {
|
26
|
+
beforeEach(function() {
|
27
|
+
spyOn(jasmineEnyoBootstrap, 'getXhr').andCallFake(function() {
|
28
|
+
return {
|
29
|
+
open: function() {
|
30
|
+
return testResponses.erisConfig.withLaunchParams.success;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
jasmineEnyoBootstrap.setLaunchParams();
|
36
|
+
});
|
37
|
+
|
38
|
+
it("should put any params from eris_config.json onto the window", function() {
|
39
|
+
expect(window.location.search).toEqual("?foo=bar%20baz&zip=12");
|
40
|
+
});
|
41
|
+
});
|
42
|
+
});
|
@@ -0,0 +1,29 @@
|
|
1
|
+
testResponses = {};
|
2
|
+
|
3
|
+
testResponses.erisConfig = {
|
4
|
+
noLaunchParams: {
|
5
|
+
success: {
|
6
|
+
status: 200,
|
7
|
+
responseText: JSON.stringify({
|
8
|
+
"localEnyoRoot": "../",
|
9
|
+
"ciEnyoRoot": "../ciboxenyo"
|
10
|
+
}
|
11
|
+
)
|
12
|
+
}
|
13
|
+
},
|
14
|
+
|
15
|
+
withLaunchParams: {
|
16
|
+
success: {
|
17
|
+
status: 200,
|
18
|
+
responseText: JSON.stringify({
|
19
|
+
"localEnyoRoot": "../",
|
20
|
+
"ciEnyoRoot": "../ciboxenyo",
|
21
|
+
"enyoLaunchParams": {
|
22
|
+
"foo": "bar baz",
|
23
|
+
"zip": 12
|
24
|
+
}
|
25
|
+
}
|
26
|
+
)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
};
|
File without changes
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- lib/eris/js/**/*.js
|
15
|
+
|
16
|
+
# stylesheets
|
17
|
+
#
|
18
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
19
|
+
# Default: []
|
20
|
+
#
|
21
|
+
# EXAMPLE:
|
22
|
+
#
|
23
|
+
# stylesheets:
|
24
|
+
# - css/style.css
|
25
|
+
# - stylesheets/*.css
|
26
|
+
#
|
27
|
+
stylesheets:
|
28
|
+
|
29
|
+
# helpers
|
30
|
+
#
|
31
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
32
|
+
# Default: ["helpers/**/*.js"]
|
33
|
+
#
|
34
|
+
# EXAMPLE:
|
35
|
+
#
|
36
|
+
# helpers:
|
37
|
+
# - helpers/**/*.js
|
38
|
+
#
|
39
|
+
helpers:
|
40
|
+
|
41
|
+
# spec_files
|
42
|
+
#
|
43
|
+
# Return an array of filepaths relative to spec_dir to include.
|
44
|
+
# Default: ["**/*[sS]pec.js"]
|
45
|
+
#
|
46
|
+
# EXAMPLE:
|
47
|
+
#
|
48
|
+
# spec_files:
|
49
|
+
# - **/*[sS]pec.js
|
50
|
+
#
|
51
|
+
spec_files:
|
52
|
+
|
53
|
+
# src_dir
|
54
|
+
#
|
55
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
56
|
+
# Default: project root
|
57
|
+
#
|
58
|
+
# EXAMPLE:
|
59
|
+
#
|
60
|
+
# src_dir: public
|
61
|
+
#
|
62
|
+
src_dir: .
|
63
|
+
|
64
|
+
# spec_dir
|
65
|
+
#
|
66
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
67
|
+
# Default: spec/javascripts
|
68
|
+
#
|
69
|
+
# EXAMPLE:
|
70
|
+
#
|
71
|
+
# spec_dir: spec/javascripts
|
72
|
+
#
|
73
|
+
spec_dir:
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Jasmine
|
2
|
+
class Config
|
3
|
+
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
# Note - this is necessary for rspec2, which has removed the backtrace
|
9
|
+
module Jasmine
|
10
|
+
class SpecBuilder
|
11
|
+
def declare_spec(parent, spec)
|
12
|
+
me = self
|
13
|
+
example_name = spec["name"]
|
14
|
+
@spec_ids << spec["id"]
|
15
|
+
backtrace = @example_locations[parent.description + " " + example_name]
|
16
|
+
parent.it example_name, {} do
|
17
|
+
me.report_spec(spec["id"])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'jasmine'
|
5
|
+
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
|
6
|
+
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
|
7
|
+
if Jasmine::rspec2?
|
8
|
+
require 'rspec'
|
9
|
+
else
|
10
|
+
require 'spec'
|
11
|
+
end
|
12
|
+
|
13
|
+
jasmine_config = Jasmine::Config.new
|
14
|
+
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
15
|
+
|
16
|
+
should_stop = false
|
17
|
+
|
18
|
+
if Jasmine::rspec2?
|
19
|
+
RSpec.configuration.after(:suite) do
|
20
|
+
spec_builder.stop if should_stop
|
21
|
+
end
|
22
|
+
else
|
23
|
+
Spec::Runner.configure do |config|
|
24
|
+
config.after(:suite) do
|
25
|
+
spec_builder.stop if should_stop
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
spec_builder.start
|
31
|
+
should_stop = true
|
32
|
+
spec_builder.declare_suites
|
@@ -32,4 +32,21 @@ describe "Eris Config" do
|
|
32
32
|
ENV['IS_CI_BOX'] = old_env_value
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
|
37
|
+
describe "#enyo_js_path" do
|
38
|
+
|
39
|
+
it "return the default path" do
|
40
|
+
config = ErisConfig.new(:config_path => @config_path, :app_root => @app_root)
|
41
|
+
config.enyo_js_path.should match('usr/palm/frameworks/enyo/0.10/framework/enyo.js')
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return a path with an overridden version number" do
|
45
|
+
@config_path = File.join(@app_root, 'eris_config_overridden_version.json')
|
46
|
+
|
47
|
+
config = ErisConfig.new(:config_path => @config_path, :app_root => @app_root)
|
48
|
+
config.enyo_js_path.should match('usr/palm/frameworks/enyo/19/framework/enyo.js')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
35
52
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- HP webOS
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-08-
|
19
|
+
date: 2011-08-03 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -223,6 +223,7 @@ files:
|
|
223
223
|
- js_helpers/ErisHelpers.js
|
224
224
|
- lib/eris.rb
|
225
225
|
- lib/eris/eris.ru
|
226
|
+
- lib/eris/js/jasmineEnyoBootstrap.js
|
226
227
|
- lib/eris/lib/eris_config.rb
|
227
228
|
- lib/eris/lib/jasmine_config_overrides.rb
|
228
229
|
- lib/eris/lib/jasmine_rspec_runner.rb
|
@@ -243,10 +244,18 @@ files:
|
|
243
244
|
- spec/fixtures/sample_app/app/models/foo.js
|
244
245
|
- spec/fixtures/sample_app/appinfo.json
|
245
246
|
- spec/fixtures/sample_app/eris_config.json
|
247
|
+
- spec/fixtures/sample_app/eris_config_overridden_version.json
|
248
|
+
- spec/fixtures/sample_app/eris_config_with_launch_params.json
|
246
249
|
- spec/fixtures/sample_app/index.html.erb
|
247
250
|
- spec/fixtures/sample_app/spec/acceptance/helpers/AppHelper.js
|
248
251
|
- spec/fixtures/vcr_cassettes/failure.yml
|
249
252
|
- spec/fixtures/vcr_cassettes/success.yml
|
253
|
+
- spec/javascripts/SetLaunchParamsSpec.js
|
254
|
+
- spec/javascripts/helpers/TestResponses.js
|
255
|
+
- spec/javascripts/helpers/specHelper.js
|
256
|
+
- spec/javascripts/support/jasmine.yml
|
257
|
+
- spec/javascripts/support/jasmine_config.rb
|
258
|
+
- spec/javascripts/support/jasmine_runner.rb
|
250
259
|
- spec/lib/eris/lib/eris_config_spec.rb
|
251
260
|
- spec/lib/eris/lib/eris_spec.rb
|
252
261
|
- spec/lib/eris/lib/luna_request_spec.rb
|
@@ -295,10 +304,18 @@ test_files:
|
|
295
304
|
- spec/fixtures/sample_app/app/models/foo.js
|
296
305
|
- spec/fixtures/sample_app/appinfo.json
|
297
306
|
- spec/fixtures/sample_app/eris_config.json
|
307
|
+
- spec/fixtures/sample_app/eris_config_overridden_version.json
|
308
|
+
- spec/fixtures/sample_app/eris_config_with_launch_params.json
|
298
309
|
- spec/fixtures/sample_app/index.html.erb
|
299
310
|
- spec/fixtures/sample_app/spec/acceptance/helpers/AppHelper.js
|
300
311
|
- spec/fixtures/vcr_cassettes/failure.yml
|
301
312
|
- spec/fixtures/vcr_cassettes/success.yml
|
313
|
+
- spec/javascripts/SetLaunchParamsSpec.js
|
314
|
+
- spec/javascripts/helpers/TestResponses.js
|
315
|
+
- spec/javascripts/helpers/specHelper.js
|
316
|
+
- spec/javascripts/support/jasmine.yml
|
317
|
+
- spec/javascripts/support/jasmine_config.rb
|
318
|
+
- spec/javascripts/support/jasmine_runner.rb
|
302
319
|
- spec/lib/eris/lib/eris_config_spec.rb
|
303
320
|
- spec/lib/eris/lib/eris_spec.rb
|
304
321
|
- spec/lib/eris/lib/luna_request_spec.rb
|