github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

astrails / http_require

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 17
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

allow "require" from the web — Read more

  cancel

http://blog.astrails.com/2009/5/12/ruby-http-require

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

note about stacktrace 
vitaly (author)
Mon May 11 23:22:27 -0700 2009
commit  0f5585f80b7d0a62375cf1f4d312862144482144
tree    3e660b8943a2ec3f7333763b87b58d9ff71c2871
parent  0fb1b28661e5e5cb52f105e69cc25f9b35e358eb
http_require /
name age
history
message
file .document Loading commit data...
file .gitignore
file LICENSE
file README.markdown
file Rakefile
file VERSION.yml
directory examples/
file http_require.gemspec
directory lib/
README.markdown

http_require

Idea

The idea is very simple: test.rb:

# this will download bar.rb and eval its content.
require "http://foo.com/bar.rb"

If a remote file (or one of its local dependencies) requires something that can't be found locally, it will try to find it remotely from the same location as the parent.

Example

http://example.com/test/foo.rb:

# this will load "http://example.com/test/foo/bar.rb"
# if "foo/bar" is not available locally
require "foo/bar"

stacktrace

http_require properly sets filename on eval so that the file's uri appears in the stacktrace:

foo.rb:

puts :foo
require 'bar'
def foo
  bar
end

bar.rb

puts :bar
def bar
  raise
end

$ irb
>> require 'http_require'
=> true
>> require 'http://localhost:2000/foo.rb'
foo
bar
=> nil
>> foo
RuntimeError:
    from http://localhost:2000/bar.rb:3:in `bar'
    from http://localhost:2000/foo.rb:5:in `foo'
    from (irb):3
>>

Homepage

You can find the latest sources on [github]:(http://github.com/astrails/http_require)

Installation

sudo gem install astrails-http_require --source http://gems.github.com/

Copyright

Copyright (c) 2009 Vitaly Kushner. See LICENSE for details.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server