js2 0.0.10 → 0.1.1

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.
Files changed (67) hide show
  1. data/Manifest +42 -0
  2. data/README.md +65 -0
  3. data/Rakefile +19 -35
  4. data/bin/js2 +80 -66
  5. data/config/js2.yml +2 -0
  6. data/js2.gemspec +33 -0
  7. data/lib/js2/{haml_parser.rb → parser/haml.rb} +2 -2
  8. data/lib/js2/{haml_engine.rb → parser/haml_engine.rb} +1 -1
  9. data/lib/js2/parser/lexer.rb +37 -0
  10. data/lib/js2/{parser.rb → parser/tokenizer.rb} +157 -143
  11. data/lib/js2/{replace.rb → ragel/helper.rb} +16 -5
  12. data/lib/js2/ragel/tokenizer.rl +561 -0
  13. data/lib/js2/{tokenizer.rl.erb → ragel/tokenizer.rl.erb} +12 -19
  14. data/lib/js2/standard/factory.rb +289 -0
  15. data/lib/js2/standard/node.rb +75 -0
  16. data/lib/js2/util/compilation.rb +77 -0
  17. data/lib/js2/util/config.rb +84 -0
  18. data/lib/js2/util/exec.rb +34 -0
  19. data/lib/js2/util/file_handler.rb +73 -0
  20. data/lib/js2/{js2bootstrap.js2 → util/js2bootstrap.js2} +12 -68
  21. data/lib/js2/util/processor.rb +88 -0
  22. data/lib/js2/util/rdoc.rb +35 -0
  23. data/lib/js2/{sel_decorator.rb → util/sel_decorator.rb} +11 -1
  24. data/lib/js2.rb +22 -45
  25. data/test/compiled/bar.js +3 -0
  26. data/test/compiled/basic.comp.js +31 -0
  27. data/test/compiled/basic.js +27 -0
  28. data/test/compiled/foo.js +3 -0
  29. data/test/fixtures/bar.js2 +3 -0
  30. data/test/fixtures/basic.js2 +27 -0
  31. data/test/fixtures/basic.js2.haml +4 -0
  32. data/test/fixtures/basic.js2.yml +5 -0
  33. data/test/fixtures/curry.js2 +5 -0
  34. data/test/fixtures/foo.js2 +3 -0
  35. data/test/fixtures/member.js2 +14 -0
  36. data/test/fixtures/private.js2 +5 -0
  37. data/test/fixtures/property.js2 +4 -0
  38. data/test/test_helper.rb +25 -0
  39. data/test/test_js2.rb +43 -0
  40. data/wiki/features.md +106 -0
  41. data/wiki/installation.md +53 -0
  42. metadata +89 -83
  43. data/Changelog +0 -33
  44. data/History.txt +0 -4
  45. data/Manifest.txt +0 -35
  46. data/PostInstall.txt +0 -7
  47. data/README +0 -69
  48. data/README.rdoc +0 -69
  49. data/README.txt +0 -69
  50. data/examples/js2.yml +0 -8
  51. data/examples/test.yml +0 -5
  52. data/lib/javascript/sel_marker.js2 +0 -150
  53. data/lib/javascript/test.js2 +0 -73
  54. data/lib/js2/config.rb +0 -39
  55. data/lib/js2/daemon.rb +0 -35
  56. data/lib/js2/file_handler.rb +0 -91
  57. data/lib/js2/foo.js2.haml +0 -3
  58. data/lib/js2/js2.js +0 -110
  59. data/lib/js2/processor.rb +0 -112
  60. data/lib/js2/test/selenium.rb +0 -119
  61. data/lib/js2/test/selenium_element.rb +0 -234
  62. data/lib/js2/test/selenium_helper.rb +0 -27
  63. data/lib/js2/tree.rb +0 -351
  64. data/lib/js2/universe.rb +0 -123
  65. data/lib/tasks/js2.rake +0 -9
  66. data/website/index.txt +0 -86
  67. /data/{LICENSE → lib/js2/standard/class_node.rb} +0 -0
@@ -0,0 +1,53 @@
1
+ ## Basic Installation and Usage
2
+
3
+ > gem install js2
4
+ > js2 --help
5
+ >
6
+ > js2 --out-dir=/dir/to/write/js /dir/with/js2
7
+
8
+ ## For Rails
9
+
10
+ This really depends on where you're writing your js2 files. Its recommended that you put it in app/js2, but its really up to you.
11
+
12
+ From the rails root directory
13
+
14
+ > js2 --out-dir=./public/javascripts ./app/js2
15
+
16
+ To daemonize it and have it routinely check for changes (every 0.5 secs):
17
+
18
+ > js2 -d --out-dir=./public/javascripts ./app/js2
19
+
20
+ ## Quick Tutorial
21
+
22
+ In a new directory, do this:
23
+
24
+ > mkdir js2
25
+ > mkdir js
26
+
27
+ Now create some js2 classes: vi js2/base.js2
28
+
29
+ > class My.Base {
30
+ > function sayHi () {
31
+ > alert("hi");
32
+ > }
33
+ > }
34
+
35
+ vi js2/concrete.js2
36
+
37
+ > class My.Concrete {
38
+ > function sayHello () {
39
+ > alert("hello");
40
+ > }
41
+ > }
42
+
43
+ compile:
44
+
45
+ > js2 --out-dir=./js ./js2
46
+
47
+ Be sure to include js/classes.js, js/base.js, and concrete.js (order matters as far as classes is concerned) in your browser.
48
+
49
+ Now you can run this in javascript:
50
+
51
+ > var obj = new My.Concrete();
52
+ > obj.sayHi();
53
+ > obj.sayHello();
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Jeff Su
@@ -9,116 +14,117 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-19 00:00:00 -08:00
17
+ date: 2010-04-19 00:00:00 -07:00
13
18
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: haml
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.2.6
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: RubyInline
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 3.8.3
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: hoe
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 2.3.3
44
- version:
45
- description: A cross-browser object oriented approach to javascript
46
- email:
47
- - me@jeffsu.com
19
+ dependencies: []
20
+
21
+ description: ""
22
+ email: me@jeffsu.com
48
23
  executables:
49
24
  - js2
50
25
  extensions: []
51
26
 
52
27
  extra_rdoc_files:
53
- - History.txt
54
- - Manifest.txt
55
- - PostInstall.txt
56
- - README.txt
57
- - website/index.txt
28
+ - README.md
29
+ - bin/js2
30
+ - lib/js2.rb
31
+ - lib/js2/parser/haml.rb
32
+ - lib/js2/parser/haml_engine.rb
33
+ - lib/js2/parser/lexer.rb
34
+ - lib/js2/parser/tokenizer.rb
35
+ - lib/js2/ragel/helper.rb
36
+ - lib/js2/ragel/tokenizer.rl
37
+ - lib/js2/ragel/tokenizer.rl.erb
38
+ - lib/js2/standard/class_node.rb
39
+ - lib/js2/standard/factory.rb
40
+ - lib/js2/standard/node.rb
41
+ - lib/js2/util/compilation.rb
42
+ - lib/js2/util/config.rb
43
+ - lib/js2/util/exec.rb
44
+ - lib/js2/util/file_handler.rb
45
+ - lib/js2/util/js2bootstrap.js2
46
+ - lib/js2/util/processor.rb
47
+ - lib/js2/util/rdoc.rb
48
+ - lib/js2/util/sel_decorator.rb
58
49
  files:
59
- - Changelog
60
- - History.txt
61
- - LICENSE
62
- - Manifest.txt
63
- - PostInstall.txt
64
- - README
65
- - README.txt
66
- - README.rdoc
50
+ - Manifest
51
+ - README.md
67
52
  - Rakefile
68
- - examples/js2.yml
69
- - examples/test.yml
70
- - lib/javascript/sel_marker.js2
71
- - lib/javascript/test.js2
72
- - lib/tasks/js2.rake
73
- - lib/js2.rb
74
- - lib/js2/config.rb
75
- - lib/js2/daemon.rb
76
- - lib/js2/file_handler.rb
77
- - lib/js2/foo.js2.haml
78
- - lib/js2/haml_engine.rb
79
- - lib/js2/haml_parser.rb
80
- - lib/js2/js2.js
81
- - lib/js2/js2bootstrap.js2
82
- - lib/js2/parser.rb
83
- - lib/js2/processor.rb
84
- - lib/js2/replace.rb
85
- - lib/js2/sel_decorator.rb
86
- - lib/js2/tokenizer.rl.erb
87
- - lib/js2/tree.rb
88
- - lib/js2/universe.rb
89
- - lib/js2/test/selenium.rb
90
- - lib/js2/test/selenium_element.rb
91
- - lib/js2/test/selenium_helper.rb
92
53
  - bin/js2
93
- - website/index.txt
54
+ - config/js2.yml
55
+ - js2.gemspec
56
+ - lib/js2.rb
57
+ - lib/js2/parser/haml.rb
58
+ - lib/js2/parser/haml_engine.rb
59
+ - lib/js2/parser/lexer.rb
60
+ - lib/js2/parser/tokenizer.rb
61
+ - lib/js2/ragel/helper.rb
62
+ - lib/js2/ragel/tokenizer.rl
63
+ - lib/js2/ragel/tokenizer.rl.erb
64
+ - lib/js2/standard/class_node.rb
65
+ - lib/js2/standard/factory.rb
66
+ - lib/js2/standard/node.rb
67
+ - lib/js2/util/compilation.rb
68
+ - lib/js2/util/config.rb
69
+ - lib/js2/util/exec.rb
70
+ - lib/js2/util/file_handler.rb
71
+ - lib/js2/util/js2bootstrap.js2
72
+ - lib/js2/util/processor.rb
73
+ - lib/js2/util/rdoc.rb
74
+ - lib/js2/util/sel_decorator.rb
75
+ - test/compiled/bar.js
76
+ - test/compiled/basic.comp.js
77
+ - test/compiled/basic.js
78
+ - test/compiled/foo.js
79
+ - test/fixtures/bar.js2
80
+ - test/fixtures/basic.js2
81
+ - test/fixtures/basic.js2.haml
82
+ - test/fixtures/basic.js2.yml
83
+ - test/fixtures/curry.js2
84
+ - test/fixtures/foo.js2
85
+ - test/fixtures/member.js2
86
+ - test/fixtures/private.js2
87
+ - test/fixtures/property.js2
88
+ - test/test_helper.rb
89
+ - test/test_js2.rb
90
+ - wiki/features.md
91
+ - wiki/installation.md
94
92
  has_rdoc: true
95
- homepage: http://code.google.com/p/js2lang
93
+ homepage: http://github.com/jeffsu/js2
96
94
  licenses: []
97
95
 
98
96
  post_install_message:
99
97
  rdoc_options:
98
+ - --line-numbers
99
+ - --inline-source
100
+ - --title
101
+ - Js2
100
102
  - --main
101
- - README.rdoc
103
+ - README.md
102
104
  require_paths:
103
105
  - lib
104
106
  required_ruby_version: !ruby/object:Gem::Requirement
105
107
  requirements:
106
108
  - - ">="
107
109
  - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
108
112
  version: "0"
109
- version:
110
113
  required_rubygems_version: !ruby/object:Gem::Requirement
111
114
  requirements:
112
115
  - - ">="
113
116
  - !ruby/object:Gem::Version
114
- version: "0"
115
- version:
117
+ segments:
118
+ - 1
119
+ - 2
120
+ version: "1.2"
116
121
  requirements: []
117
122
 
118
123
  rubyforge_project: js2
119
- rubygems_version: 1.3.5
124
+ rubygems_version: 1.3.6
120
125
  signing_key:
121
126
  specification_version: 3
122
- summary: A cross-browser object oriented approach to javascript
123
- test_files: []
124
-
127
+ summary: ""
128
+ test_files:
129
+ - test/test_helper.rb
130
+ - test/test_js2.rb
data/Changelog DELETED
@@ -1,33 +0,0 @@
1
- == 0.0.10
2
- * fixed last child bug
3
- * added more features to *.js.yml extension
4
- * require array of files or classes (added before code in orig file)
5
- * include array of files or classes (added after code in orig file)
6
- * fixed bug regarding make_compilation feature
7
-
8
- == 0.0.9 2009-12-23
9
- * large 1st move to runtime js2
10
-
11
- == 0.0.8 2009-12-23
12
- * fixed unique file problem in compilition files
13
-
14
- == 0.0.7 2009-12-23
15
- * Added Observable.js
16
- * Added JS2.App Class
17
- * Added JS2.App.JQuery Class
18
- * Added yml support for templating classes for applications
19
- * Added compiliations for applications
20
-
21
- == 0.0.6 2009-12-08
22
- * removing deprecated classes file
23
-
24
- == 0.0.5 2009-12-04
25
- * added bootstrap
26
-
27
- == 0.0.3 2009-11-30
28
- * Selenium test bug fixes
29
-
30
- == 0.0.2 2009-11-25
31
- * Fixed sass templating so that there is no default namespacing
32
-
33
-
data/History.txt DELETED
@@ -1,4 +0,0 @@
1
- === 0.0.1 2009-11-20
2
-
3
- * 1 major enhancement:
4
- * Initial release
data/Manifest.txt DELETED
@@ -1,35 +0,0 @@
1
- Changelog
2
- History.txt
3
- LICENSE
4
- Manifest.txt
5
- PostInstall.txt
6
- README
7
- README.txt
8
- README.rdoc
9
- Rakefile
10
- examples/js2.yml
11
- examples/test.yml
12
- lib/javascript/sel_marker.js2
13
- lib/javascript/test.js2
14
- lib/tasks/js2.rake
15
- lib/js2.rb
16
- lib/js2/config.rb
17
- lib/js2/daemon.rb
18
- lib/js2/file_handler.rb
19
- lib/js2/foo.js2.haml
20
- lib/js2/haml_engine.rb
21
- lib/js2/haml_parser.rb
22
- lib/js2/js2.js
23
- lib/js2/js2bootstrap.js2
24
- lib/js2/parser.rb
25
- lib/js2/processor.rb
26
- lib/js2/replace.rb
27
- lib/js2/sel_decorator.rb
28
- lib/js2/tokenizer.rl.erb
29
- lib/js2/tree.rb
30
- lib/js2/universe.rb
31
- lib/js2/test/selenium.rb
32
- lib/js2/test/selenium_element.rb
33
- lib/js2/test/selenium_helper.rb
34
- bin/js2
35
- website/index.txt
data/PostInstall.txt DELETED
@@ -1,7 +0,0 @@
1
-
2
- For more information on js2, see http://js2.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-
data/README DELETED
@@ -1,69 +0,0 @@
1
- = js2
2
-
3
- * http://code.google.com/p/js2lang
4
-
5
- == DESCRIPTION:
6
-
7
- A cross-browser object oriented approach to javascript
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * Class Definition Syntax
12
- * Inheritence
13
- * getters / setters
14
- * Mixins
15
- * Static Methods
16
- * currying
17
- * foreach
18
-
19
- == SYNOPSIS:
20
-
21
- class My.Base {
22
- function sayHi () {
23
- alert("hi");
24
- }
25
- }
26
-
27
-
28
- class My.Concrete {
29
- function sayHello () {
30
- alert("hello");
31
- }
32
- }
33
-
34
-
35
- js2 --out-dir=/dir/to/write/js/code /dir/with/js2/clode
36
-
37
- == REQUIREMENTS:
38
-
39
- * RubyInline
40
- * HAML (optional)
41
-
42
- == INSTALL:
43
-
44
- gem install js2
45
-
46
- == LICENSE:
47
-
48
- (The MIT License)
49
-
50
- Copyright (c) 2009 FIXME full name
51
-
52
- Permission is hereby granted, free of charge, to any person obtaining
53
- a copy of this software and associated documentation files (the
54
- 'Software'), to deal in the Software without restriction, including
55
- without limitation the rights to use, copy, modify, merge, publish,
56
- distribute, sublicense, and/or sell copies of the Software, and to
57
- permit persons to whom the Software is furnished to do so, subject to
58
- the following conditions:
59
-
60
- The above copyright notice and this permission notice shall be
61
- included in all copies or substantial portions of the Software.
62
-
63
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
64
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
65
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
66
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
67
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
68
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
69
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc DELETED
@@ -1,69 +0,0 @@
1
- = js2
2
-
3
- * http://code.google.com/p/js2lang
4
-
5
- == DESCRIPTION:
6
-
7
- A cross-browser object oriented approach to javascript
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * Class Definition Syntax
12
- * Inheritence
13
- * getters / setters
14
- * Mixins
15
- * Static Methods
16
- * currying
17
- * foreach
18
-
19
- == SYNOPSIS:
20
-
21
- class My.Base {
22
- function sayHi () {
23
- alert("hi");
24
- }
25
- }
26
-
27
-
28
- class My.Concrete {
29
- function sayHello () {
30
- alert("hello");
31
- }
32
- }
33
-
34
-
35
- js2 --out-dir=/dir/to/write/js/code /dir/with/js2/clode
36
-
37
- == REQUIREMENTS:
38
-
39
- * RubyInline
40
- * HAML (optional)
41
-
42
- == INSTALL:
43
-
44
- gem install js2
45
-
46
- == LICENSE:
47
-
48
- (The MIT License)
49
-
50
- Copyright (c) 2009 FIXME full name
51
-
52
- Permission is hereby granted, free of charge, to any person obtaining
53
- a copy of this software and associated documentation files (the
54
- 'Software'), to deal in the Software without restriction, including
55
- without limitation the rights to use, copy, modify, merge, publish,
56
- distribute, sublicense, and/or sell copies of the Software, and to
57
- permit persons to whom the Software is furnished to do so, subject to
58
- the following conditions:
59
-
60
- The above copyright notice and this permission notice shall be
61
- included in all copies or substantial portions of the Software.
62
-
63
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
64
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
65
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
66
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
67
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
68
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
69
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.txt DELETED
@@ -1,69 +0,0 @@
1
- = js2
2
-
3
- * http://code.google.com/p/js2lang
4
-
5
- == DESCRIPTION:
6
-
7
- A cross-browser object oriented approach to javascript
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- * Class Definition Syntax
12
- * Inheritence
13
- * getters / setters
14
- * Mixins
15
- * Static Methods
16
- * currying
17
- * foreach
18
-
19
- == SYNOPSIS:
20
-
21
- class My.Base {
22
- function sayHi () {
23
- alert("hi");
24
- }
25
- }
26
-
27
-
28
- class My.Concrete {
29
- function sayHello () {
30
- alert("hello");
31
- }
32
- }
33
-
34
-
35
- js2 --out-dir=/dir/to/write/js/code /dir/with/js2/clode
36
-
37
- == REQUIREMENTS:
38
-
39
- * RubyInline
40
- * HAML (optional)
41
-
42
- == INSTALL:
43
-
44
- gem install js2
45
-
46
- == LICENSE:
47
-
48
- (The MIT License)
49
-
50
- Copyright (c) 2009 FIXME full name
51
-
52
- Permission is hereby granted, free of charge, to any person obtaining
53
- a copy of this software and associated documentation files (the
54
- 'Software'), to deal in the Software without restriction, including
55
- without limitation the rights to use, copy, modify, merge, publish,
56
- distribute, sublicense, and/or sell copies of the Software, and to
57
- permit persons to whom the Software is furnished to do so, subject to
58
- the following conditions:
59
-
60
- The above copyright notice and this permission notice shall be
61
- included in all copies or substantial portions of the Software.
62
-
63
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
64
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
65
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
66
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
67
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
68
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
69
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/examples/js2.yml DELETED
@@ -1,8 +0,0 @@
1
- devlopment:
2
- test_mode: true
3
- js2_dir: './js2'
4
- js2_haml_dir: './js2'
5
- write_dir: './javascripts/public'
6
- haml_dir: './app/views'
7
- reference_dir: './spec/js2refs'
8
- haml_engine_class: 'Sci::Javascript::HamlEngine'
data/examples/test.yml DELETED
@@ -1,5 +0,0 @@
1
- test_mode: true
2
- js2_dir: './test/js2'
3
- js2_haml_dir: './test/js2'
4
- write_dir: './test/js'
5
- reference_dir: './test/refs'