marley 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'marley/jamaica' #should prob be ditched
2
3
  require 'json/ext'
3
4
  require 'rack'
4
5
  require 'rack/builder'
@@ -13,8 +14,7 @@ require 'marley/resources'
13
14
  require 'marley/controllers'
14
15
  require 'marley/joint'
15
16
  require 'marley/plugin'
16
- require 'client/jamaica' #should prob be ditched
17
- Sequel.extension :inflector
17
+ Sequel.extension :inflector #needs to be replaced, probably
18
18
 
19
19
  log_fn='log/marley.log'
20
20
  $log=Logger.new(File.exists?(log_fn) ? log_fn : $stdout)
@@ -6,7 +6,7 @@ module Marley
6
6
  if $request[:path][1].to_s.match(/^\d+$/) #references a specific instance by ID
7
7
  @instance=@model[$request[:path][1].to_i]
8
8
  raise RoutingError unless @instance
9
- @method_name=$request[:path][2]
9
+ @method_name=$request[:path][2].sub(/[\?\&\+]$/,'') rescue nil #ditch trailing characters, if any
10
10
  if @method_name
11
11
  raise RoutingError unless @instance.respond_to?(@method_name)
12
12
  @method=@instance.method(@method_name)
@@ -31,6 +31,7 @@ module Marley
31
31
  super
32
32
  self.topic_id||=self.class.max(:topic_id).to_i+1
33
33
  end
34
+ #this needs to change
34
35
  def reply
35
36
  foo=reggae_instance.set_values(:parent_id => id,:title => "re: #{title}")
36
37
  foo.new_rec=true
@@ -46,12 +47,9 @@ module Marley
46
47
  [
47
48
  self.reggae_link(:new, 'New Post'),
48
49
  self.reggae_link(:list, 'All Posts'),
49
- self.reggae_link(:recent_topics, 'Recent Topics')
50
- ].push(
51
- Marley::ReggaeMsg.new({
52
- :title => 'Topics Tagged With:',
53
- :description => MR::Tag.filter(:id => topics.join(:messages_tags).where(:messages__id => :message_id).select(:tag_id)).map{|t| reggae_link('list',t.tag,"#{resource_name}[tags]=#{t.tag}")}})
54
- )
50
+ self.reggae_link(:recent_topics, 'Recent Topics'),
51
+ Marley::ReggaeSection.new({:title => 'Topics Tagged With:', :navigation => MR::Tag.filter(:id => topics.join(:messages_tags).where(:messages__id => :message_id).select(:tag_id)).map{|t| reggae_link('list',t.tag,"#{resource_name}[tags]=#{t.tag}")}})
52
+ ]
55
53
  end
56
54
  def section_contents
57
55
  end
@@ -28,7 +28,7 @@ module Marley
28
28
  Marley.plugin('rest_convenience').apply(self)
29
29
  Marley.plugin('section').apply(self)
30
30
  Marley.plugin('current_user_methods').apply(self) if MP.const_defined?(:CurrentUserMethods)
31
- def self.rest_get
31
+ def self.rest_get(params=nil)
32
32
  section
33
33
  end
34
34
  end
@@ -41,11 +41,14 @@ module Marley
41
41
  false
42
42
  end
43
43
  end
44
+ def self.section_title
45
+ Marley.config[:app_name]
46
+ end
44
47
  def self.section_nav
45
48
  if respond_to?(:current_user) && (current_user.nil? || current_user.new?)
46
49
  [[:msg,{},'New users, please sign up below'],MR::User.new]
47
50
  else
48
- MR.resources_responding_to(:section).sort {|l,r|l.resource_name <=> r.resource_name}.map{|r| r.section_link}.compact
51
+ MR.resources_responding_to(:section).sort {|l,r|l.resource_name <=> r.resource_name}.map{|r| next if r==self; r.section}.compact
49
52
  end
50
53
  end
51
54
  def self.section_desc
@@ -47,4 +47,5 @@ DB.create_table :topics_tags do
47
47
  end
48
48
 
49
49
 
50
+ Marley.config(:app_name => 'Forum',:client => Marley::Client.new(:app_name => 'Forum'))
50
51
  Marley.joint('forum')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herb Daily
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2012-02-22 00:00:00 -03:00
12
+ date: 2012-02-27 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 0.13.4
53
+ version: 0.15.1
54
54
  version:
55
55
  description: "Marley is a framework for quickly building RESTful web services and applications. Development is fast because Marley implements lots of sensible defaults, all of which can be overridden and most of which can be overridden easily. "
56
56
  email: herb.daily@safe-mail.net