newjs 1.3.7 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +3 -1
- data/README.txt +41 -12
- data/lib/newjs/version.rb +2 -2
- data/newjs_generators/install_website/templates/script/txt2html +3 -2
- data/rails_generators/javascript_test/javascript_test_generator.rb +39 -26
- data/rails_generators/javascript_test/templates/ext/jquery.js +3408 -0
- data/rails_generators/javascript_test/templates/ext/prototype.js +4170 -0
- data/rails_generators/javascript_test/templates/library.js.erb +3 -0
- data/rails_generators/javascript_test/templates/plugins/javascript_unittest/tasks/autotest.rake +7 -7
- data/rails_generators/javascript_test/templates/plugins/javascript_unittest/tasks/runner.rake +1 -1
- data/rails_generators/javascript_test/templates/script/js_autotest +1 -1
- data/rails_generators/javascript_test/templates/test.html.erb +6 -4
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/txt2html +0 -0
- data/test/test_javascript_test_generator.rb +101 -7
- data/website/index.html +1 -1
- metadata +8 -6
- data/log/debug.log +0 -0
data/rails_generators/javascript_test/templates/plugins/javascript_unittest/tasks/autotest.rake
CHANGED
@@ -5,17 +5,17 @@ namespace :test do
|
|
5
5
|
APP_ROOT = RAILS_ROOT unless Object.const_defined?("APP_ROOT")
|
6
6
|
since = TEST_CHANGES_SINCE
|
7
7
|
touched = FileList[
|
8
|
-
'test/javascript
|
9
|
-
'public/javascripts
|
8
|
+
'test/javascript/**/*_test.html',
|
9
|
+
'public/javascripts/**/*.js'].select { |path| File.mtime(path) > since }
|
10
10
|
next if touched.blank?
|
11
|
-
|
11
|
+
|
12
12
|
gem 'newjs'
|
13
13
|
require 'newjs'
|
14
14
|
require 'newjs/autotest'
|
15
|
-
|
15
|
+
|
16
16
|
touched.each do |file|
|
17
|
-
if file =~ /\/(
|
18
|
-
file = "test/
|
17
|
+
if file =~ /\/(.+)\.js$/
|
18
|
+
file = "test/javascript/#{$1}_test.html"
|
19
19
|
end
|
20
20
|
file = "#{RAILS_ROOT}/#{file}"
|
21
21
|
unless File.exists?(file)
|
@@ -32,7 +32,7 @@ namespace :test do
|
|
32
32
|
browser = JavascriptTestAutotest::Browser.browser(name, path)
|
33
33
|
browser.setup
|
34
34
|
browser.visit(file)
|
35
|
-
browser.teardown
|
35
|
+
browser.teardown
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/rails_generators/javascript_test/templates/plugins/javascript_unittest/tasks/runner.rake
CHANGED
@@ -11,7 +11,7 @@ namespace :test do
|
|
11
11
|
t.mount("/public/javascripts")
|
12
12
|
t.mount("/test")
|
13
13
|
|
14
|
-
Dir["test/javascript
|
14
|
+
Dir["test/javascript/**/*_test.html"].sort.each do |test_file|
|
15
15
|
tests = testcases ? { :url => "/#{test_file}", :testcases => testcases } : "/#{test_file}"
|
16
16
|
test_filename = test_file[/.*\/(.+?)\.html/, 1]
|
17
17
|
t.run(tests) unless tests_to_run && !tests_to_run.include?(test_filename)
|
@@ -1 +1 @@
|
|
1
|
-
script/rstakeout "rake test:recent:javascript" test/javascript/*_test.html public/javascripts/*.js
|
1
|
+
script/rstakeout "rake test:recent:javascript" test/javascript/**/*_test.html test/javascript/*_test.html public/javascripts/**/*.js public/javascripts/*.js
|
@@ -4,11 +4,13 @@
|
|
4
4
|
<head>
|
5
5
|
<title>JavaScript unit test file</title>
|
6
6
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
-
<script src="assets/jsunittest.js" type="text/javascript"></script>
|
7
|
+
<script src="<%= reverse_nested_folder %>assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
<% if framework -%>
|
9
|
+
<script src="<%= reverse_nested_folder %>../../public/javascripts/ext/<%= framework %>.js" type="text/javascript"></script>
|
10
|
+
<% end -%>
|
11
|
+
<script src="<%= reverse_nested_folder %>../../public/javascripts/<%= "#{nested_folder}/" if nested_folder %><%= library_name %>.js" type="text/javascript"></script>
|
8
12
|
|
9
|
-
<
|
10
|
-
|
11
|
-
<link rel="stylesheet" href="assets/unittest.css" type="text/css" />
|
13
|
+
<link rel="stylesheet" href="<%= reverse_nested_folder %>assets/unittest.css" type="text/css" />
|
12
14
|
</head>
|
13
15
|
<body>
|
14
16
|
|
data/script/destroy
CHANGED
File without changes
|
data/script/generate
CHANGED
File without changes
|
data/script/txt2html
CHANGED
File without changes
|
@@ -13,11 +13,11 @@ class TestJavascriptTestGenerator < Test::Unit::TestCase
|
|
13
13
|
def setup
|
14
14
|
bare_setup
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def teardown
|
18
18
|
bare_teardown
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
# Some generator-related assertions:
|
22
22
|
# assert_generated_file(name, &block) # block passed the file contents
|
23
23
|
# assert_directory_exists(name)
|
@@ -31,7 +31,7 @@ class TestJavascriptTestGenerator < Test::Unit::TestCase
|
|
31
31
|
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
32
32
|
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
33
33
|
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
34
|
-
|
34
|
+
|
35
35
|
def test_generator_without_options
|
36
36
|
name = "mylib"
|
37
37
|
run_generator('javascript_test', [name], sources)
|
@@ -41,8 +41,54 @@ class TestJavascriptTestGenerator < Test::Unit::TestCase
|
|
41
41
|
assert_generated_file "test/javascript/assets/jsunittest.js"
|
42
42
|
assert_generated_file "test/javascript/assets/unittest.css"
|
43
43
|
assert_generated_file "test/javascript/#{name}_test.html" do |body|
|
44
|
-
|
45
|
-
assert_match(
|
44
|
+
assert_match(%Q{src="assets/jsunittest.js"}, body)
|
45
|
+
assert_match(%Q{src="../../public/javascripts/mylib.js"}, body)
|
46
|
+
end
|
47
|
+
assert_generated_file "script/rstakeout"
|
48
|
+
assert_generated_file "script/js_autotest"
|
49
|
+
assert_generated_file "config/javascript_test_autotest.yml.sample"
|
50
|
+
assert_generated_file "vendor/plugins/javascript_unittest/lib/jstest.rb"
|
51
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/runner.rake"
|
52
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/autotest.rake"
|
53
|
+
assert_generated_file "vendor/plugins/javascript_unittest/README"
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_generator_with_subfolder
|
57
|
+
name = "models/mylib"
|
58
|
+
run_generator('javascript_test', [name], sources)
|
59
|
+
assert_directory_exists "test/javascript/assets"
|
60
|
+
assert_directory_exists "test/javascript/models"
|
61
|
+
assert_directory_exists "vendor/plugins/javascript_unittest"
|
62
|
+
assert_directory_exists "script"
|
63
|
+
assert_generated_file "test/javascript/assets/jsunittest.js"
|
64
|
+
assert_generated_file "test/javascript/assets/unittest.css"
|
65
|
+
assert_generated_file "test/javascript/#{name}_test.html" do |body|
|
66
|
+
assert_match(%Q{src="../assets/jsunittest.js"}, body)
|
67
|
+
assert_match(%Q{src="../../../public/javascripts/models/mylib.js"}, body)
|
68
|
+
end
|
69
|
+
assert_generated_file "script/rstakeout"
|
70
|
+
assert_generated_file "script/js_autotest"
|
71
|
+
assert_generated_file "config/javascript_test_autotest.yml.sample"
|
72
|
+
assert_generated_file "vendor/plugins/javascript_unittest/lib/jstest.rb"
|
73
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/runner.rake"
|
74
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/autotest.rake"
|
75
|
+
assert_generated_file "vendor/plugins/javascript_unittest/README"
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_generator_with_framework_jquery
|
79
|
+
name = "mylib"
|
80
|
+
run_generator('javascript_test', [name], sources, :framework => 'jquery')
|
81
|
+
assert_directory_exists "test/javascript/assets"
|
82
|
+
assert_directory_exists "public/javascripts/ext"
|
83
|
+
assert_directory_exists "vendor/plugins/javascript_unittest"
|
84
|
+
assert_directory_exists "script"
|
85
|
+
assert_generated_file "public/javascripts/ext/jquery.js"
|
86
|
+
assert_generated_file "test/javascript/assets/jsunittest.js"
|
87
|
+
assert_generated_file "test/javascript/assets/unittest.css"
|
88
|
+
assert_generated_file "test/javascript/#{name}_test.html" do |body|
|
89
|
+
assert_match(%Q{src="assets/jsunittest.js"}, body)
|
90
|
+
assert_match(%Q{src="../../public/javascripts/ext/jquery.js"}, body)
|
91
|
+
assert_match(%Q{src="../../public/javascripts/mylib.js"}, body)
|
46
92
|
end
|
47
93
|
assert_generated_file "script/rstakeout"
|
48
94
|
assert_generated_file "script/js_autotest"
|
@@ -52,13 +98,61 @@ class TestJavascriptTestGenerator < Test::Unit::TestCase
|
|
52
98
|
assert_generated_file "vendor/plugins/javascript_unittest/tasks/autotest.rake"
|
53
99
|
assert_generated_file "vendor/plugins/javascript_unittest/README"
|
54
100
|
end
|
55
|
-
|
101
|
+
|
102
|
+
def test_generator_with_framework_prototypejs
|
103
|
+
name = "mylib"
|
104
|
+
run_generator('javascript_test', [name], sources, :framework => 'prototype')
|
105
|
+
assert_directory_exists "test/javascript/assets"
|
106
|
+
assert_directory_exists "public/javascripts/ext"
|
107
|
+
assert_directory_exists "vendor/plugins/javascript_unittest"
|
108
|
+
assert_directory_exists "script"
|
109
|
+
assert_generated_file "public/javascripts/ext/prototype.js"
|
110
|
+
assert_generated_file "test/javascript/assets/jsunittest.js"
|
111
|
+
assert_generated_file "test/javascript/assets/unittest.css"
|
112
|
+
assert_generated_file "test/javascript/#{name}_test.html" do |body|
|
113
|
+
assert_match(%Q{src="assets/jsunittest.js"}, body)
|
114
|
+
assert_match(%Q{src="../../public/javascripts/ext/prototype.js"}, body)
|
115
|
+
assert_match(%Q{src="../../public/javascripts/mylib.js"}, body)
|
116
|
+
end
|
117
|
+
assert_generated_file "script/rstakeout"
|
118
|
+
assert_generated_file "script/js_autotest"
|
119
|
+
assert_generated_file "config/javascript_test_autotest.yml.sample"
|
120
|
+
assert_generated_file "vendor/plugins/javascript_unittest/lib/jstest.rb"
|
121
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/runner.rake"
|
122
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/autotest.rake"
|
123
|
+
assert_generated_file "vendor/plugins/javascript_unittest/README"
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_generator_and_library
|
127
|
+
name = "mylib"
|
128
|
+
run_generator('javascript_test', [name], sources, :library => true)
|
129
|
+
assert_directory_exists "test/javascript/assets"
|
130
|
+
assert_directory_exists "vendor/plugins/javascript_unittest"
|
131
|
+
assert_directory_exists "script"
|
132
|
+
assert_generated_file "public/javascripts/mylib.js" do |body|
|
133
|
+
assert_match("var Mylib = function() {", body)
|
134
|
+
end
|
135
|
+
assert_generated_file "test/javascript/assets/jsunittest.js"
|
136
|
+
assert_generated_file "test/javascript/assets/unittest.css"
|
137
|
+
assert_generated_file "test/javascript/#{name}_test.html" do |body|
|
138
|
+
assert_match(%Q{src="assets/jsunittest.js"}, body)
|
139
|
+
assert_match(%Q{src="../../public/javascripts/mylib.js"}, body)
|
140
|
+
end
|
141
|
+
assert_generated_file "script/rstakeout"
|
142
|
+
assert_generated_file "script/js_autotest"
|
143
|
+
assert_generated_file "config/javascript_test_autotest.yml.sample"
|
144
|
+
assert_generated_file "vendor/plugins/javascript_unittest/lib/jstest.rb"
|
145
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/runner.rake"
|
146
|
+
assert_generated_file "vendor/plugins/javascript_unittest/tasks/autotest.rake"
|
147
|
+
assert_generated_file "vendor/plugins/javascript_unittest/README"
|
148
|
+
end
|
149
|
+
|
56
150
|
private
|
57
151
|
def sources
|
58
152
|
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
59
153
|
]
|
60
154
|
end
|
61
|
-
|
155
|
+
|
62
156
|
def generator_path
|
63
157
|
"rails_generators"
|
64
158
|
end
|
data/website/index.html
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
<h1>JavaScript Project Generator</h1>
|
32
32
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/newjs"; return false'>
|
33
33
|
<p>Get Version</p>
|
34
|
-
<a href="http://rubyforge.org/projects/newjs" class="numbers">1.
|
34
|
+
<a href="http://rubyforge.org/projects/newjs" class="numbers">1.4.0</a>
|
35
35
|
</div>
|
36
36
|
<h1>→ ‘newjs’</h1>
|
37
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-03
|
12
|
+
date: 2008-05-03 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 1.2.2
|
50
50
|
version:
|
51
|
-
description:
|
51
|
+
description: = New JavaScript Generator - newjs * http://newjs.rubyforge.org == Description
|
52
52
|
email:
|
53
53
|
- drnicwilliams@gmail.com
|
54
54
|
executables:
|
@@ -106,7 +106,6 @@ files:
|
|
106
106
|
- lib/newjs/jstest.rb
|
107
107
|
- lib/newjs/rubyforge.rb
|
108
108
|
- lib/newjs/version.rb
|
109
|
-
- log/debug.log
|
110
109
|
- newjs_generators/install_website/USAGE
|
111
110
|
- newjs_generators/install_website/install_website_generator.rb
|
112
111
|
- newjs_generators/install_website/templates/config/website.yml.sample.erb
|
@@ -125,6 +124,9 @@ files:
|
|
125
124
|
- rails_generators/javascript_test/templates/assets/jsunittest.js
|
126
125
|
- rails_generators/javascript_test/templates/assets/unittest.css
|
127
126
|
- rails_generators/javascript_test/templates/config/javascript_test_autotest.yml.sample
|
127
|
+
- rails_generators/javascript_test/templates/ext/jquery.js
|
128
|
+
- rails_generators/javascript_test/templates/ext/prototype.js
|
129
|
+
- rails_generators/javascript_test/templates/library.js.erb
|
128
130
|
- rails_generators/javascript_test/templates/plugins/javascript_unittest/README
|
129
131
|
- rails_generators/javascript_test/templates/plugins/javascript_unittest/lib/autotest/javascript_test_autotest.rb
|
130
132
|
- rails_generators/javascript_test/templates/plugins/javascript_unittest/lib/autotest/javascript_test_autotest/config.rb
|
@@ -180,10 +182,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
182
|
requirements: []
|
181
183
|
|
182
184
|
rubyforge_project: newjs
|
183
|
-
rubygems_version: 1.
|
185
|
+
rubygems_version: 1.1.1
|
184
186
|
signing_key:
|
185
187
|
specification_version: 2
|
186
|
-
summary:
|
188
|
+
summary: = New JavaScript Generator - newjs
|
187
189
|
test_files:
|
188
190
|
- test/test_functional_test_generator.rb
|
189
191
|
- test/test_generator_helper.rb
|
data/log/debug.log
DELETED
File without changes
|