Module: Spade
- Defined in:
- lib/spade/cli.rb,
lib/spade.rb,
lib/spade/local.rb,
lib/spade/shell.rb,
lib/spade/bundle.rb,
lib/spade/loader.rb,
lib/spade/remote.rb,
lib/spade/server.rb,
lib/spade/console.rb,
lib/spade/context.rb,
lib/spade/exports.rb,
lib/spade/package.rb,
lib/spade/reactor.rb,
lib/spade/version.rb,
lib/spade/compiler.rb,
lib/spade/installer.rb,
lib/spade/repository.rb,
lib/spade/credentials.rb,
lib/spade/environment.rb,
lib/spade/dependency_installer.rb
Overview
Project: Spade - CommonJS Runtime Copyright: ©2010 Strobe Inc. All rights reserved. License: Licened under MIT license (see LICENSE)
Defined Under Namespace
Modules: Bundle, CLI, Namespace, Server
Classes: Compiler, Console, Context, Credentials, DependencyInstaller, Environment, Exports, Installer, Loader, Local, MainContext, Package, Reactor, Remote, Repository, Shell
Constant Summary
collapse
- SPADE_DIR =
Would be nice to share this with node.js loader
'.spade'
- BOOT_PATH =
File.expand_path(File.join(File.dirname(__FILE__), '..'))
- VERSION =
'0.0.8.1'
Class Method Summary
collapse
Class Method Details
.current_context ⇒ Object
12
13
14
|
# File 'lib/spade/loader.rb', line 12
def self.current_context
@current_context
end
|
.current_context=(ctx) ⇒ Object
16
17
18
|
# File 'lib/spade/loader.rb', line 16
def self.current_context=(ctx)
@current_context = ctx
end
|
.discover_root(cur_path) ⇒ Object
find the current path with a package.json or .packages or cur_path
30
31
32
33
34
35
36
37
38
|
# File 'lib/spade.rb', line 30
def self.discover_root(cur_path)
ret = File.expand_path(cur_path)
while ret != '/' && ret != '.'
return ret if File.exists?(File.join(ret,'package.json')) || File.exists?(File.join(ret,'.spade'))
ret = File.dirname ret
end
return cur_path
end
|
.exports(klass, path = nil) ⇒ Object
24
25
26
27
28
|
# File 'lib/spade/loader.rb', line 24
def self.exports(klass, path = nil)
path = @current_path if path.nil?
@exports ||= {}
@exports[path] = klass
end
|
.exports=(klass) ⇒ Object
20
21
22
|
# File 'lib/spade/loader.rb', line 20
def self.exports=(klass)
exports(klass, nil)
end
|
.exports_for(path) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/spade/loader.rb', line 30
def self.exports_for(path)
@current_path = path
require path
@current_path = nil
@exports ||= {}
@exports[path]
end
|