Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 02d4121e8c27
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 55727d8b8faf
Choose a head ref
  • 4 commits
  • 5 files changed
  • 1 contributor

Commits on Jul 1, 2014

  1. Unverified

    The committer email address is not verified.
    Copy the full SHA
    a52e8e8 View commit details
  2. Backport .gitignore from master

    elia committed Jul 1, 2014

    Unverified

    The committer email address is not verified.
    Copy the full SHA
    81731be View commit details

Commits on Aug 12, 2014

  1. Add yard doc task

    elia committed Aug 12, 2014
    Copy the full SHA
    8dba499 View commit details

Commits on Sep 5, 2014

  1. Copy the full SHA
    55727d8 View commit details
Showing with 51 additions and 10 deletions.
  1. +1 −0 .gitignore
  2. +19 −0 Rakefile
  3. +13 −6 examples/sinatra/config.ru
  4. +1 −0 opal.gemspec
  5. +17 −4 opal/corelib/runtime.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ Gemfile.lock
build/
/.github_access_token
/cdn
/node_modules
19 changes: 19 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -71,3 +71,22 @@ desc 'Remove any generated file.'
task :clobber do
rm_r './build'
end

namespace :doc do
generate_docs_for = ->(glob, name){
release_name = `git rev-parse --abbrev-ref HEAD`.chomp
command = "yard doc #{glob} -o gh-pages/doc/#{release_name}/#{name}"
puts command
system command
}

task :corelib do
generate_docs_for['opal/**/*.rb', 'corelib']
end

task :stdlib do
generate_docs_for['stdlib/**/*.rb', 'stdlib']
end
end

task :doc => ['doc:corelib', 'doc:stdlib']
19 changes: 13 additions & 6 deletions examples/sinatra/config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
require 'opal'
require 'sinatra'

opal = Opal::Server.new {|s|
s.append_path 'app'
s.main = 'application'
}

map '/__opal_source_maps__' do
run opal.source_maps
end

map '/assets' do
run opal.sprockets
end

get '/' do
<<-EOS
<!doctype html>
@@ -12,10 +25,4 @@ get '/' do
EOS
end

map '/assets' do
env = Opal::Environment.new
env.append_path 'app'
run env
end

run Sinatra::Application
1 change: 1 addition & 0 deletions opal.gemspec
Original file line number Diff line number Diff line change
@@ -27,4 +27,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec', '~> 2.14'
s.add_development_dependency 'octokit', '~> 2.4.0'
s.add_development_dependency 'bundler', '~> 1.6'
s.add_development_dependency 'yard'
end
21 changes: 17 additions & 4 deletions opal/corelib/runtime.js
Original file line number Diff line number Diff line change
@@ -437,18 +437,31 @@
* @param [Array] stubs an array of method stubs to add
*/
Opal.add_stubs = function(stubs) {
var subscribers = Opal.stub_subscribers;
var subscriber;

for (var i = 0, length = stubs.length; i < length; i++) {
var stub = stubs[i];

if (!BasicObject.prototype[stub]) {
BasicObject.prototype[stub] = true;
add_stub_for(BasicObject.prototype, stub);
for (var j = 0; j < subscribers.length; j++) {
subscriber = subscribers[j]
if (!subscriber[stub]) {
subscriber[stub] = true;
add_stub_for(subscriber, stub);
}
}
}
};

/*
* Actuall add a method_missing stub function to the given prototype for the
* Keep a list of prototypes that want method_missing stubs to be added.
*
* @default [Prototype List] BasicObject.prototype
*/
Opal.stub_subscribers = [BasicObject.prototype]

/*
* Actually add a method_missing stub function to the given prototype for the
* given name.
*
* @param [Prototype] prototype the target prototype