Module: Marley

Defined in:
lib/marley/router.rb,
lib/marley.rb,
lib/marley/joint.rb,
lib/marley/utils.rb,
lib/marley/errors.rb,
lib/marley/plugin.rb,
lib/marley/reggae.rb,
lib/marley/resources.rb,
lib/marley/controllers.rb,
lib/marley/joints/tags.rb,
lib/marley/joints/user.rb,
lib/marley/joints/forum.rb,
lib/marley/test_helpers.rb,
lib/marley/joints/section.rb,
lib/marley/joints/messages.rb,
lib/marley/plugins/rest_convenience.rb,
lib/marley/plugins/orm_rest_convenience.rb,
lib/marley/plugins/orm_materialized_path.rb

Overview

require ‘ruby-prof’

Defined Under Namespace

Modules: Joints, Plugins, Resources, Utils Classes: AuthenticationError, AuthorizationError, MarleyError, ModelController, Reggae, ReggaeColSpec, ReggaeError, ReggaeInstance, ReggaeInstanceList, ReggaeLink, ReggaeMsg, ReggaeResource, ReggaeSchema, ReggaeSection, Router, RoutingError, TestClient, ValidationError

Constant Summary collapse

DEFAULT_OPTS =
{
:app_name => 'Application',
:port => 1620,
:default_resource => 'MainMenu',
:server => 'thin',
:client => Marley::Client.new}
RESP_CODES =
{'get' => 200,'post' => 201,'put' => 203,'delete' => 204}

Class Method Summary collapse

Class Method Details

.config(opts = nil) {|@marley_opts| ... } ⇒ Object

Yields:

  • (@marley_opts)


31
32
33
34
35
36
# File 'lib/marley.rb', line 31

def self.config(opts=nil)
  @marley_opts||=DEFAULT_OPTS
  @marley_opts.merge!(opts) if opts
  yield @marley_opts if block_given?
  @marley_opts
end

.joint(joint_name, *opts) ⇒ Object



41
42
43
# File 'lib/marley.rb', line 41

def self.joint(joint_name, *opts)
  Joints.const_get(joint_name.to_s.camelize).new(*opts).smoke
end

.plugin(plugin_name, *opts) ⇒ Object



38
39
40
# File 'lib/marley.rb', line 38

def self.plugin(plugin_name, *opts)
  Plugins.const_get(plugin_name.to_s.camelize).new(*opts)
end

.run(opts = {}) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/marley.rb', line 45

def self.run(opts={})
  marley_opts=self.config(opts)
  Rack::Handler.get(marley_opts[:server]).run(Rack::Builder.new {
    use Rack::Reloader,0
    use Rack::Static, :urls => [opts[:image_path]] if opts[:image_path]
    run(Marley::Router.new(marley_opts))
  }.to_app,{:Port => @marley_opts[:port]})
end