Class: Pluto::Server

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Models
Defined in:
lib/pluto/server.rb

Constant Summary collapse

PUBLIC_FOLDER =
"#{Pluto.root}/lib/pluto/server/public"
VIEWS_FOLDER =
"#{Pluto.root}/lib/pluto/server/views"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



18
19
20
# File 'lib/pluto/server.rb', line 18

def self.banner
  "pluto-service #{Pluto::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})"
end

Instance Method Details

#feeds_pathObject



50
51
52
# File 'lib/pluto/server.rb', line 50

def feeds_path
  "#{path_prefix}/feeds"
end

#items_pathObject



54
55
56
# File 'lib/pluto/server.rb', line 54

def items_path
  "#{path_prefix}/items"
end


67
68
69
70
71
72
73
# File 'lib/pluto/server.rb', line 67

def link_to( text, url, opts={} )
  attributes = ""
  opts.each do |key,value|
    attributes << "#{key}='#{value}' "
  end
  "<a href='#{url}' #{attributes}>#{text}</a>"
end

#path_prefixObject

Helpers



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

def path_prefix
  request.env['SCRIPT_NAME']
end

#root_pathObject



58
59
60
# File 'lib/pluto/server.rb', line 58

def root_path
  "#{path_prefix}/"
end

#root_urlObject



62
63
64
# File 'lib/pluto/server.rb', line 62

def root_url
  url( '/' )
end

#sites_pathObject



46
47
48
# File 'lib/pluto/server.rb', line 46

def sites_path
  "#{path_prefix}/sites"
end