Module: Ramverk

Defined in:
lib/ramverk.rb,
lib/ramverk/string.rb,
lib/ramverk/version.rb,
lib/ramverk/resolver.rb,
lib/ramverk/cli/command.rb,
lib/ramverk/configuration.rb,
lib/ramverk/cli/commands/base.rb,
lib/ramverk/middleware/static.rb,
lib/ramverk/cli/commands/server.rb,
lib/ramverk/middleware/reloader.rb,
lib/ramverk/cli/commands/console.rb,
lib/ramverk/configuration/middleware.rb,
lib/ramverk/middleware/request_logger.rb,
lib/ramverk/configuration/dynamic_groups.rb

Overview

Ramverk is a web application framework written in Ruby.

Defined Under Namespace

Modules: Cli, Middleware, String Classes: Configuration, Console, Server

Constant Summary collapse

VERSION =

Current version number.

"0.11.0"

Class Method Summary collapse

Class Method Details

.boottrue

Boot the project.

Examples:

Ramverk.boot

Returns:

  • (true)

Raises:

  • (RuntimeError)

    If project already been booted.



54
55
56
57
58
59
# File 'lib/ramverk.rb', line 54

def self.boot
  raise "project has already been booted" if @booted

  configuration.boot
  @booted = true
end

.configurationRamverk::Configuration

Project configuration.



30
31
32
# File 'lib/ramverk.rb', line 30

def self.configuration
  @configuration
end

.configure {|config| ... } ⇒ Object

Configure project within a block.

Examples:

Ramverk.configure do |config|
end

Yields:

  • (config)

    Configuration.

Yield Parameters:



42
43
44
# File 'lib/ramverk.rb', line 42

def self.configure
  yield configuration
end

.envSymbol

Get the current environment status.

Returns:

  • (Symbol)


12
13
14
# File 'lib/ramverk.rb', line 12

def self.env
  (ENV["APP_ENV"] || ENV["RACK_ENV"] || :development).to_sym
end

.env?(environment, ...) ⇒ Boolean

Check if the given environment match the current.

Parameters:

  • environment (Symbol)
  • ... (Symbol)

Returns:

  • (Boolean)


23
24
25
# File 'lib/ramverk.rb', line 23

def self.env?(*environment)
  environment.include?(env)
end

.rack#call

Rack compatible endpoint.

Returns:

  • (#call)


64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ramverk.rb', line 64

def self.rack
  boot unless @booted

  builder = Rack::Builder.new

  configuration.middleware.stack.each do |(mw, args, block)|
    builder.use mw, *args, &block
  end

  builder.run Resolver.new(configuration.apps).freeze
  builder.freeze
end

.rake?Boolean

Check if the program is running via Rake.

Returns:

  • (Boolean)


80
81
82
# File 'lib/ramverk.rb', line 80

def self.rake?
  File.basename($PROGRAM_NAME) == "rake"
end