distil 0.10.1 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.1
1
+ 0.10.3
data/distil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{distil}
8
- s.version = "0.10.1"
8
+ s.version = "0.10.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Watkins"]
12
- s.date = %q{2010-04-01}
12
+ s.date = %q{2010-04-25}
13
13
  s.default_executable = %q{distil}
14
14
  s.description = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
15
15
  s.executables = ["distil"]
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
45
45
  "lib/tasks/test-task.rb",
46
46
  "lib/test/HtmlTestReporter.js",
47
47
  "lib/test/Test.js",
48
+ "lib/test/TestHelper.js",
48
49
  "lib/test/TestReporter.js",
49
50
  "lib/test/TestRunner.js",
50
51
  "lib/test/browser.rb",
@@ -578,7 +579,7 @@ Gem::Specification.new do |s|
578
579
  s.homepage = %q{http://code.google.com/p/distil-js/}
579
580
  s.rdoc_options = ["--charset=UTF-8"]
580
581
  s.require_paths = ["lib"]
581
- s.rubygems_version = %q{1.3.5}
582
+ s.rubygems_version = %q{1.3.6}
582
583
  s.summary = %q{A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit}
583
584
 
584
585
  if s.respond_to? :specification_version then
@@ -1,3 +1,4 @@
1
+ /*jsl:ignore*/ /**#nocode+*/
1
2
  (function() {
2
3
  var baseUrl= findScriptBaseName();
3
4
 
@@ -54,3 +55,4 @@
54
55
  @LOAD_SCRIPTS@
55
56
 
56
57
  })();
58
+ /**#nocode-*/ /*jsl:end*/
data/lib/project.rb CHANGED
@@ -155,7 +155,7 @@ class Project < Configurable
155
155
  value.is_a?(Hash) && value.has_key?("enabled") && !value["enabled"])
156
156
 
157
157
  puts
158
- puts "#{project_name} #{section}:"
158
+ puts "#{project_name}/#{section}:"
159
159
  puts
160
160
 
161
161
  task= Task.by_name(section) || Task.by_product_name(section)
data/lib/task.rb CHANGED
@@ -9,6 +9,7 @@ class Task < Configurable
9
9
 
10
10
  option :remove_prefix
11
11
  option_alias :remove_prefix, :source_folder
12
+ option :validate, true
12
13
 
13
14
  def initialize(target, settings)
14
15
  super(settings, target)
@@ -14,7 +14,6 @@ class JavascriptTask < SingleOutputTask
14
14
  option :jsdoc_plugins, "#{$vendor_dir}/jsdoc-extras/plugins"
15
15
  option :doc_folder, "doc"
16
16
  option :generate_docs, false
17
- option :generate_import, false
18
17
  option :class_list, ""
19
18
  option :class_list_template, "#{$vendor_dir}/jsdoc-extras/templates/classlist"
20
19
 
@@ -50,10 +49,6 @@ class JavascriptTask < SingleOutputTask
50
49
  end
51
50
  end
52
51
 
53
- if (generate_import)
54
- @name_import= "#{prefix}#{target_name}-import#{type}"
55
- @products << @name_import
56
- end
57
52
  end
58
53
 
59
54
  # JsTask handles files that end in .js
@@ -63,7 +58,7 @@ class JavascriptTask < SingleOutputTask
63
58
 
64
59
  def validate_files
65
60
 
66
- return if (!File.exists?($lint_command))
61
+ return if (!validate || !File.exists?($lint_command))
67
62
 
68
63
  tmp= Tempfile.new("jsl.conf")
69
64
 
@@ -193,21 +188,19 @@ class JavascriptTask < SingleOutputTask
193
188
  @debug= replace_tokens(template, {
194
189
  "LOAD_SCRIPTS" => @debug
195
190
  })
196
- end
197
191
 
198
- def finish
199
- super
200
- return if (!generate_import)
201
-
202
- File.delete(@name_import) if (File.exists?(@name_import))
203
-
204
- File.open(@name_import, "w") { |f|
205
- f.write(notice_text)
206
-
207
- @included_files.each { |inc|
208
- f.puts "/*jsl:import #{inc.relative_to_folder(output_folder)}*/"
209
- }
192
+ destination=File.expand_path(remove_prefix||"")
193
+ @included_files.each { |inc|
194
+ @debug << "/*jsl:import #{inc.relative_to_folder(destination)}*/\n"
210
195
  }
211
196
  end
197
+
198
+ def uncompressed_preamble
199
+ "/**#nocode+*/\n\n"
200
+ end
212
201
 
202
+ def uncompressed_postscript
203
+ "\n\n/**#nocode-*/"
204
+ end
205
+
213
206
  end
@@ -47,6 +47,14 @@ class SingleOutputTask < OutputTask
47
47
  @included_files.each { |f| process_file(f) }
48
48
  end
49
49
 
50
+ def uncompressed_preamble
51
+ ""
52
+ end
53
+
54
+ def uncompressed_postscript
55
+ ""
56
+ end
57
+
50
58
  def finish
51
59
  return if (!output_type)
52
60
 
@@ -66,7 +74,9 @@ class SingleOutputTask < OutputTask
66
74
 
67
75
  File.open(@name_concat, "w") { |f|
68
76
  f.write(notice_text)
77
+ f.write(uncompressed_preamble)
69
78
  f.write(concat)
79
+ f.write(uncompressed_postscript)
70
80
  }
71
81
 
72
82
  minified= minify(concat)
data/lib/test/Test.js CHANGED
@@ -1,230 +1,3 @@
1
- function TestHelper(scope, report, test, testName)
2
- {
3
- this.scope= scope;
4
- this.report= report;
5
- this.test= test;
6
- this.testName= testName;
7
- this._async= false;
8
- }
9
- TestHelper.prototype= {
10
-
11
- __ASYNC_MARKER__: 'async_marker',
12
-
13
- stringFromValue: function(v)
14
- {
15
- return String(v);
16
- },
17
-
18
- compareArrays: function(a1, a2)
19
- {
20
- if (a1.length==a2.length)
21
- {
22
- var len=a1.length;
23
- var i;
24
-
25
- for (i=0; i<len; ++i)
26
- if (a1[i]!==a2[i])
27
- return false;
28
- return true;
29
- }
30
-
31
- return false;
32
- },
33
-
34
- log: function()
35
- {
36
- this.report.log.apply(this.report, arguments);
37
- },
38
-
39
- passed: function()
40
- {
41
- if (this._finished)
42
- return;
43
-
44
- this.report.passed(this.test, this.testName);
45
- this.finishAsync();
46
- },
47
-
48
- clearTimer: function()
49
- {
50
- if (!this._timer)
51
- return;
52
- window.clearTimeout(this._timer);
53
- this._timer= 0;
54
- },
55
-
56
- finishAsync: function()
57
- {
58
- if (!this._async || this._finished)
59
- return;
60
-
61
- this._finished= true;
62
- this.clearTimer();
63
- try
64
- {
65
- if (this.teardown)
66
- this.teardown.call(this.scope);
67
- }
68
- catch (e)
69
- {
70
- this.report.exceptionInTeardown(this.test, this.testName, e);
71
- }
72
-
73
- this.report.endTest(this.test, this.testName);
74
- if (this.ontestcomplete)
75
- this.ontestcomplete();
76
- },
77
-
78
- /** Create an asynchronous handler for this method. If the test
79
- * doesn't complete before the timeout expires, then the test
80
- * fails.
81
- */
82
- async: function(timeout)
83
- {
84
- var helper= this;
85
-
86
- function timeoutFn()
87
- {
88
- helper.report.timeoutExpired(helper.test, helper.testName, timeout);
89
- helper.finishAsync();
90
- }
91
-
92
- this._timer= window.setTimeout(timeoutFn, timeout);
93
- this._async= true;
94
- return this.__ASYNC_MARKER__;
95
- },
96
-
97
- assert: function(value, msg)
98
- {
99
- this.assertTrue(value, msg);
100
- },
101
-
102
- assertEqual: function(value, expected, msg)
103
- {
104
- if ('object'===typeof(value) && 'object'===typeof(expected) &&
105
- value.splice && expected.splice)
106
- {
107
- if (this.compareArrays(value, expected))
108
- return;
109
- }
110
- else if (value===expected)
111
- return;
112
-
113
- this.fail(msg||(this.stringFromValue(value) + '===' +
114
- this.stringFromValue(expected)));
115
- },
116
-
117
- assertNotEqual: function(value, expected, msg)
118
- {
119
- if (value!==expected)
120
- return;
121
- this.fail(msg||(this.stringFromValue(value) + '!==' +
122
- this.stringFromValue(expected)));
123
- },
124
-
125
- assertTrue: function(value, msg)
126
- {
127
- if (true===value)
128
- return;
129
- this.fail(msg||(this.stringFromValue(value) + ' is not true'));
130
- },
131
-
132
- assertFalse: function(value, msg)
133
- {
134
- if (false===value)
135
- return;
136
- this.fail(msg||(this.stringFromValue(value) + ' is not false'));
137
- },
138
-
139
- assertNull: function(value, msg)
140
- {
141
- if (null===value)
142
- return;
143
- this.fail(msg||(this.stringFromValue(value) + ' is not null'));
144
- },
145
-
146
- assertNotNull: function(value, msg)
147
- {
148
- if (null!==value)
149
- return;
150
- this.fail(msg||(this.stringFromValue(value) + ' is null'));
151
- },
152
-
153
- assertUndefined: function(value, msg)
154
- {
155
- if ('undefined'===typeof(value))
156
- return;
157
- this.fail(msg||(this.stringFromValue(value) + ' is not undefined'));
158
- },
159
-
160
- assertNotUndefined: function(value, msg)
161
- {
162
- if ('undefined'!==typeof(value))
163
- return;
164
- this.fail(msg||(this.stringFromValue(value) + ' is undefined'));
165
- },
166
-
167
- assertMatch: function(regex, value, msg)
168
- {
169
- if (regex.exec(value))
170
- return;
171
- this.fail(msg||(this.stringFromValue(value) + ' did not match /' + regex.source + '/'));
172
- },
173
-
174
- assertNotMatch: function(regex, value, msg)
175
- {
176
- if (!regex.exec(value))
177
- return;
178
- this.fail(msg||(this.stringFromValue(value) + ' matched /' + regex.source + '/'));
179
- },
180
-
181
- assertInstanceOf: function(value, klass, msg)
182
- {
183
- if (value instanceof klass)
184
- return;
185
- this.fail(msg||(this.stringFromValue(value) + ' is not an instance'));
186
- },
187
-
188
- assertNotInstanceOf: function(value, klass, msg)
189
- {
190
- if (!(value instanceof klass))
191
- return;
192
- this.fail(msg||(this.stringFromValue(value) + ' is an instance'));
193
- },
194
-
195
- fail: function(msg)
196
- {
197
- if (this._finished)
198
- return;
199
-
200
- msg= msg||'failed';
201
- this.report.failed(this.test, this.testName, msg);
202
-
203
- this.finishAsync();
204
-
205
- var error= new Error(msg);
206
- error.name= 'AssertionError';
207
- throw error;
208
- },
209
-
210
- skip: function(why)
211
- {
212
- if (this._finished)
213
- return;
214
-
215
- why= why||'Test skipped';
216
- this.report.skipped(this.test, this.testName, why);
217
-
218
- this.finishAsync();
219
-
220
- var error= new Error(why);
221
- error.name= 'AssertionError';
222
- throw error;
223
- }
224
-
225
- };
226
-
227
-
228
1
  var Test= {
229
2
 
230
3
  /** Register a group of tests. This might do some clever processing of
@@ -241,6 +14,14 @@ var Test= {
241
14
  this._tests={};
242
15
  this.numberOfRegisteredTests= 0;
243
16
  },
17
+
18
+ pending: function(arg)
19
+ {
20
+ },
21
+
22
+ spec: function(name, decl)
23
+ {
24
+ },
244
25
 
245
26
  numberOfRegisteredTests: 0,
246
27
  _tests: {}
@@ -0,0 +1,225 @@
1
+ function TestHelper(scope, report, test, testName)
2
+ {
3
+ this.scope= scope;
4
+ this.report= report;
5
+ this.test= test;
6
+ this.testName= testName;
7
+ this._async= false;
8
+ }
9
+ TestHelper.prototype= {
10
+
11
+ __ASYNC_MARKER__: 'async_marker',
12
+
13
+ stringFromValue: function(v)
14
+ {
15
+ return String(v);
16
+ },
17
+
18
+ compareArrays: function(a1, a2)
19
+ {
20
+ if (a1.length==a2.length)
21
+ {
22
+ var len=a1.length;
23
+ var i;
24
+
25
+ for (i=0; i<len; ++i)
26
+ if (a1[i]!==a2[i])
27
+ return false;
28
+ return true;
29
+ }
30
+
31
+ return false;
32
+ },
33
+
34
+ log: function()
35
+ {
36
+ this.report.log.apply(this.report, arguments);
37
+ },
38
+
39
+ passed: function()
40
+ {
41
+ if (this._finished)
42
+ return;
43
+
44
+ this.report.passed(this.test, this.testName);
45
+ this.finishAsync();
46
+ },
47
+
48
+ clearTimer: function()
49
+ {
50
+ if (!this._timer)
51
+ return;
52
+ window.clearTimeout(this._timer);
53
+ this._timer= 0;
54
+ },
55
+
56
+ finishAsync: function()
57
+ {
58
+ if (!this._async || this._finished)
59
+ return;
60
+
61
+ this._finished= true;
62
+ this.clearTimer();
63
+ try
64
+ {
65
+ if (this.teardown)
66
+ this.teardown.call(this.scope);
67
+ }
68
+ catch (e)
69
+ {
70
+ this.report.exceptionInTeardown(this.test, this.testName, e);
71
+ }
72
+
73
+ this.report.endTest(this.test, this.testName);
74
+ if (this.ontestcomplete)
75
+ this.ontestcomplete();
76
+ },
77
+
78
+ /** Create an asynchronous handler for this method. If the test
79
+ * doesn't complete before the timeout expires, then the test
80
+ * fails.
81
+ */
82
+ async: function(timeout)
83
+ {
84
+ var helper= this;
85
+
86
+ function timeoutFn()
87
+ {
88
+ helper.report.timeoutExpired(helper.test, helper.testName, timeout);
89
+ helper.finishAsync();
90
+ }
91
+
92
+ this._timer= window.setTimeout(timeoutFn, timeout);
93
+ this._async= true;
94
+ return this.__ASYNC_MARKER__;
95
+ },
96
+
97
+ assert: function(value, msg)
98
+ {
99
+ this.assertTrue(value, msg);
100
+ },
101
+
102
+ assertEqual: function(value, expected, msg)
103
+ {
104
+ if ('object'===typeof(value) && 'object'===typeof(expected) &&
105
+ value.splice && expected.splice)
106
+ {
107
+ if (this.compareArrays(value, expected))
108
+ return;
109
+ }
110
+ else if (value===expected)
111
+ return;
112
+
113
+ this.fail(msg||(this.stringFromValue(value) + '===' +
114
+ this.stringFromValue(expected)));
115
+ },
116
+
117
+ assertNotEqual: function(value, expected, msg)
118
+ {
119
+ if (value!==expected)
120
+ return;
121
+ this.fail(msg||(this.stringFromValue(value) + '!==' +
122
+ this.stringFromValue(expected)));
123
+ },
124
+
125
+ assertTrue: function(value, msg)
126
+ {
127
+ if (true===value)
128
+ return;
129
+ this.fail(msg||(this.stringFromValue(value) + ' is not true'));
130
+ },
131
+
132
+ assertFalse: function(value, msg)
133
+ {
134
+ if (false===value)
135
+ return;
136
+ this.fail(msg||(this.stringFromValue(value) + ' is not false'));
137
+ },
138
+
139
+ assertNull: function(value, msg)
140
+ {
141
+ if (null===value)
142
+ return;
143
+ this.fail(msg||(this.stringFromValue(value) + ' is not null'));
144
+ },
145
+
146
+ assertNotNull: function(value, msg)
147
+ {
148
+ if (null!==value)
149
+ return;
150
+ this.fail(msg||(this.stringFromValue(value) + ' is null'));
151
+ },
152
+
153
+ assertUndefined: function(value, msg)
154
+ {
155
+ if ('undefined'===typeof(value))
156
+ return;
157
+ this.fail(msg||(this.stringFromValue(value) + ' is not undefined'));
158
+ },
159
+
160
+ assertNotUndefined: function(value, msg)
161
+ {
162
+ if ('undefined'!==typeof(value))
163
+ return;
164
+ this.fail(msg||(this.stringFromValue(value) + ' is undefined'));
165
+ },
166
+
167
+ assertMatch: function(regex, value, msg)
168
+ {
169
+ if (regex.exec(value))
170
+ return;
171
+ this.fail(msg||(this.stringFromValue(value) + ' did not match /' + regex.source + '/'));
172
+ },
173
+
174
+ assertNotMatch: function(regex, value, msg)
175
+ {
176
+ if (!regex.exec(value))
177
+ return;
178
+ this.fail(msg||(this.stringFromValue(value) + ' matched /' + regex.source + '/'));
179
+ },
180
+
181
+ assertInstanceOf: function(value, klass, msg)
182
+ {
183
+ if (value instanceof klass)
184
+ return;
185
+ this.fail(msg||(this.stringFromValue(value) + ' is not an instance'));
186
+ },
187
+
188
+ assertNotInstanceOf: function(value, klass, msg)
189
+ {
190
+ if (!(value instanceof klass))
191
+ return;
192
+ this.fail(msg||(this.stringFromValue(value) + ' is an instance'));
193
+ },
194
+
195
+ fail: function(msg)
196
+ {
197
+ if (this._finished)
198
+ return;
199
+
200
+ msg= msg||'failed';
201
+ this.report.failed(this.test, this.testName, msg);
202
+
203
+ this.finishAsync();
204
+
205
+ var error= new Error(msg);
206
+ error.name= 'AssertionError';
207
+ throw error;
208
+ },
209
+
210
+ skip: function(why)
211
+ {
212
+ if (this._finished)
213
+ return;
214
+
215
+ why= why||'Test skipped';
216
+ this.report.skipped(this.test, this.testName, why);
217
+
218
+ this.finishAsync();
219
+
220
+ var error= new Error(why);
221
+ error.name= 'AssertionError';
222
+ throw error;
223
+ }
224
+
225
+ };
@@ -2,6 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>@title@</title>
5
+ <script src="/lib/test/TestHelper.js" type="text/javascript" charset="utf-8"></script>
5
6
  <script src="/lib/test/Test.js" type="text/javascript" charset="utf-8"></script>
6
7
  @scripts@
7
8
  </head>
@@ -2,6 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Unit Tests</title>
5
+ <script src="/lib/test/TestHelper.js" type="text/javascript" charset="utf-8"></script>
5
6
  <script src="/lib/test/Test.js" type="text/javascript" charset="utf-8"></script>
6
7
  <script src="/lib/test/HtmlTestReporter.js" type="text/javascript" charset="utf-8"></script>
7
8
  <script src="/lib/test/TestRunner.js" type="text/javascript" charset="utf-8"></script>
@@ -72,8 +72,8 @@ function publish(symbolSet) {
72
72
 
73
73
  var summary= generateJsonSummary(symbols);
74
74
 
75
- // publish.classesIndex = classesTemplate.process(classes); // kept in memory
76
- publish.classesIndex = publishClassListSummary(summary); // kept in memory
75
+ publish.classesIndex = classesTemplate.process(classes); // kept in memory
76
+ // publish.classesIndex = publishClassListSummary(summary); // kept in memory
77
77
 
78
78
  var classesJson= publishJsonSummary(summary);
79
79
  IO.saveFile(publish.conf.outDir, "all-classes.json", classesJson);
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 10
8
+ - 3
9
+ version: 0.10.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - Jeff Watkins
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-01 00:00:00 -07:00
17
+ date: 2010-04-25 00:00:00 -07:00
13
18
  default_executable: distil
14
19
  dependencies: []
15
20
 
@@ -52,6 +57,7 @@ files:
52
57
  - lib/tasks/test-task.rb
53
58
  - lib/test/HtmlTestReporter.js
54
59
  - lib/test/Test.js
60
+ - lib/test/TestHelper.js
55
61
  - lib/test/TestReporter.js
56
62
  - lib/test/TestRunner.js
57
63
  - lib/test/browser.rb
@@ -594,18 +600,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
594
600
  requirements:
595
601
  - - ">="
596
602
  - !ruby/object:Gem::Version
603
+ segments:
604
+ - 0
597
605
  version: "0"
598
- version:
599
606
  required_rubygems_version: !ruby/object:Gem::Requirement
600
607
  requirements:
601
608
  - - ">="
602
609
  - !ruby/object:Gem::Version
610
+ segments:
611
+ - 0
603
612
  version: "0"
604
- version:
605
613
  requirements: []
606
614
 
607
615
  rubyforge_project:
608
- rubygems_version: 1.3.5
616
+ rubygems_version: 1.3.6
609
617
  signing_key:
610
618
  specification_version: 3
611
619
  summary: A build tool for Javascript and CSS that takes advantage of best-of-breed helper applications Javascript Lint and JSDoc Toolkit