marley 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ Sequel::Model.plugin :timestamps, :create => :date_created, :update => :date_upd
3
3
 
4
4
  Marley.joint 'basic_user',{:resources => []}
5
5
  Marley.joint 'tagging'
6
- Marley.joint 'basic_messaging',{:resources => ['message']}
6
+ Marley.joint 'basic_messaging',{:resources => ['Message']}
7
7
  module Marley
8
8
  module Joints
9
9
  class TaggedMessaging < Joint
@@ -15,8 +15,8 @@ module Marley
15
15
  MR::Tag.tagging_for('Post')
16
16
  end
17
17
  end
18
- module ClassMethods
19
- module Message
18
+ module MessagePlugin
19
+ module ClassMethods
20
20
  def list(params={})
21
21
  if associations.include?(:public_tags)
22
22
  specified_tags=params.delete(:tags)
@@ -34,9 +34,7 @@ module Marley
34
34
  items.group(:thread_id).order(:max.sql_function(:date_created).desc,:max.sql_function(:date_updated).desc).map{|t|self[:parent_id => nil, :thread_id => t[:thread_id]].thread} rescue []
35
35
  end
36
36
  end
37
- end
38
- module InstanceMethods
39
- module Message
37
+ module InstanceMethods
40
38
  def rest_associations
41
39
  if ! new?
42
40
  [ respond_to?(:public_tags) ? :public_tags : nil, respond_to?(:user_tags) ? user_tags_dataset.current_user_dataset : nil].compact
data/lib/marley/joint.rb CHANGED
@@ -5,22 +5,25 @@ module Marley
5
5
  # - ClassMethods - Modules within this module will extend any constant in Marley::Resources with the same name.
6
6
  # - InstanceMethods - Modules within this module will append their features to any constant in Marley::Resources with the same name.
7
7
  class Joint
8
- #def self.provides(*args)
9
- # [:resources,:class_methods,:]
10
- #end
8
+ MODS=['Resources','Plugins']
9
+ MODS.each {|mod| const_set(mod,Module.new)}
10
+ def self.mods
11
+ MODS.map {|mod_name| self.const_get(mod_name) }
12
+ end
11
13
  def initialize(opts={})
12
14
  config(opts)
13
15
  end
14
16
  def smoke
15
- klass=self.class
16
- { 'resources' => lambda {|c| MR.const_set(c,klass::Resources.const_get(c))},
17
- 'class_methods' => lambda {|c| MR.const_get(c).extend klass::ClassMethods.const_get(c)},
18
- 'instance_methods' => lambda {|c| klass::InstanceMethods.const_get(c).send :append_features, MR.const_get(c)}
19
- }.each_pair do |mod_name, importer|
20
- if klass.constants.include?(mod_name.camelize)
21
- klass.const_get(mod_name.camelize).constants.each do |c|
22
- importer.call(c) unless @opts[mod_name.to_sym] && ! @opts[mod_name.to_sym].include?(c.underscore)
23
- end
17
+ self.class::Resources.constants.each do |resource_name|
18
+ MR.const_set(resource_name, self.class::Resources.const_get(resource_name)) unless (@opts[:resources] && ! @opts[:resources].include?(resource_name))
19
+ end
20
+ self.class.constants.grep(/.+Plugin$/).each do |plugin_name|
21
+ plugin=self.class.const_get(plugin_name)
22
+ resource_name=plugin_name.sub(/Plugin$/,'')
23
+ if MR.constants.include?(resource_name)
24
+ resource=MR.const_get(resource_name)
25
+ plugin.constants.include?('ClassMethods') && resource.extend(plugin.const_get('ClassMethods'))
26
+ plugin.constants.include?('InstanceMethods') && plugin.const_get('InstanceMethods').send(:append_features,resource)
24
27
  end
25
28
  end
26
29
  self
data/marley-0.4.0.gem ADDED
Binary file
data/marley.gemspec CHANGED
@@ -2,17 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{marley}
5
- s.version = "0.4.0"
5
+ s.version = "0.5.0"
6
6
  s.summary = %q{Irie default restful routes for your models and other objects}
7
- s.description = %q{Marley implements a web services microframework on top of Rack and Sequel on the server side and Jquery on the client side. After 0.4.0 the joints framework will be redone. However, I'm releasing this because I still think it's worth playing with and the joint restructuring will take a while.
8
- }
7
+ s.description = %q{Marley implements a web services framework on top of Rack and Sequel on the server side and Jquery on the client side. }
9
8
  s.authors = ["Herb Daily"]
10
9
  s.email = 'herb.daily@safe-mail.net'
11
10
  s.homepage = 'http://github.com/herbdaily/marley'
12
11
  s.required_rubygems_version = Gem::Requirement.new(">= 1.0.0") if s.respond_to? :required_rubygems_version=
13
12
  s.add_runtime_dependency 'sequel', '~>3.27'
14
13
  s.add_runtime_dependency 'rack', '~>1.2.2'
15
- # add rubydoctest dependency
16
14
  s.add_runtime_dependency 'json', '~>1.1.7'
15
+ s.add_development_dependency 'tdoc', '~>0.12.1'
17
16
  s.files = Dir.glob(["*","lib/**/*","examples/**/*","test/**/*"])
18
17
  end
data/test/test.sqlite3 CHANGED
Binary file
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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herb Daily
@@ -42,7 +42,17 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.1.7
44
44
  version:
45
- description: "Marley implements a web services microframework on top of Rack and Sequel on the server side and Jquery on the client side. After 0.4.0 the joints framework will be redone. However, I'm releasing this because I still think it's worth playing with and the joint restructuring will take a while.\n "
45
+ - !ruby/object:Gem::Dependency
46
+ name: tdoc
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.12.1
54
+ version:
55
+ description: "Marley implements a web services framework on top of Rack and Sequel on the server side and Jquery on the client side. "
46
56
  email: herb.daily@safe-mail.net
47
57
  executables: []
48
58
 
@@ -51,7 +61,6 @@ extensions: []
51
61
  extra_rdoc_files: []
52
62
 
53
63
  files:
54
- - marley-0.3.0.gem
55
64
  - marley.gemspec
56
65
  - Rakefile
57
66
  - Favicon.ico
data/marley-0.3.0.gem DELETED
Binary file