opal 0.3.2 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +85 -127
- data/bin/opal +3 -3
- data/lib/core.rb +114 -0
- data/{gems/core/lib → lib}/core/array.rb +68 -187
- data/{gems/core/lib → lib}/core/basic_object.rb +22 -5
- data/lib/core/class.rb +38 -0
- data/{gems/core/lib → lib}/core/dir.rb +1 -1
- data/lib/core/enumerable.rb +33 -0
- data/{gems/core/lib → lib}/core/error.rb +1 -4
- data/{gems/core/lib → lib}/core/false_class.rb +0 -0
- data/{gems/core/lib → lib}/core/file.rb +11 -3
- data/{gems/core/lib → lib}/core/hash.rb +12 -0
- data/{gems/core/lib → lib}/core/kernel.rb +114 -86
- data/lib/core/match_data.rb +33 -0
- data/lib/core/module.rb +97 -0
- data/{gems/core/lib → lib}/core/nil_class.rb +0 -0
- data/{gems/core/lib → lib}/core/numeric.rb +5 -0
- data/{gems/core/lib → lib}/core/object.rb +0 -0
- data/{gems/core/lib → lib}/core/proc.rb +13 -3
- data/{gems/core/lib → lib}/core/range.rb +10 -0
- data/{gems/core/lib → lib}/core/regexp.rb +33 -1
- data/{gems/core/lib → lib}/core/string.rb +25 -10
- data/{gems/core/lib → lib}/core/symbol.rb +3 -3
- data/{gems/core/lib → lib}/core/top_self.rb +0 -0
- data/{gems/core/lib → lib}/core/true_class.rb +0 -0
- data/lib/dev.rb +169 -0
- data/{gems/ospec/lib → lib}/ospec.rb +1 -0
- data/lib/ospec/autorun.rb +8 -0
- data/{gems/ospec/lib → lib}/ospec/dsl.rb +2 -2
- data/{gems/ospec/lib → lib}/ospec/example.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/before_and_after_hooks.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/errors.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/example_group.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/example_group_factory.rb +0 -3
- data/{gems/ospec/lib → lib}/ospec/example/example_group_hierarchy.rb +4 -3
- data/{gems/ospec/lib → lib}/ospec/example/example_group_methods.rb +1 -1
- data/{gems/ospec/lib → lib}/ospec/example/example_group_proxy.rb +3 -2
- data/{gems/ospec/lib → lib}/ospec/example/example_methods.rb +1 -1
- data/{gems/ospec/lib → lib}/ospec/example/example_proxy.rb +7 -7
- data/{gems/ospec/lib → lib}/ospec/expectations.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/expectations/errors.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/expectations/fail_with.rb +4 -3
- data/{gems/ospec/lib → lib}/ospec/expectations/handler.rb +6 -0
- data/lib/ospec/helpers/scratch.rb +18 -0
- data/{gems/ospec/lib → lib}/ospec/matchers.rb +2 -2
- data/{gems/ospec/lib → lib}/ospec/matchers/be.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/matchers/generated_descriptions.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/matchers/operator_matcher.rb +2 -0
- data/lib/ospec/matchers/raise_error.rb +38 -0
- data/lib/ospec/runner.rb +90 -0
- data/{gems/ospec/lib → lib}/ospec/runner/example_group_runner.rb +10 -13
- data/lib/ospec/runner/formatter/html_formatter.rb +139 -0
- data/{gems/ospec/lib → lib}/ospec/runner/formatter/terminal_formatter.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/runner/options.rb +1 -3
- data/{gems/ospec/lib → lib}/ospec/runner/reporter.rb +0 -9
- data/lib/racc/parser.rb +165 -0
- data/lib/strscan.rb +52 -0
- data/{lib → opal_lib}/opal.rb +2 -0
- data/opal_lib/opal/build_methods.rb +51 -0
- data/opal_lib/opal/builder.rb +164 -0
- data/opal_lib/opal/bundle.rb +70 -0
- data/opal_lib/opal/command.rb +68 -0
- data/{lib → opal_lib}/opal/context.rb +21 -9
- data/{lib → opal_lib}/opal/context/console.rb +0 -2
- data/opal_lib/opal/context/file_system.rb +34 -0
- data/{lib → opal_lib}/opal/context/loader.rb +26 -8
- data/opal_lib/opal/gem.rb +84 -0
- data/{lib → opal_lib}/opal/rake/builder_task.rb +2 -2
- data/opal_lib/opal/rake/spec_task.rb +32 -0
- data/{lib → opal_lib}/opal/ruby/nodes.rb +730 -109
- data/{lib → opal_lib}/opal/ruby/parser.rb +90 -23
- data/opal_lib/opal/ruby/ruby_parser.rb +4862 -0
- data/opal_lib/opal/ruby/ruby_parser.y +1454 -0
- data/opal_lib/opal/version.rb +4 -0
- data/runtime/class.js +359 -0
- data/runtime/debug.js +84 -0
- data/runtime/fs.js +199 -0
- data/runtime/init.js +558 -0
- data/runtime/loader.js +351 -0
- data/runtime/module.js +109 -0
- data/runtime/post.js +10 -0
- data/runtime/pre.js +7 -0
- data/runtime/runtime.js +351 -0
- metadata +88 -175
- data/.gitignore +0 -7
- data/Changelog +0 -31
- data/LICENSE +0 -75
- data/Rakefile +0 -86
- data/gems/core/README.md +0 -14
- data/gems/core/Rakefile +0 -8
- data/gems/core/core.gemspec +0 -13
- data/gems/core/lib/core.rb +0 -34
- data/gems/core/lib/core/class.rb +0 -31
- data/gems/core/lib/core/module.rb +0 -100
- data/gems/core/lib/core/vm.rb +0 -16
- data/gems/core/spec/core/array/append_spec.rb +0 -30
- data/gems/core/spec/core/array/assoc_spec.rb +0 -29
- data/gems/core/spec/core/array/at_spec.rb +0 -37
- data/gems/core/spec/core/array/clear_spec.rb +0 -22
- data/gems/core/spec/core/array/collect_bang_spec.rb +0 -27
- data/gems/core/spec/core/array/collect_spec.rb +0 -27
- data/gems/core/spec/core/array/compact_spec.rb +0 -41
- data/gems/core/spec/core/array/concat_spec.rb +0 -15
- data/gems/core/spec/core/array/constructor_spec.rb +0 -14
- data/gems/core/spec/core/array/each_spec.rb +0 -9
- data/gems/core/spec/core/array/element_reference_spec.rb +0 -4
- data/gems/core/spec/core/array/first_spec.rb +0 -35
- data/gems/core/spec/core/array/include_spec.rb +0 -9
- data/gems/core/spec/core/array/join_spec.rb +0 -6
- data/gems/core/spec/core/array/last_spec.rb +0 -51
- data/gems/core/spec/core/array/length_spec.rb +0 -6
- data/gems/core/spec/core/array/map_spec.rb +0 -33
- data/gems/core/spec/core/array/reverse_spec.rb +0 -6
- data/gems/core/spec/core/builtin_constants/builtin_constants_spec.rb +0 -7
- data/gems/core/spec/core/false/and_spec.rb +0 -10
- data/gems/core/spec/core/false/inspect_spec.rb +0 -6
- data/gems/core/spec/core/false/or_spec.rb +0 -10
- data/gems/core/spec/core/false/to_s_spec.rb +0 -6
- data/gems/core/spec/core/false/xor_spec.rb +0 -10
- data/gems/core/spec/core/file/join_spec.rb +0 -19
- data/gems/core/spec/core/hash/assoc_spec.rb +0 -32
- data/gems/core/spec/core/kernel/instance_eval_spec.rb +0 -0
- data/gems/core/spec/core/kernel/loop_spec.rb +0 -24
- data/gems/core/spec/core/kernel/raise_spec.rb +0 -0
- data/gems/core/spec/core/module/attr_accessor_spec.rb +0 -28
- data/gems/core/spec/core/number/lt_spec.rb +0 -12
- data/gems/core/spec/core/string/sub_spec.rb +0 -24
- data/gems/core/spec/core/true/and_spec.rb +0 -10
- data/gems/core/spec/core/true/inspect_spec.rb +0 -6
- data/gems/core/spec/core/true/or_spec.rb +0 -10
- data/gems/core/spec/core/true/to_s_spec.rb +0 -6
- data/gems/core/spec/core/true/xor_spec.rb +0 -10
- data/gems/core/spec/language/and_spec.rb +0 -61
- data/gems/core/spec/language/array_spec.rb +0 -68
- data/gems/core/spec/language/block_spec.rb +0 -38
- data/gems/core/spec/language/break_spec.rb +0 -36
- data/gems/core/spec/language/case_spec.rb +0 -103
- data/gems/core/spec/language/def_spec.rb +0 -21
- data/gems/core/spec/language/eigenclass_spec.rb +0 -60
- data/gems/core/spec/language/file_spec.rb +0 -13
- data/gems/core/spec/language/fixtures/block.rb +0 -21
- data/gems/core/spec/language/fixtures/super.rb +0 -293
- data/gems/core/spec/language/hash_spec.rb +0 -29
- data/gems/core/spec/language/if_spec.rb +0 -54
- data/gems/core/spec/language/loop_spec.rb +0 -11
- data/gems/core/spec/language/metaclass_spec.rb +0 -21
- data/gems/core/spec/language/method_spec.rb +0 -124
- data/gems/core/spec/language/next_spec.rb +0 -25
- data/gems/core/spec/language/or_spec.rb +0 -34
- data/gems/core/spec/language/redo_spec.rb +0 -24
- data/gems/core/spec/language/regexp_spec.rb +0 -26
- data/gems/core/spec/language/rescue_spec.rb +0 -20
- data/gems/core/spec/language/return_spec.rb +0 -47
- data/gems/core/spec/language/string_spec.rb +0 -25
- data/gems/core/spec/language/super_spec.rb +0 -32
- data/gems/core/spec/language/until_spec.rb +0 -157
- data/gems/core/spec/language/variables_spec.rb +0 -155
- data/gems/core/spec/language/while_spec.rb +0 -163
- data/gems/core/spec/spec_helper.rb +0 -5
- data/gems/core_fs/README.md +0 -19
- data/gems/dev/Rakefile +0 -5
- data/gems/dev/lib/dev.js +0 -99
- data/gems/dev/lib/dev/generator.js +0 -1264
- data/gems/dev/lib/dev/parser.js +0 -979
- data/gems/dev/lib/dev/ruby_parser.js +0 -1088
- data/gems/dev/lib/dev/ruby_parser.y +0 -1267
- data/gems/dev/lib/dev/string_scanner.js +0 -38
- data/gems/dev/tools/racc2js/README.md +0 -39
- data/gems/dev/tools/racc2js/math_parser.js +0 -222
- data/gems/dev/tools/racc2js/math_parser.rb +0 -133
- data/gems/dev/tools/racc2js/math_parser.y +0 -28
- data/gems/dev/tools/racc2js/parser.js +0 -218
- data/gems/dev/tools/racc2js/racc2js.rb +0 -153
- data/gems/json/README.md +0 -4
- data/gems/json/json.gemspec +0 -14
- data/gems/json/lib/json.rb +0 -64
- data/gems/json/lib/json/ext.rb +0 -51
- data/gems/json/lib/json/json2.js +0 -481
- data/gems/ospec/README.md +0 -0
- data/gems/ospec/lib/ospec/autorun.rb +0 -3
- data/gems/ospec/lib/ospec/runner.rb +0 -40
- data/gems/ospec/lib/ospec/runner/formatter/html_formatter.rb +0 -91
- data/gems/ospec/ospec.gemspec +0 -0
- data/gems/rquery/README.md +0 -9
- data/gems/rquery/lib/rquery.rb +0 -10
- data/gems/rquery/lib/rquery/ajax.rb +0 -4
- data/gems/rquery/lib/rquery/css.rb +0 -96
- data/gems/rquery/lib/rquery/document.rb +0 -25
- data/gems/rquery/lib/rquery/element.rb +0 -292
- data/gems/rquery/lib/rquery/event.rb +0 -108
- data/gems/rquery/lib/rquery/jquery.js +0 -8177
- data/gems/rquery/lib/rquery/request.rb +0 -138
- data/gems/rquery/lib/rquery/response.rb +0 -49
- data/gems/rquery/rquery.gemspec +0 -16
- data/lib/opal.js +0 -1597
- data/lib/opal/builder.rb +0 -117
- data/lib/opal/bundle.rb +0 -131
- data/lib/opal/command.rb +0 -11
- data/lib/opal/context/file_system.rb +0 -19
- data/lib/opal/gem.rb +0 -153
- data/lib/opal/ruby/ruby_parser.rb +0 -5170
- data/lib/opal/ruby/ruby_parser.y +0 -1298
- data/opal.gemspec +0 -15
data/.gitignore
DELETED
data/Changelog
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
2011-03-31 Adam Beynon <adam@adambeynon.com>
|
2
|
-
|
3
|
-
* Changelog, README.md, opal.gemspec: Update to 0.3.2
|
4
|
-
|
5
|
-
* lib/opal/rake/builder_task.rb: Added task used in Rakefiles for
|
6
|
-
building simple opal projects.
|
7
|
-
|
8
|
-
* lib/opal/builder.rb: Update builder options to correctly glob files
|
9
|
-
passed as strings or arrays.
|
10
|
-
|
11
|
-
* lib/opal.rb: Load builder tasks for rakefiles.
|
12
|
-
|
13
|
-
* README.md: Update to list packaged gems and links to relevant docs.
|
14
|
-
Also added docs on using BuilderTask.
|
15
|
-
|
16
|
-
* gems/core/Rakefile: Use markdown for markup in documentation.
|
17
|
-
|
18
|
-
* gems/core/lib/core/object.rb: Add core Object class to aid
|
19
|
-
documentation.
|
20
|
-
|
21
|
-
* gems/core/lib/core.rb, gems/core/lib/core/array.rb,
|
22
|
-
gems/core/lib/core/basic_object.rb, gems/core/lib/core/class.rb,
|
23
|
-
gems/core/lib/core/error.rb, gems/core/lib/core/false_class.rb,
|
24
|
-
gems/core/lib/core/hash.rb, gems/core/lib/core/kernel.rb,
|
25
|
-
gems/core/lib/core/module.rb, gems/core/lib/core/nil_class.rb,
|
26
|
-
gems/core/lib/core/numeric.rb, gems/core/lib/core/proc.rb,
|
27
|
-
gems/core/lib/core/regexp.rb, gems/core/lib/core/string.rb,
|
28
|
-
gems/core/lib/core/symbol.rb, gems/core/lib/core/true_class.rb: Update
|
29
|
-
core documentation with implementation details for toll free classes
|
30
|
-
and special use information.
|
31
|
-
|
data/LICENSE
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
Copyright (C) 2011 by Adam Beynon
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Opalspec based on RSPEC, original license:
|
25
|
-
==========================================
|
26
|
-
|
27
|
-
Copyright (c) 2005-2010 The RSpec Development Team
|
28
|
-
|
29
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
30
|
-
a copy of this software and associated documentation files (the
|
31
|
-
"Software"), to deal in the Software without restriction, including
|
32
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
33
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
34
|
-
permit persons to whom the Software is furnished to do so, subject to
|
35
|
-
the following conditions:
|
36
|
-
|
37
|
-
The above copyright notice and this permission notice shall be
|
38
|
-
included in all copies or substantial portions of the Software.
|
39
|
-
|
40
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
41
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
42
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
43
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
44
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
45
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
46
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
|
-
|
48
|
-
|
49
|
-
Opalite contains Sizzle, original license:
|
50
|
-
==========================================
|
51
|
-
|
52
|
-
MIT License
|
53
|
-
----
|
54
|
-
|
55
|
-
Copyright (c) 2009 John Resig
|
56
|
-
|
57
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
58
|
-
of this software and associated documentation files (the "Software"), to deal
|
59
|
-
in the Software without restriction, including without limitation the rights
|
60
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
61
|
-
copies of the Software, and to permit persons to whom the Software is
|
62
|
-
furnished to do so, subject to the following conditions:
|
63
|
-
|
64
|
-
The above copyright notice and this permission notice shall be included in
|
65
|
-
all copies or substantial portions of the Software.
|
66
|
-
|
67
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
68
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
69
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
70
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
71
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
72
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
73
|
-
THE SOFTWARE.
|
74
|
-
|
75
|
-
|
data/Rakefile
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'yard'
|
2
|
-
|
3
|
-
OPAL_DOC_ROOT = "doc"
|
4
|
-
OPAL_DOC_GEMS = "doc/gems"
|
5
|
-
OPAL_GIT_REPO = "git@github.com:adambeynon/opal.git"
|
6
|
-
|
7
|
-
desc "Rebuild ruby_parser.rb for opal build tools"
|
8
|
-
task :parser do
|
9
|
-
%x{racc -E -l lib/opal/ruby/ruby_parser.y -o lib/opal/ruby/ruby_parser.rb}
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "Requires this development version of opal (not installed one)"
|
13
|
-
task :opal do
|
14
|
-
$:.unshift File.join(__FILE__, '..', 'lib')
|
15
|
-
require 'opal'
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "Builds standalone opal.js file (opal + core + rquery) for the browser"
|
19
|
-
task :browser => :opal do
|
20
|
-
gem = Opal::Gem.new File.join(__FILE__, '..', 'gems', 'rquery')
|
21
|
-
|
22
|
-
content = gem.bundle :to => 'tmp/opal.js'
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "Builds spec runner for core lib"
|
26
|
-
task :opal_spec => :opal do
|
27
|
-
gem = Opal::Gem.new File.join(__FILE__, '..', 'gems', 'opal')
|
28
|
-
content = gem.bundle
|
29
|
-
File.open('tmp/opal_spec.js', 'w+') { |out| out.write content }
|
30
|
-
end
|
31
|
-
|
32
|
-
desc "Building example for a simple builder"
|
33
|
-
task :simple => :opal do
|
34
|
-
builder = Opal::Builder.new :project_dir => File.join(Dir.getwd, 'tmp'),
|
35
|
-
:files => 'testing.rb',
|
36
|
-
:out => 'testing.js'
|
37
|
-
|
38
|
-
builder.build
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "Rebuilds the documentation"
|
42
|
-
task :doc => ['doc:clean', 'doc:opal', 'doc:gems']
|
43
|
-
|
44
|
-
namespace :doc do
|
45
|
-
# Opal documentation
|
46
|
-
YARD::Rake::YardocTask.new(:opal) do |t|
|
47
|
-
t.files = ['lib/**/*.rb']
|
48
|
-
t.options = ['--title', 'Documentation for Opal', '--markup', 'markdown']
|
49
|
-
end
|
50
|
-
|
51
|
-
desc "Clean doc dir ready for rebuilding"
|
52
|
-
task :clean do
|
53
|
-
rm_rf OPAL_DOC_ROOT
|
54
|
-
end
|
55
|
-
|
56
|
-
desc "Generate documentation for opal and all gems"
|
57
|
-
task :gems do
|
58
|
-
Dir.mkdir OPAL_DOC_GEMS unless File.exists? OPAL_DOC_GEMS
|
59
|
-
|
60
|
-
%w[core].each do |gem|
|
61
|
-
gem_root = File.join Dir.getwd, 'gems', gem
|
62
|
-
doc_root = File.join gem_root, 'doc'
|
63
|
-
new_doc_root = File.join OPAL_DOC_GEMS, gem
|
64
|
-
|
65
|
-
puts " **#{gem}**"
|
66
|
-
Dir.chdir(gem_root) do
|
67
|
-
system "rake yard"
|
68
|
-
end
|
69
|
-
|
70
|
-
mv doc_root, new_doc_root
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
desc "Push changes to gh-pages branch"
|
75
|
-
task :pages do
|
76
|
-
Dir.chdir(OPAL_DOC_ROOT) do
|
77
|
-
system "git init"
|
78
|
-
system "git add ."
|
79
|
-
system "git commit -a -m 'Update docs for #{Time.now.asctime}'"
|
80
|
-
system "git remote add origin #{OPAL_GIT_REPO}"
|
81
|
-
system "git checkout -b gh-pages"
|
82
|
-
system "git push -f origin gh-pages"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
data/gems/core/README.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
Core Library
|
2
|
-
============
|
3
|
-
|
4
|
-
**Homepage**: [http://opalscript.org](http://opalscript.org)
|
5
|
-
**GitHub**: [http://github.com/adambeynon/opal](http://github.com/adambeynon/opal)
|
6
|
-
|
7
|
-
Synopsis
|
8
|
-
--------
|
9
|
-
|
10
|
-
This gem contains the core library implementation for opal. It is kept
|
11
|
-
as a seperate gem so that the base opal.js loader simply contains the
|
12
|
-
core runtime and object hierarchy setup, and then this gem simply
|
13
|
-
implements the methods for the standard library.
|
14
|
-
|
data/gems/core/Rakefile
DELETED
data/gems/core/core.gemspec
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
Gem::Specification.new do |s|
|
3
|
-
s.name = "core"
|
4
|
-
s.version = "0.0.1"
|
5
|
-
s.authors = ["Adam Beynon"]
|
6
|
-
s.email = ["adam@adambeynon.com"]
|
7
|
-
s.homepage = "http://github.com/adambeynon/opal"
|
8
|
-
s.summary = "Core libraries for opal"
|
9
|
-
|
10
|
-
s.files = Dir.glob("{bin,lib}/**/*") + %w[README.md]
|
11
|
-
s.require_path = "lib"
|
12
|
-
end
|
13
|
-
|
data/gems/core/lib/core.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
|
2
|
-
module Kernel
|
3
|
-
# Try to load the library or file named `path`. An error is thrown if the
|
4
|
-
# path cannot be resolved.
|
5
|
-
#
|
6
|
-
# @param [String] path The path to load
|
7
|
-
# @return [true, false]
|
8
|
-
def require(path)
|
9
|
-
`VM.require(path);`
|
10
|
-
true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'core/basic_object'
|
15
|
-
require 'core/object'
|
16
|
-
require 'core/module'
|
17
|
-
require 'core/class'
|
18
|
-
require 'core/kernel'
|
19
|
-
require 'core/top_self'
|
20
|
-
require 'core/nil_class'
|
21
|
-
require 'core/true_class'
|
22
|
-
require 'core/false_class'
|
23
|
-
require 'core/array'
|
24
|
-
require 'core/numeric'
|
25
|
-
require 'core/hash'
|
26
|
-
require 'core/error'
|
27
|
-
require 'core/string'
|
28
|
-
require 'core/symbol'
|
29
|
-
require 'core/proc'
|
30
|
-
require 'core/range'
|
31
|
-
require 'core/file'
|
32
|
-
require 'core/dir'
|
33
|
-
require 'core/vm'
|
34
|
-
|
data/gems/core/lib/core/class.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
class Class < Module
|
2
|
-
|
3
|
-
# def new(*args)
|
4
|
-
# `var obj = self.$m.allocate(self);
|
5
|
-
# args.unshift(obj);
|
6
|
-
|
7
|
-
# obj.$m.initialize.apply(null, args);
|
8
|
-
|
9
|
-
# return obj;`
|
10
|
-
# end
|
11
|
-
|
12
|
-
# This is what new should be: need to fix compiler for splat args
|
13
|
-
#
|
14
|
-
# def new(*args)
|
15
|
-
# obj = allocate
|
16
|
-
# obj.initialize *args
|
17
|
-
# obj
|
18
|
-
# end
|
19
|
-
|
20
|
-
def superclass
|
21
|
-
`var sup = self.$super;
|
22
|
-
|
23
|
-
if (!sup) {
|
24
|
-
if (self == VM.BasicObject) return nil;
|
25
|
-
throw new Error('RuntimeError: uninitialized class');
|
26
|
-
}
|
27
|
-
|
28
|
-
return sup;`
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# Implements the core functionality of modules. This is inherited from
|
2
|
-
# by instances of {Class}, so these methods are also available to
|
3
|
-
# classes.
|
4
|
-
class Module
|
5
|
-
|
6
|
-
def name
|
7
|
-
`return self.__classid__;`
|
8
|
-
end
|
9
|
-
|
10
|
-
def ===(obj)
|
11
|
-
obj.kind_of? self
|
12
|
-
end
|
13
|
-
|
14
|
-
def define_method(method_id, &block)
|
15
|
-
raise LocalJumpError, "no block given" unless block_given?
|
16
|
-
`VM.define_method(self, #{method_id.to_s}, block)`
|
17
|
-
nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def attr_accessor(*attrs)
|
21
|
-
attr_reader *attrs
|
22
|
-
attr_writer *attrs
|
23
|
-
end
|
24
|
-
|
25
|
-
def attr_reader(*attrs)
|
26
|
-
`for (var i = 0; i < attrs.length; i++) {
|
27
|
-
var attr = attrs[i];
|
28
|
-
var method_id = #{`attr`.to_s};
|
29
|
-
|
30
|
-
VM.define_method(self, method_id,
|
31
|
-
new Function('self', 'var iv = self["@' + method_id + '"]; return iv === undefined ? nil : iv;'));
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
return nil;`
|
36
|
-
end
|
37
|
-
|
38
|
-
def attr_writer(*attrs)
|
39
|
-
`for (var i = 0; i < attrs.length; i++) {
|
40
|
-
var attr = attrs[i];
|
41
|
-
var method_id = #{`attr`.to_s};
|
42
|
-
|
43
|
-
VM.define_method(self, method_id + '=',
|
44
|
-
new Function('self', 'val', 'return self["@' + method_id + '"] = val;'));
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
return nil;`
|
49
|
-
end
|
50
|
-
|
51
|
-
def alias_method(new_name, old_name)
|
52
|
-
new_name = new_name.to_s
|
53
|
-
old_name = old_name.to_s
|
54
|
-
`VM.define_method(self, new_name, self.$m_prototype_tbl[old_name])`
|
55
|
-
self
|
56
|
-
end
|
57
|
-
|
58
|
-
def to_s
|
59
|
-
`return self.__classid__;`
|
60
|
-
end
|
61
|
-
|
62
|
-
def const_set(id, value)
|
63
|
-
`return rb_vm_cs(self, #{id.to_s}, value);`
|
64
|
-
end
|
65
|
-
|
66
|
-
def class_eval(str, &block)
|
67
|
-
if block_given?
|
68
|
-
`block(self)`
|
69
|
-
else
|
70
|
-
raise "need to compile str"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def module_eval(str, &block)
|
75
|
-
class_eval str, &block
|
76
|
-
end
|
77
|
-
|
78
|
-
def private
|
79
|
-
self
|
80
|
-
end
|
81
|
-
|
82
|
-
def public
|
83
|
-
self
|
84
|
-
end
|
85
|
-
|
86
|
-
def protected
|
87
|
-
self
|
88
|
-
end
|
89
|
-
|
90
|
-
def include(mod)
|
91
|
-
`VM.include_module(self, mod)`
|
92
|
-
nil
|
93
|
-
end
|
94
|
-
|
95
|
-
def extend(mod)
|
96
|
-
`VM.extend_module(self, mod)`
|
97
|
-
nil
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
data/gems/core/lib/core/vm.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# Exposes all the VM methods for opal as ruby methods on this module.
|
2
|
-
module OpalVM
|
3
|
-
|
4
|
-
# Define a bridged class that will extend the given native prototype.
|
5
|
-
# Classes here must extend Object, and will be placed in the top level
|
6
|
-
# scope. As soon as this is called, the class generated will be available
|
7
|
-
# for immediate use.
|
8
|
-
#
|
9
|
-
# @param [NativePrototype] prototype
|
10
|
-
# @param [String] name
|
11
|
-
def self.bridged_class(prototype, name)
|
12
|
-
`VM.bridged_class(prototype, null, name, VM.Object);`
|
13
|
-
nil
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
|
2
|
-
describe "Array#<<" do
|
3
|
-
it "pushed the object onto the end of the array" do
|
4
|
-
([1, 2] << "c" << "d" << [3, 4]).should == [1, 2, "c", "d", [3, 4]]
|
5
|
-
end
|
6
|
-
|
7
|
-
it "returns self to allow chaining" do
|
8
|
-
a = []
|
9
|
-
b = a
|
10
|
-
(a << 1).should == b
|
11
|
-
(a << 2 << 3).should == b
|
12
|
-
end
|
13
|
-
|
14
|
-
it "correctly resizes the Array" do
|
15
|
-
a = []
|
16
|
-
a.size.should == 0
|
17
|
-
a << :foo
|
18
|
-
a.size.should == 1
|
19
|
-
a << :bar << :baz
|
20
|
-
a.size.should == 3
|
21
|
-
|
22
|
-
a = [1, 2, 3]
|
23
|
-
a.shift
|
24
|
-
a.shift
|
25
|
-
a.shift
|
26
|
-
a << :foo
|
27
|
-
a.should == [:foo]
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|