Module: Rango

> define #partial?

Public Visibility

Public Class Method Summary

bundle(name, options = Hash.new)
dependency(library, options = Hash.new, &block)

Returns: Boolean

root

Public Class Method Details

bundle

public bundle(name, options = Hash.new)

Meta Tags

Parameters:

Since:

0.0.1 options[:version] options[:soft] If true, bundle dependency just if isn’t bundled yet. you may need to bundle software which you do not use at the moment. For example on development machine you are using SQLite3, but on server you are using MySQL, so you will need to bundle do_mysql as well.

[View source]


51
52
53
54
55
56
57
58
59
# File 'lib/rango/bundling/dependency.rb', line 51

def bundle(name, options = Hash.new)
  dependency = Rango::Bundling::Strategy.find(name, options)
  if dependency.nil?
    Rango.logger.error("No dependency strategy matched for #{name} with #{options}")
    return nil
  else
    dependency.register
  end
end

dependency

public Boolean dependency(library, options = Hash.new, &block)

Meta Tags

Parameters:

[String] library

Library to require

[Hash] options (defaults to: Hash.new)

Available options: soft: boolean, github: user/repo, git: repo, svn: repo, gem: gemname.

Returns:

[Boolean]

Returns true if importing succeed or false if not. TODO: soft option support

Raises:

[LoadError]

Unless soft importing is enable, it will raise LoadError if the file wasn’t found

Since:

0.0.1

[View source]


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rango/bundling/dependency.rb', line 29

def dependency(library, options = Hash.new, &block)
  dependency = self.bundle(library, options.except(:optional))
  if dependency.nil?
    #
  else
    if options[:optional]
      begin
        dependency.load
      rescue LoadError
        Rango.logger.warn("Dependency #{library} isn't available.")
      end
    else
      dependency.load
    end
    block.call if block_given?
  end
end

root

public root
[View source]


27
28
29
# File 'lib/rango.rb', line 27

def self.root
  File.join(File.dirname(__FILE__), "rango")
end