motr 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/motr.rb +4 -2
- data/lib/motr/mapper.rb +8 -1
- data/lib/motr/mods.rb +6 -3
- data/lib/motr/rails.rb +2 -1
- data/lib/motr/rails/routes.rb +11 -0
- data/lib/motr/version.rb +1 -1
- metadata +14 -13
data/lib/motr.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require 'active_support/dependencies'
|
3
3
|
require 'set'
|
4
|
-
|
5
|
-
require 'motr/forms'
|
6
4
|
require 'motr/modding'
|
7
5
|
require 'motr/mods'
|
8
6
|
require 'motr/dash'
|
@@ -35,6 +33,10 @@ module Motr
|
|
35
33
|
# @param [Hash] options Hash including options for the mod
|
36
34
|
#
|
37
35
|
# @option options [String, Boolean] :autoload The path to autoload the module from (optional)
|
36
|
+
# @option options [Hash, Boolean] :mapping Routing options for the mod
|
37
|
+
# if a Hash is provided, it should contain a :controller option, and an optional :route option
|
38
|
+
# Passing "true" assumes a controller matching :modnames_controller (the mod name, plural) and
|
39
|
+
# a route matching the same.
|
38
40
|
#
|
39
41
|
#
|
40
42
|
def self.add_mod(module_name, options = {})
|
data/lib/motr/mapper.rb
CHANGED
@@ -2,6 +2,13 @@ module Motr
|
|
2
2
|
##
|
3
3
|
# Mapper handles configuring mod based routes within an application
|
4
4
|
#
|
5
|
-
|
5
|
+
class Mapper
|
6
|
+
class_attribute :map_options, :instance_writer => false
|
7
|
+
self.map_options = {}
|
8
|
+
|
9
|
+
def self.add_mapping(mod_name, options)
|
10
|
+
|
11
|
+
end
|
12
|
+
|
6
13
|
end
|
7
14
|
end
|
data/lib/motr/mods.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Motr
|
2
|
-
module Mods
|
3
|
-
|
2
|
+
module Mods
|
4
3
|
##
|
5
4
|
# modded_with provides the "hook" functionality to mod a model/class with a particular mod.
|
6
5
|
# Multiple mods can be applied at once, with options.
|
@@ -16,6 +15,9 @@ module Motr
|
|
16
15
|
#
|
17
16
|
#
|
18
17
|
def modded_with(*mods)
|
18
|
+
|
19
|
+
class_attribute :motr_mods, :instance_writer => false
|
20
|
+
self.motr_mods ||= []
|
19
21
|
|
20
22
|
options = mods.extract_options!
|
21
23
|
modules = mods.map(&:to_sym).uniq
|
@@ -24,7 +26,8 @@ module Motr
|
|
24
26
|
const_name = mod.to_s.classify
|
25
27
|
next unless Motr::Mods.const_defined?(:"#{const_name}")
|
26
28
|
|
27
|
-
|
29
|
+
self.motr_mods << mod
|
30
|
+
const_incl = Motr::Mods.const_get(:"#{const_name}")
|
28
31
|
|
29
32
|
# Apply passed options to modules where applicable.
|
30
33
|
#
|
data/lib/motr/rails.rb
CHANGED
@@ -8,8 +8,9 @@ module Motr
|
|
8
8
|
|
9
9
|
initializer 'motr.initializer' do
|
10
10
|
require 'motr/orm/mongoid' if defined?(Mongoid)
|
11
|
+
require 'motr/forms'
|
11
12
|
|
12
|
-
ActiveSupport.on_load(:action_view) do
|
13
|
+
ActiveSupport.on_load(:action_view) do
|
13
14
|
include Motr::Helpers::LayoutHelpers
|
14
15
|
include Motr::Helpers::Navigation
|
15
16
|
include Motr::Helpers::Elements
|
data/lib/motr/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: motr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brent Kirby
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-20 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -18,9 +18,9 @@ dependencies:
|
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
23
|
+
version: "2.0"
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
@@ -29,9 +29,9 @@ dependencies:
|
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.9
|
34
|
+
version: "0.9"
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: *id002
|
@@ -40,9 +40,9 @@ dependencies:
|
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.4
|
45
|
+
version: "0.4"
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: *id003
|
@@ -62,9 +62,9 @@ dependencies:
|
|
62
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.9
|
67
|
+
version: "0.9"
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: *id005
|
@@ -73,9 +73,9 @@ dependencies:
|
|
73
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - ~>
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 1.5
|
78
|
+
version: "1.5"
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: *id006
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/motr/mods.rb
|
144
144
|
- lib/motr/orm/active_record.rb
|
145
145
|
- lib/motr/orm/mongoid.rb
|
146
|
+
- lib/motr/rails/routes.rb
|
146
147
|
- lib/motr/rails.rb
|
147
148
|
- lib/motr/version.rb
|
148
149
|
- lib/motr.rb
|
@@ -165,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
166
|
requirements:
|
166
167
|
- - ">="
|
167
168
|
- !ruby/object:Gem::Version
|
168
|
-
hash: -
|
169
|
+
hash: -2281357879590670203
|
169
170
|
segments:
|
170
171
|
- 0
|
171
172
|
version: "0"
|