newjs 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,4 +1,15 @@
1
- == 1.4.1 2008-06-21
1
+ == 1.5.0 2008-10-05
2
+
3
+ * newjs_iphone: installs variant of newjs in Html/ subfolder of an Xcode project
4
+ This includes Html/Rakefile, Html/script/generate etc.
5
+ It is still a work in progress, e.g. do we need specific generators etc.
6
+ * Update jsunittest files for 0.7.2
7
+
8
+ == 1.4.2 2008-07-08
9
+
10
+ * Updated the gem dependencies
11
+
12
+ == 1.4.1 2008-07-08
2
13
 
3
14
  * rstakeout: fixed !# ruby
4
15
  * newjs: creates src/proj_name.js.erb to show its a template, not a js file
@@ -1,4 +1,4 @@
1
- /* Jsunittest, version 0.6.3
1
+ /* Jsunittest, version 0.7.2
2
2
  * (c) 2008 Dr Nic Williams
3
3
  *
4
4
  * Jsunittest is freely distributable under
@@ -199,7 +199,7 @@ JsUnitTest.gsub.prepareReplacement = function(replacement) {
199
199
  return function(match) { return template.evaluate(match) };
200
200
  };
201
201
 
202
- JsUnitTest.Version = '0.6.3';
202
+ JsUnitTest.Version = '0.7.2';
203
203
 
204
204
  JsUnitTest.Template = function(template, pattern) {
205
205
  this.template = template; //template.toString();
@@ -441,7 +441,7 @@ JsUnitTest.ajax = function( options ) {
441
441
  };
442
442
 
443
443
  // Create the request object
444
- var xml = new XMLHttpRequest();
444
+ var xml = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
445
445
 
446
446
  // Open the asynchronous POST request
447
447
  xml.open(options.type, options.url, true);
@@ -529,7 +529,7 @@ JsUnitTest.ajax = function( options ) {
529
529
  return data;
530
530
  }
531
531
 
532
- }
532
+ };
533
533
  JsUnitTest.Unit.Assertions = {
534
534
  buildMessage: function(message, template) {
535
535
  var args = JsUnitTest.arrayfromargs(arguments).slice(2);
@@ -675,7 +675,16 @@ JsUnitTest.Unit.Assertions = {
675
675
  this.assertBlock(message, function() { return !(new RegExp(expected).exec(actual)) });
676
676
  },
677
677
 
678
+ assertHasClass: function(element, klass, message) {
679
+ element = JsUnitTest.$(element);
680
+ message = this.buildMessage(message || 'assertHasClass', '? doesn\'t have class <?>.', element, klass);
681
+ this.assertBlock(message, function() {
682
+ return !!element.className.match(new RegExp(klass))
683
+ });
684
+ },
685
+
678
686
  assertHidden: function(element, message) {
687
+ element = JsUnitTest.$(element);
679
688
  message = this.buildMessage(message || 'assertHidden', '? isn\'t hidden.', element);
680
689
  this.assertBlock(message, function() { return !element.style.display || element.style.display == 'none' });
681
690
  },
@@ -822,7 +831,8 @@ JsUnitTest.Unit.Runner.prototype.getResult = function() {
822
831
  tests: this.tests.length,
823
832
  assertions: 0,
824
833
  failures: 0,
825
- errors: 0
834
+ errors: 0,
835
+ warnings: 0
826
836
  };
827
837
 
828
838
  for (var i=0; i < this.tests.length; i++) {
@@ -830,6 +840,7 @@ JsUnitTest.Unit.Runner.prototype.getResult = function() {
830
840
  results.assertions += test.assertions;
831
841
  results.failures += test.failures;
832
842
  results.errors += test.errors;
843
+ results.warnings += test.warnings;
833
844
  };
834
845
  return results;
835
846
  };
@@ -840,7 +851,9 @@ JsUnitTest.Unit.Runner.prototype.postResults = function() {
840
851
  // { method: 'get', parameters: this.getResult(), asynchronous: false });
841
852
  var results = this.getResult();
842
853
  var url = this.options.resultsURL + "?";
854
+ url += "tests="+ this.tests.length + "&";
843
855
  url += "assertions="+ results.assertions + "&";
856
+ url += "warnings=" + results.warnings + "&";
844
857
  url += "failures=" + results.failures + "&";
845
858
  url += "errors=" + results.errors;
846
859
  JsUnitTest.ajax({
@@ -879,7 +892,7 @@ JsUnitTest.Unit.Runner.prototype.finish = function() {
879
892
  };
880
893
 
881
894
  JsUnitTest.Unit.Runner.prototype.summary = function() {
882
- return new JsUnitTest.Template('#{tests} tests, #{assertions} assertions, #{failures} failures, #{errors} errors').evaluate(this.getResult());
895
+ return new JsUnitTest.Template('#{tests} tests, #{assertions} assertions, #{failures} failures, #{errors} errors, #{warnings} warnings').evaluate(this.getResult());
883
896
  };
884
897
  JsUnitTest.Unit.Testcase = function(name, test, setup, teardown) {
885
898
  this.name = name;
@@ -895,14 +908,16 @@ for (method in JsUnitTest.Unit.Assertions) {
895
908
  JsUnitTest.Unit.Testcase.prototype[method] = JsUnitTest.Unit.Assertions[method];
896
909
  }
897
910
 
898
- JsUnitTest.Unit.Testcase.prototype.isWaiting = false;
899
- JsUnitTest.Unit.Testcase.prototype.timeToWait = 1000;
900
- JsUnitTest.Unit.Testcase.prototype.assertions = 0;
901
- JsUnitTest.Unit.Testcase.prototype.failures = 0;
902
- JsUnitTest.Unit.Testcase.prototype.errors = 0;
903
- // JsUnitTest.Unit.Testcase.prototype.isRunningFromRake = window.location.port == 4711;
911
+ JsUnitTest.Unit.Testcase.prototype.isWaiting = false;
912
+ JsUnitTest.Unit.Testcase.prototype.timeToWait = 1000;
913
+ JsUnitTest.Unit.Testcase.prototype.assertions = 0;
914
+ JsUnitTest.Unit.Testcase.prototype.failures = 0;
915
+ JsUnitTest.Unit.Testcase.prototype.errors = 0;
916
+ JsUnitTest.Unit.Testcase.prototype.warnings = 0;
904
917
  JsUnitTest.Unit.Testcase.prototype.isRunningFromRake = window.location.port;
905
918
 
919
+ // JsUnitTest.Unit.Testcase.prototype.isRunningFromRake = window.location.port == 4711;
920
+
906
921
  JsUnitTest.Unit.Testcase.prototype.wait = function(time, nextPart) {
907
922
  this.isWaiting = true;
908
923
  this.test = nextPart;
@@ -928,7 +943,7 @@ JsUnitTest.Unit.Testcase.prototype.run = function(rethrow) {
928
943
  };
929
944
 
930
945
  JsUnitTest.Unit.Testcase.prototype.summary = function() {
931
- var msg = '#{assertions} assertions, #{failures} failures, #{errors} errors\n';
946
+ var msg = '#{assertions} assertions, #{failures} failures, #{errors} errors, #{warnings} warnings\n';
932
947
  return new JsUnitTest.Template(msg).evaluate(this) +
933
948
  this.messages.join("\n");
934
949
  };
@@ -948,6 +963,18 @@ JsUnitTest.Unit.Testcase.prototype.fail = function(message) {
948
963
  this.messages.push("Failure: " + message + (line ? " Line #" + line : ""));
949
964
  };
950
965
 
966
+ JsUnitTest.Unit.Testcase.prototype.warning = function(message) {
967
+ this.warnings++;
968
+ var line = "";
969
+ try {
970
+ throw new Error("stack");
971
+ } catch(e){
972
+ line = (/\.html:(\d+)/.exec(e.stack || '') || ['',''])[1];
973
+ }
974
+ this.messages.push("Warning: " + message + (line ? " Line #" + line : ""));
975
+ };
976
+ JsUnitTest.Unit.Testcase.prototype.warn = JsUnitTest.Unit.Testcase.prototype.warning;
977
+
951
978
  JsUnitTest.Unit.Testcase.prototype.info = function(message) {
952
979
  this.messages.push("Info: " + message);
953
980
  };
@@ -961,6 +988,7 @@ JsUnitTest.Unit.Testcase.prototype.error = function(error, test) {
961
988
  JsUnitTest.Unit.Testcase.prototype.status = function() {
962
989
  if (this.failures > 0) return 'failed';
963
990
  if (this.errors > 0) return 'error';
991
+ if (this.warnings > 0) return 'warning';
964
992
  return 'passed';
965
993
  };
966
994
 
@@ -40,6 +40,10 @@ body {
40
40
  background-color: #fcc;
41
41
  }
42
42
 
43
+ .logtable .warning {
44
+ background-color: #FC6;
45
+ }
46
+
43
47
  .logtable td div.action_buttons {
44
48
  display: inline;
45
49
  }
data/config/hoe.rb CHANGED
@@ -58,11 +58,11 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
58
58
  # == Optional
59
59
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
60
60
  p.extra_deps = [
61
- ['hoe', '>=1.5.0'],
62
- ['RedCloth','>=3.0.4'],
63
- ['syntax','>=1.0.0'],
64
- ['activesupport','>=2.0.2'],
65
- ['rubigen','>=1.2.2']
61
+ # ['hoe', '>=1.7.0'],
62
+ # ['RedCloth'],
63
+ # ['syntax','>=1.0.0'],
64
+ # # ['activesupport'],
65
+ # ['rubigen','>=1.3.2']
66
66
  ]
67
67
 
68
68
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
data/lib/newjs/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Newjs #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 4
5
- TINY = 1
4
+ MINOR = 5
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,4 +1,4 @@
1
- /* Jsunittest, version 0.6.3
1
+ /* Jsunittest, version 0.7.2
2
2
  * (c) 2008 Dr Nic Williams
3
3
  *
4
4
  * Jsunittest is freely distributable under
@@ -199,7 +199,7 @@ JsUnitTest.gsub.prepareReplacement = function(replacement) {
199
199
  return function(match) { return template.evaluate(match) };
200
200
  };
201
201
 
202
- JsUnitTest.Version = '0.6.3';
202
+ JsUnitTest.Version = '0.7.2';
203
203
 
204
204
  JsUnitTest.Template = function(template, pattern) {
205
205
  this.template = template; //template.toString();
@@ -441,7 +441,7 @@ JsUnitTest.ajax = function( options ) {
441
441
  };
442
442
 
443
443
  // Create the request object
444
- var xml = new XMLHttpRequest();
444
+ var xml = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest();
445
445
 
446
446
  // Open the asynchronous POST request
447
447
  xml.open(options.type, options.url, true);
@@ -529,7 +529,7 @@ JsUnitTest.ajax = function( options ) {
529
529
  return data;
530
530
  }
531
531
 
532
- }
532
+ };
533
533
  JsUnitTest.Unit.Assertions = {
534
534
  buildMessage: function(message, template) {
535
535
  var args = JsUnitTest.arrayfromargs(arguments).slice(2);
@@ -675,7 +675,16 @@ JsUnitTest.Unit.Assertions = {
675
675
  this.assertBlock(message, function() { return !(new RegExp(expected).exec(actual)) });
676
676
  },
677
677
 
678
+ assertHasClass: function(element, klass, message) {
679
+ element = JsUnitTest.$(element);
680
+ message = this.buildMessage(message || 'assertHasClass', '? doesn\'t have class <?>.', element, klass);
681
+ this.assertBlock(message, function() {
682
+ return !!element.className.match(new RegExp(klass))
683
+ });
684
+ },
685
+
678
686
  assertHidden: function(element, message) {
687
+ element = JsUnitTest.$(element);
679
688
  message = this.buildMessage(message || 'assertHidden', '? isn\'t hidden.', element);
680
689
  this.assertBlock(message, function() { return !element.style.display || element.style.display == 'none' });
681
690
  },
@@ -822,7 +831,8 @@ JsUnitTest.Unit.Runner.prototype.getResult = function() {
822
831
  tests: this.tests.length,
823
832
  assertions: 0,
824
833
  failures: 0,
825
- errors: 0
834
+ errors: 0,
835
+ warnings: 0
826
836
  };
827
837
 
828
838
  for (var i=0; i < this.tests.length; i++) {
@@ -830,6 +840,7 @@ JsUnitTest.Unit.Runner.prototype.getResult = function() {
830
840
  results.assertions += test.assertions;
831
841
  results.failures += test.failures;
832
842
  results.errors += test.errors;
843
+ results.warnings += test.warnings;
833
844
  };
834
845
  return results;
835
846
  };
@@ -840,7 +851,9 @@ JsUnitTest.Unit.Runner.prototype.postResults = function() {
840
851
  // { method: 'get', parameters: this.getResult(), asynchronous: false });
841
852
  var results = this.getResult();
842
853
  var url = this.options.resultsURL + "?";
854
+ url += "tests="+ this.tests.length + "&";
843
855
  url += "assertions="+ results.assertions + "&";
856
+ url += "warnings=" + results.warnings + "&";
844
857
  url += "failures=" + results.failures + "&";
845
858
  url += "errors=" + results.errors;
846
859
  JsUnitTest.ajax({
@@ -879,7 +892,7 @@ JsUnitTest.Unit.Runner.prototype.finish = function() {
879
892
  };
880
893
 
881
894
  JsUnitTest.Unit.Runner.prototype.summary = function() {
882
- return new JsUnitTest.Template('#{tests} tests, #{assertions} assertions, #{failures} failures, #{errors} errors').evaluate(this.getResult());
895
+ return new JsUnitTest.Template('#{tests} tests, #{assertions} assertions, #{failures} failures, #{errors} errors, #{warnings} warnings').evaluate(this.getResult());
883
896
  };
884
897
  JsUnitTest.Unit.Testcase = function(name, test, setup, teardown) {
885
898
  this.name = name;
@@ -895,14 +908,16 @@ for (method in JsUnitTest.Unit.Assertions) {
895
908
  JsUnitTest.Unit.Testcase.prototype[method] = JsUnitTest.Unit.Assertions[method];
896
909
  }
897
910
 
898
- JsUnitTest.Unit.Testcase.prototype.isWaiting = false;
899
- JsUnitTest.Unit.Testcase.prototype.timeToWait = 1000;
900
- JsUnitTest.Unit.Testcase.prototype.assertions = 0;
901
- JsUnitTest.Unit.Testcase.prototype.failures = 0;
902
- JsUnitTest.Unit.Testcase.prototype.errors = 0;
903
- // JsUnitTest.Unit.Testcase.prototype.isRunningFromRake = window.location.port == 4711;
911
+ JsUnitTest.Unit.Testcase.prototype.isWaiting = false;
912
+ JsUnitTest.Unit.Testcase.prototype.timeToWait = 1000;
913
+ JsUnitTest.Unit.Testcase.prototype.assertions = 0;
914
+ JsUnitTest.Unit.Testcase.prototype.failures = 0;
915
+ JsUnitTest.Unit.Testcase.prototype.errors = 0;
916
+ JsUnitTest.Unit.Testcase.prototype.warnings = 0;
904
917
  JsUnitTest.Unit.Testcase.prototype.isRunningFromRake = window.location.port;
905
918
 
919
+ // JsUnitTest.Unit.Testcase.prototype.isRunningFromRake = window.location.port == 4711;
920
+
906
921
  JsUnitTest.Unit.Testcase.prototype.wait = function(time, nextPart) {
907
922
  this.isWaiting = true;
908
923
  this.test = nextPart;
@@ -928,7 +943,7 @@ JsUnitTest.Unit.Testcase.prototype.run = function(rethrow) {
928
943
  };
929
944
 
930
945
  JsUnitTest.Unit.Testcase.prototype.summary = function() {
931
- var msg = '#{assertions} assertions, #{failures} failures, #{errors} errors\n';
946
+ var msg = '#{assertions} assertions, #{failures} failures, #{errors} errors, #{warnings} warnings\n';
932
947
  return new JsUnitTest.Template(msg).evaluate(this) +
933
948
  this.messages.join("\n");
934
949
  };
@@ -948,6 +963,18 @@ JsUnitTest.Unit.Testcase.prototype.fail = function(message) {
948
963
  this.messages.push("Failure: " + message + (line ? " Line #" + line : ""));
949
964
  };
950
965
 
966
+ JsUnitTest.Unit.Testcase.prototype.warning = function(message) {
967
+ this.warnings++;
968
+ var line = "";
969
+ try {
970
+ throw new Error("stack");
971
+ } catch(e){
972
+ line = (/\.html:(\d+)/.exec(e.stack || '') || ['',''])[1];
973
+ }
974
+ this.messages.push("Warning: " + message + (line ? " Line #" + line : ""));
975
+ };
976
+ JsUnitTest.Unit.Testcase.prototype.warn = JsUnitTest.Unit.Testcase.prototype.warning;
977
+
951
978
  JsUnitTest.Unit.Testcase.prototype.info = function(message) {
952
979
  this.messages.push("Info: " + message);
953
980
  };
@@ -961,6 +988,7 @@ JsUnitTest.Unit.Testcase.prototype.error = function(error, test) {
961
988
  JsUnitTest.Unit.Testcase.prototype.status = function() {
962
989
  if (this.failures > 0) return 'failed';
963
990
  if (this.errors > 0) return 'error';
991
+ if (this.warnings > 0) return 'warning';
964
992
  return 'passed';
965
993
  };
966
994
 
@@ -40,6 +40,10 @@ body {
40
40
  background-color: #fcc;
41
41
  }
42
42
 
43
+ .logtable .warning {
44
+ background-color: #FC6;
45
+ }
46
+
43
47
  .logtable td div.action_buttons {
44
48
  display: inline;
45
49
  }
@@ -0,0 +1,58 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestNewjsIphoneGenerator < Test::Unit::TestCase
4
+ include RubiGen::GeneratorTestHelper
5
+
6
+ def setup
7
+ bare_setup
8
+ end
9
+
10
+ def teardown
11
+ bare_teardown
12
+ end
13
+
14
+ # Some generator-related assertions:
15
+ # assert_generated_file(name, &block) # block passed the file contents
16
+ # assert_directory_exists(name)
17
+ # assert_generated_class(name, &block)
18
+ # assert_generated_module(name, &block)
19
+ # assert_generated_test_for(name, &block)
20
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
21
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
22
+ #
23
+ # Other helper methods are:
24
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
26
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27
+
28
+ def test_generator_without_options
29
+ run_generator('newjs_iphone', [APP_ROOT], sources)
30
+ assert_directory_exists "Html"
31
+ assert_directory_exists "Html/lib"
32
+ assert_directory_exists "Html/config"
33
+ assert_directory_exists "Html/src"
34
+ assert_directory_exists "Html/script"
35
+ assert_directory_exists "Html/tasks"
36
+ assert_directory_exists "Html/test/assets"
37
+ assert_generated_file "Html/test/assets/unittest.css"
38
+ assert_generated_file "Html/test/assets/jsunittest.js"
39
+ assert_generated_file "Html/Rakefile"
40
+ assert_generated_file "Html/script/rstakeout"
41
+ assert_generated_file "Html/script/js_autotest"
42
+ assert_generated_file "Html/tasks/javascript_test_autotest_tasks.rake"
43
+ assert_generated_file "Html/config/javascript_test_autotest.yml.sample"
44
+ assert_generated_file "Html/src/myproject.js.erb"
45
+ assert_generated_file "Html/lib/protodoc.rb"
46
+ assert_generated_file "Html/lib/jstest.rb"
47
+ end
48
+
49
+ private
50
+ def sources
51
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
52
+ ]
53
+ end
54
+
55
+ def generator_path
56
+ "app_generators"
57
+ end
58
+ end
data/website/index.html CHANGED
@@ -31,57 +31,32 @@
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.4.1</a>
34
+ <a href="http://rubyforge.org/projects/newjs" class="numbers">1.5.0</a>
35
35
  </div>
36
- <h1>&#x2192; &#8216;newjs&#8217;</h1>
37
-
38
-
39
- <h2>What</h2>
40
-
41
-
42
- <p>A simple command-line tool to create the folders and helper files
43
- for a new JavaScript project/library. As a bonus, you can quickly
36
+ <h1>&amp;#x2192; &#8216;newjs&#8217;</h1>
37
+ <h2>What</h2>
38
+ <p>A simple command-line tool to create the folders and helper files<br />
39
+ for a new JavaScript project/library. As a bonus, you can quickly<br />
44
40
  create a website to promote your project.</p>
45
-
46
-
47
- <p>When you start a new JavaScript library, how do you layout the source files,
48
- the tests, the distribution files? Do you have support scripts to
49
- generate distributions from source files? Run your JavaScript unit tests?
41
+ <p>When you start a new JavaScript library, how do you layout the source files,<br />
42
+ the tests, the distribution files? Do you have support scripts to<br />
43
+ generate distributions from source files? Run your JavaScript unit tests?<br />
50
44
  Generators to create new unit test <span class="caps">HTML</span> files?</p>
51
-
52
-
53
- <p><strong>No? Me neither</strong>, so I created the JavaScript Project Generator.</p>
54
-
55
-
56
- <p>Once <code>newjs</code> has finished helping you write your source libraries,
57
- write test <span class="caps">HTML</span> files, providing autotesting scripts to make <span class="caps">TDD</span> a piece of cake,
58
- it finally helps you bundle all your source files into a single JavaScript file
45
+ <p><strong>No? Me neither</strong>, so I created the JavaScript Project Generator.</p>
46
+ <p>Once <code>newjs</code> has finished helping you write your source libraries,<br />
47
+ write test <span class="caps">HTML</span> files, providing autotesting scripts to make <span class="caps">TDD</span> a piece of cake,<br />
48
+ it finally helps you bundle all your source files into a single JavaScript file<br />
59
49
  for distribution.</p>
60
-
61
-
62
- <p>What a nice helpful tool it is!</p>
63
-
64
-
65
- <h2>Installing</h2>
66
-
67
-
68
- <p>Installation and maintenance of generated JavaScript projects
50
+ <p>What a nice helpful tool it is!</p>
51
+ <h2>Installing</h2>
52
+ <p>Installation and maintenance of generated JavaScript projects<br />
69
53
  requires the installation of <a href="http://www.ruby-lang.org/">Ruby</a> and <a href="http://rubygems.org/">RubyGems</a>.</p>
70
-
71
-
72
- <p>The command-line application <code>newjs</code> is installed as below,
54
+ <p>The command-line application <code>newjs</code> is installed as below, <br />
73
55
  for any operating system (except the &#8216;sudo&#8217; part &#8211; use as necessary):</p>
74
-
75
-
76
56
  <pre>sudo gem install newjs</pre>
77
-
78
- <h2>Getting started</h2>
79
-
80
-
81
- <p>To kick-off your new project/library, run the command-line app <code>newjs</code>:</p>
82
-
83
-
84
- <pre>$ newjs mylib -a "Dr Nic" -e "drnicwilliams@gmail.com" -u "http://mylib.rubyforge.org"
57
+ <h2>Getting started</h2>
58
+ <p>To kick-off your new project/library, run the command-line app <code>newjs</code>:</p>
59
+ <pre>$ newjs mylib -a "Dr Nic" -e "drnicwilliams@gmail.com" -u "http://mylib.rubyforge.org"
85
60
  create config
86
61
  create lib
87
62
  create src
@@ -110,310 +85,156 @@ for any operating system (except the &#8216;sudo&#8217; part &#8211; use as nece
110
85
  create script/generate
111
86
  create script/destroy
112
87
  </pre>
113
-
114
- <p>Look at all that!</p>
115
-
116
-
117
- <p>Unit testing uses the <code>unittest.js</code> library
118
- developed within <a href="http://www.prototypejs.org/">prototypejs</a>. It should
88
+ <p>Look at all that!</p>
89
+ <p>Unit testing uses the <code>unittest.js</code> library <br />
90
+ developed within <a href="http://www.prototypejs.org/">prototypejs</a>. It should<br />
119
91
  also support JavaScript development using any non-prototype.js libraries.</p>
120
-
121
-
122
- <p>Your raw, unconcatenated library/source files go in <code>src/</code></p>
123
-
124
-
125
- <p>Your unit test <span class="caps">HTML</span> files, go in <code>test/unit/</code> (see test generator below).</p>
126
-
127
-
128
- <p>Your functional test <span class="caps">HTML</span> files, go in <code>test/functional/</code> (see test generator below).</p>
129
-
130
-
131
- When you&#8217;ve got a new version to release, edit <code>Rakefile</code> and modify the
132
- <code>APP_VERSION</code> string (see Distribution section below).
133
-
134
- <p>To merge your <code>src/</code> files into a distribution file, see below.</p>
135
-
136
-
137
- <h2>Unit testing</h2>
138
-
139
-
140
- <p>If you are going to have a <code>src/some_lib.js</code> file, then you&#8217;ll want a unit
92
+ <p>Your raw, unconcatenated library/source files go in <code>src/</code></p>
93
+ <p>Your unit test <span class="caps">HTML</span> files, go in <code>test/unit/</code> (see test generator below).</p>
94
+ <p>Your functional test <span class="caps">HTML</span> files, go in <code>test/functional/</code> (see test generator below).</p>
95
+ <p>When you&#8217;ve got a new version to release, edit <code>Rakefile</code> and modify the<br />
96
+ <code>APP_VERSION</code> string (see Distribution section below).</p>
97
+ <p>To merge your <code>src/</code> files into a distribution file, see below.</p>
98
+ <h2>Unit testing</h2>
99
+ <p>If you are going to have a <code>src/some_lib.js</code> file, then you&#8217;ll want a unit<br />
141
100
  test file(s). By default you&#8217;d call it <code>test/some_lib_test.html</code>.</p>
142
-
143
-
144
- <h3>Generating test <span class="caps">HTML</span> files</h3>
145
-
146
-
147
- <p>And then what? Personally, I can never remember what basic <span class="caps">HTML </span>+ JavaScript
148
- goes in the test <span class="caps">HTML</span> files. I quite like the <a href="http://drnicwilliams.com/2008/01/04/autotesting-javascript-in-rails/">javascript_test plugin</a> for <a href="http://www.rubyonrails.org/">Ruby
149
- on Rails</a>, which allows you to generate a
150
- test <span class="caps">HTML</span> stub. So I&#8217;ve included a version of it
151
- here. That is, your JavaScript project comes with a generator to create new
101
+ <h3>Generating test <span class="caps">HTML</span> files</h3>
102
+ <p>And then what? Personally, I can never remember what basic <span class="caps">HTML</span> + JavaScript<br />
103
+ goes in the test <span class="caps">HTML</span> files. I quite like the <a href="http://drnicwilliams.com/2008/01/04/autotesting-javascript-in-rails/">javascript_test plugin</a> for <a href="http://www.rubyonrails.org/">Ruby <br />
104
+ on Rails</a>, which allows you to generate a<br />
105
+ test <span class="caps">HTML</span> stub. So I&#8217;ve included a version of it<br />
106
+ here. That is, your JavaScript project comes with a generator to create new<br />
152
107
  test <span class="caps">HTML</span> files, ready to rock and roll.</p>
153
-
154
-
155
108
  <pre>$ script/generate unit_test some_lib
156
109
  create test/unit
157
110
  create test/unit/some_lib_test.html</pre>
158
-
159
- <p>Now edit <code>test/unit/some_lib_test.html</code> and follow the comments
111
+ <p>Now edit <code>test/unit/some_lib_test.html</code> and follow the comments<br />
160
112
  that tell you what to do to write your unit tests.</p>
161
-
162
-
163
- <p>Want to name your test file something different? Specify the target
113
+ <p>Want to name your test file something different? Specify the target<br />
164
114
  library as an additional parameter.</p>
165
-
166
-
167
115
  <pre>$ script/generate unit_test my_library_tests some_lib
168
116
  exists test/unit
169
117
  create test/unit/my_library_tests_test.html</pre>
170
-
171
- <h3>Running unit tests</h3>
172
-
173
-
174
- <p>Each test <span class="caps">HTML</span> file should be self-executable: just open it in a target
175
- browser. That is, to run the <code>test/some_lib_test.html</code> tests
118
+ <h3>Running unit tests</h3>
119
+ <p>Each test <span class="caps">HTML</span> file should be self-executable: just open it in a target<br />
120
+ browser. That is, to run the <code>test/some_lib_test.html</code> tests<br />
176
121
  in Firefox, open the file in Firefox.</p>
177
-
178
-
179
- <p>It will print out a beautiful log success/error messages for each test.</p>
180
-
181
-
182
- <p><img src="images/example-unittest-log.jpg" width="647" height="427" alt="Example Unittest Log"></p>
183
-
184
-
185
- <h2>Functional tests</h2>
186
-
187
-
188
- <p>End-to-end functional tests will test the final distribution file(s), rather than
122
+ <p>It will print out a beautiful log success/error messages for each test.</p>
123
+ <p><img src="images/example-unittest-log.jpg" width="647" height="427" alt="Example Unittest Log"></p>
124
+ <h2>Functional tests</h2>
125
+ <p>End-to-end functional tests will test the final distribution file(s), rather than<br />
189
126
  the <code>src/</code> files.</p>
190
-
191
-
192
- <p>As shown below, your <code>src/</code> files will be merged into (commonly) one
127
+ <p>As shown below, your <code>src/</code> files will be merged into (commonly) one <br />
193
128
  distribution file &#8211; a merging of your source files.</p>
194
-
195
-
196
- <h3>Generating test <span class="caps">HTML</span> files</h3>
197
-
198
-
199
- <p>To create functional tests, there is another generator:</p>
200
-
201
-
129
+ <h3>Generating test <span class="caps">HTML</span> files</h3>
130
+ <p>To create functional tests, there is another generator:</p>
202
131
  <pre>$ script/generate functional_test basic_usage
203
132
  create test/functional
204
133
  create test/functional/basic_usage_test.html</pre>
205
-
206
- <h3>Running functional tests</h3>
207
-
208
-
134
+ <h3>Running functional tests</h3>
209
135
  <pre>rake test_functionals</pre>
210
-
211
- <p>The generated <span class="caps">HTML</span> file uses the <code>dist/mylib.js</code> file. So, if
212
- you are running these tests it is best to use the <code>rake test_functionals</code>
136
+ <p>The generated <span class="caps">HTML</span> file uses the <code>dist/mylib.js</code> file. So, if<br />
137
+ you are running these tests it is best to use the <code>rake test_functionals</code><br />
213
138
  as it pre-builds the distribution files first.</p>
214
-
215
-
216
- <h2>Distribution of library</h2>
217
-
218
-
219
- <p>Your project comes with the ability to concatenate all your <code>src/*.js</code>
139
+ <h2>Distribution of library</h2>
140
+ <p>Your project comes with the ability to concatenate all your <code>src/*.js</code><br />
220
141
  files into a single file for distribution, as <code>dist/project_name.js</code>.</p>
221
-
222
-
223
- <p>First, edit <code>src/HEADER</code> with information that will be included
142
+ <p>First, edit <code>src/HEADER</code> with information that will be included<br />
224
143
  at the top of the generated distribution file.</p>
225
-
226
-
227
- <p>Second, edit <code>src/project_name.js</code> to include the names of
228
- all the <code>src/</code> files that will be concatenated together
144
+ <p>Second, edit <code>src/project_name.js</code> to include the names of<br />
145
+ all the <code>src/</code> files that will be concatenated together<br />
229
146
  in your required order.</p>
230
-
231
-
232
- <p>Finally, run the command:</p>
233
-
234
-
147
+ <p>Finally, run the command:</p>
235
148
  <pre>rake dist</pre>
236
-
237
- <p>Two files are added into the <code>dist/</code> folder:</p>
238
-
239
-
149
+ <p>Two files are added into the <code>dist/</code> folder:</p>
240
150
  <pre>$ ls dist/
241
151
  drnic_js_test_helpers-0.5.0.js drnic_js_test_helpers.js</pre>
242
-
243
- <p>One with a version number, and one without.</p>
244
-
245
-
246
- <h3>Upload library to rubyforge</h3>
247
-
248
-
249
- <p>Assuming you don&#8217;t really care where your package/library is uploaded
250
- and made available for downloading, <code>newjs</code> projects comes
152
+ <p>One with a version number, and one without.</p>
153
+ <h3>Upload library to rubyforge</h3>
154
+ <p>Assuming you don&#8217;t really care where your package/library is uploaded<br />
155
+ and made available for downloading, <code>newjs</code> projects comes<br />
251
156
  pre-built ready to upload them to <code>rubyforge</code>.</p>
252
-
253
-
254
- <p>First, you&#8217;ll need a rubyforge account.</p>
255
-
256
-
257
- <p>Second, create a rubyforge project. It can take 12-48hrs for confirmation
157
+ <p>First, you&#8217;ll need a rubyforge account.</p>
158
+ <p>Second, create a rubyforge project. It can take 12-48hrs for confirmation<br />
258
159
  to come back.</p>
259
-
260
-
261
- <p>Third, use the <code>rubyforge</code> command-line app to
160
+ <p>Third, use the <code>rubyforge</code> command-line app to <br />
262
161
  store your rubyforge project information locally.</p>
263
-
264
-
265
162
  <pre>$ rubyforge setup # first time only
266
163
  $ rubyforge login
267
164
  $ rubyforge config
268
165
  $ rubyforge create_package project_name project_name
269
166
  </pre>
270
-
271
- <p>Note, if you are placing your JavaScript project within an existing
272
- rubyforge project, then the two <code>project_name</code> values
167
+ <p>Note, if you are placing your JavaScript project within an existing<br />
168
+ rubyforge project, then the two <code>project_name</code> values<br />
273
169
  are different:</p>
274
-
275
-
276
- <ol>
277
- <li>The rubyforge project name (e.g. drnicutilities) </li>
278
- <li>The JavaScript project/library name (e.g. drnic_js_test_helpers)</li>
279
- </ol>
280
-
281
-
282
- <p>Finally, each time you want to release a new version of your library you do
170
+ <ol>
171
+ <li>The rubyforge project name (e.g. drnicutilities)</li>
172
+ <li>The JavaScript project/library name (e.g. drnic_js_test_helpers)</li>
173
+ </ol>
174
+ <p>Finally, each time you want to release a new version of your library you do <br />
283
175
  two things:</p>
284
-
285
-
286
- <ol>
176
+ <ol>
287
177
  <li>Update Rakefile&#8217;s <code>APP_VERSION</code> value to the new version number</li>
288
- <li>Run <code>rake release VERSION=X.Y.Z</code></li>
289
- </ol>
290
-
291
-
292
- <p>Your files are now available for download via rubyforge.org.</p>
293
-
294
-
295
- <p>If you use the generated website (below), it comes with a link to these
178
+ <li>Run <code>rake release VERSION=X.Y.Z</code></li>
179
+ </ol>
180
+ <p>Your files are now available for download via rubyforge.org.</p>
181
+ <p>If you use the generated website (below), it comes with a link to these<br />
296
182
  files when you click the large version number (e.g. &#8220;Get Version X.Y.Z&#8221;).</p>
297
-
298
-
299
- <h2>Create a website for your project</h2>
300
-
301
-
302
- <p>You can quickly create a clean, readable website for your project
303
- that prominently displays the current version number (which is a
183
+ <h2>Create a website for your project</h2>
184
+ <p>You can quickly create a clean, readable website for your project<br />
185
+ that prominently displays the current version number (which is a <br />
304
186
  clickable link through to the download page), just like this page.</p>
305
-
306
-
307
187
  <pre>script/generate install_website</pre>
308
-
309
- <p>Now edit the generated <code>website/index.txt</code> file (<a href="http://www.textism.com/tools/textile/">Textile</a> format).</p>
310
-
311
-
312
- <p>To convert it to <span class="caps">HTML</span>, run:</p>
313
-
314
-
188
+ <p>Now edit the generated <code>website/index.txt</code> file (<a href="http://www.textism.com/tools/textile/">Textile</a> format).</p>
189
+ <p>To convert it to <span class="caps">HTML</span>, run:</p>
315
190
  <pre>rake website_generate</pre>
316
-
317
- <p>And open <code>website/index.html</code> in your browser to preview.
318
- The project&#8217;s version number is automatically inserted into the page
191
+ <p>And open <code>website/index.html</code> in your browser to preview.<br />
192
+ The project&#8217;s version number is automatically inserted into the page<br />
319
193
  (change version numbers via <code>APP_VERSION</code> in <code>Rakefile</code>).</p>
320
-
321
-
322
- <h3>Configuration of website upload</h3>
323
-
324
-
325
- <p>It is assumed you will upload your website files to rubyforge.org server.
194
+ <h3>Configuration of website upload</h3>
195
+ <p>It is assumed you will upload your website files to rubyforge.org server.<br />
326
196
  To push files to an alternate server, modify the <code>tasks/website.rake</code> file.</p>
327
-
328
-
329
- <p>To configure which rubyforge project to upload to, create <code>config/website.yml</code>.
197
+ <p>To configure which rubyforge project to upload to, create <code>config/website.yml</code>.<br />
330
198
  There is an example in <code>code/website.yml.sample</code>.</p>
331
-
332
-
333
- <p>An example might be:</p>
334
-
335
-
199
+ <p>An example might be:</p>
336
200
  <pre>host: nicwilliams@rubyforge.org
337
201
  remote_dir: /var/www/gforge-projects/drnicutilities/drnic_js_test_helpers
338
202
  </pre>
339
-
340
- <p>Here, the files will be uploaded into the <code>drnicutilities</code> rubyforge
341
- project, under a sub-directory <code>drnic_js_test_helpers</code>. This site
342
- would be visible at <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers">http://drnicutilities.rubyforge.org/drnic_js_test_helpers</a></p>
343
-
344
-
345
- <p>If your website lives in its own rubyforge project, then just specify the project
203
+ <p>Here, the files will be uploaded into the <code>drnicutilities</code> rubyforge<br />
204
+ project, under a sub-directory <code>drnic_js_test_helpers</code>. This site<br />
205
+ would be visible at <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers">http://drnicutilities.rubyforge.org/drnic_js_test_helpers</a><br />
206
+ <br />
207
+ If your website lives in its own rubyforge project, then just specify the project<br />
346
208
  name, and the website will be uploaded into the root folder.</p>
347
-
348
-
349
- <p>For example, the website would be available at <a href="http://drnicutilities.rubyforge.org/">http://drnicutilities.rubyforge.org/</a> if your
209
+ <p>For example, the website would be available at <a href="http://drnicutilities.rubyforge.org/">http://drnicutilities.rubyforge.org/</a> if your<br />
350
210
  configuration was:</p>
351
-
352
-
353
211
  <pre>host: nicwilliams@rubyforge.org
354
212
  remote_dir: /var/www/gforge-projects/drnicutilities
355
213
  </pre>
356
-
357
- <h3>Uploading website to server</h3>
358
-
359
-
360
- <p>To upload the website (and its <span class="caps">CSS</span> etc) run:</p>
361
-
362
-
214
+ <h3>Uploading website to server</h3>
215
+ <p>To upload the website (and its <span class="caps">CSS</span> etc) run:</p>
363
216
  <pre>rake website_upload</pre>
364
-
365
- <p>More commonly, to generate and upload the website:</p>
366
-
367
-
217
+ <p>More commonly, to generate and upload the website:</p>
368
218
  <pre>rake website</pre>
369
-
370
- <h2>Screencast coming soon</h2>
371
-
372
-
373
- <p>A hard-core, &#8220;how to do JavaScript unit testing&#8221; screencast will
374
- soon be published by <a href="http://peepcode.com/">PeepCode</a>. It will cost $9
219
+ <h2>Screencast coming soon</h2>
220
+ <p>A hard-core, &#8220;how to do JavaScript unit testing&#8221; screencast will<br />
221
+ soon be published by <a href="http://peepcode.com/">PeepCode</a>. It will cost $9<br />
375
222
  and you&#8217;ll love every minute of it.</p>
376
-
377
-
378
- <p>Subscribe to PeepCode&#8217;s blog for announcement details.</p>
379
-
380
-
381
- <h2>Examples</h2>
382
-
383
-
384
- <p>The development of <code>newjs</code> was done in parallel with
385
- <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers/">Dr Nic&#8217;s JavaScript Test Helpers</a>
223
+ <p>Subscribe to PeepCode&#8217;s blog for announcement details.</p>
224
+ <h2>Examples</h2>
225
+ <p>The development of <code>newjs</code> was done in parallel with<br />
226
+ <a href="http://drnicutilities.rubyforge.org/drnic_js_test_helpers/">Dr Nic&#8217;s JavaScript Test Helpers</a><br />
386
227
  (source: <a href="http://github.com/drnic/drnic_js_test_helpers/tree/master">git</a>).</p>
387
-
388
-
389
- <p>Checkout this project to see examples of unit tests, configuration etc.</p>
390
-
391
-
392
- <h2>Forum</h2>
393
-
394
-
395
- <p><a href="http://groups.google.com/group/javascript-project-generator">http://groups.google.com/group/javascript-project-generator</a></p>
396
-
397
-
398
- <h2>How to submit patches</h2>
399
-
400
-
401
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
402
-
403
-
404
- <p>The source project is a <a href="http://git.or.cz/">Git</a> repository. See Dr Nic&#8217;s <a href="http://github.com/drnic/newjs/tree/master">master branch</a> for clone/checkout details.</p>
405
-
406
-
407
- <h2>License</h2>
408
-
409
-
410
- <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
411
-
412
-
413
- <h2>Contact</h2>
414
-
415
-
416
- <p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a> via the <a href="http://groups.google.com/group/javascript-project-generator">forum</a></p>
228
+ <p>Checkout this project to see examples of unit tests, configuration etc.</p>
229
+ <h2>Forum</h2>
230
+ <p><a href="http://groups.google.com/group/javascript-project-generator">http://groups.google.com/group/javascript-project-generator</a></p>
231
+ <h2>How to submit patches</h2>
232
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
233
+ <p>The source project is a <a href="http://git.or.cz/">Git</a> repository. See Dr Nic&#8217;s <a href="http://github.com/drnic/newjs/tree/master">master branch</a> for clone/checkout details.</p>
234
+ <h2>License</h2>
235
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
236
+ <h2>Contact</h2>
237
+ <p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a> via the <a href="http://groups.google.com/group/javascript-project-generator">forum</a></p>
417
238
  <p class="coda">
418
239
  <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 21st June 2008<br>
419
240
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
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.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
@@ -9,49 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-08 00:00:00 +10:00
12
+ date: 2008-10-08 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: RedCloth
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 3.0.4
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: syntax
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.0.0
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: activesupport
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 2.0.2
44
- version:
45
- - !ruby/object:Gem::Dependency
46
- name: rubigen
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 1.2.2
54
- version:
55
15
  - !ruby/object:Gem::Dependency
56
16
  name: hoe
57
17
  type: :development
@@ -196,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
156
  requirements: []
197
157
 
198
158
  rubyforge_project: newjs
199
- rubygems_version: 1.2.0
159
+ rubygems_version: 1.3.0
200
160
  signing_key:
201
161
  specification_version: 2
202
162
  summary: = New JavaScript Generator - newjs
@@ -207,5 +167,6 @@ test_files:
207
167
  - test/test_install_website_generator.rb
208
168
  - test/test_javascript_test_generator.rb
209
169
  - test/test_newjs_generator.rb
170
+ - test/test_newjs_iphone_generator.rb
210
171
  - test/test_plain_theme_generator.rb
211
172
  - test/test_unit_test_generator.rb