cable 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/cable.rb +6 -2
- data/lib/cable/railtie.rb +3 -0
- data/lib/cable/schema/faceable.rb +20 -0
- metadata +14 -4
- data/lib/cable/orm/active_record.rb +0 -29
- data/lib/cable/schema.rb +0 -54
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.12
|
data/lib/cable.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require 'orm_adapter'
|
3
|
+
require 'schemata'
|
3
4
|
|
4
5
|
module Cable
|
5
6
|
|
@@ -14,7 +15,10 @@ module Cable
|
|
14
15
|
autoload :CableControllerHelpers, 'cable/controllers/cable_controller_helpers'
|
15
16
|
autoload :Block, 'cable/block'
|
16
17
|
autoload :SpecialAction, 'cable/special_action'
|
17
|
-
|
18
|
+
|
19
|
+
# module Schema
|
20
|
+
# require 'cable/schema/faceable'
|
21
|
+
# end
|
18
22
|
|
19
23
|
module Errors
|
20
24
|
autoload :ResourceAssociationError, "cable/errors/resource_association_error"
|
@@ -96,4 +100,4 @@ module Cable
|
|
96
100
|
end
|
97
101
|
|
98
102
|
require 'cable/rails/routes'
|
99
|
-
require 'cable/orm/active_record'
|
103
|
+
# require 'cable/orm/active_record'
|
data/lib/cable/railtie.rb
CHANGED
@@ -2,11 +2,14 @@ require 'rails'
|
|
2
2
|
require 'cable/acts_as_cable'
|
3
3
|
require 'cable/menu/acts_as_cable_menu'
|
4
4
|
require 'cable/media/acts_as_attachable'
|
5
|
+
require 'schemata'
|
5
6
|
|
6
7
|
module Cable
|
7
8
|
class Railtie < Rails::Railtie
|
8
9
|
config.to_prepare do
|
9
10
|
ActiveRecord::Base.send(:include, Cable::ActsAsCable)
|
11
|
+
ActiveRecord::ConnectionAdapters::Table.send :include, Schemata::Orm::ActiveRecord::Schema
|
12
|
+
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Schemata::Orm::ActiveRecord::Schema
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
## This is an example on how to create your own schema definition. Include it in cable.rb
|
2
|
+
|
3
|
+
# module Schema
|
4
|
+
# require 'cable/schema/faceable'
|
5
|
+
# end
|
6
|
+
|
7
|
+
|
8
|
+
# module Schemata
|
9
|
+
# #Influenced by devise's schema module. Methods defined here will be available within migartion files to apply a schema concept.
|
10
|
+
# module Schema
|
11
|
+
#
|
12
|
+
# # Provides a common set of address fields such as, street_address_1, street_address_2, city, state, zip_code and country as String fields.
|
13
|
+
# def faceable
|
14
|
+
# apply_schema :face, String
|
15
|
+
# apply_schema :eyes, String
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
#
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Spencer Markowski
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-04-
|
15
|
+
date: 2011-04-13 00:00:00 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -114,6 +114,17 @@ dependencies:
|
|
114
114
|
type: :runtime
|
115
115
|
prerelease: false
|
116
116
|
version_requirements: *id009
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: schemata
|
119
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
125
|
+
type: :runtime
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: *id010
|
117
128
|
description:
|
118
129
|
email:
|
119
130
|
executables: []
|
@@ -172,11 +183,10 @@ files:
|
|
172
183
|
- lib/cable/menu/base.rb
|
173
184
|
- lib/cable/menu/simple_navigation_methods.rb
|
174
185
|
- lib/cable/menu/url_helper.rb
|
175
|
-
- lib/cable/orm/active_record.rb
|
176
186
|
- lib/cable/page.rb
|
177
187
|
- lib/cable/rails/routes.rb
|
178
188
|
- lib/cable/railtie.rb
|
179
|
-
- lib/cable/schema.rb
|
189
|
+
- lib/cable/schema/faceable.rb
|
180
190
|
- lib/cable/setting.rb
|
181
191
|
- lib/cable/special_action.rb
|
182
192
|
- lib/generators/cable/install_generator.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'orm_adapter/adapters/active_record'
|
2
|
-
module Cable
|
3
|
-
module Orm
|
4
|
-
# This module contains some helpers and handle schema (migrations):
|
5
|
-
#
|
6
|
-
# create_table :accounts do |t|
|
7
|
-
# t.menuable
|
8
|
-
# t.nameable
|
9
|
-
# t.addressable
|
10
|
-
# t.contactable
|
11
|
-
# t.timestamps
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
#
|
15
|
-
module ActiveRecord
|
16
|
-
module Schema
|
17
|
-
include Cable::Schema
|
18
|
-
|
19
|
-
# Tell how to apply schema methods.
|
20
|
-
def apply_cable_schema(name, type, options={})
|
21
|
-
column name, type.to_s.downcase.to_sym, options
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
ActiveRecord::ConnectionAdapters::Table.send :include, Cable::Orm::ActiveRecord::Schema
|
29
|
-
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Cable::Orm::ActiveRecord::Schema
|
data/lib/cable/schema.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
module Cable
|
2
|
-
#Influenced by devise's schema module. Methods defined here will be available within migartion files to apply a schema concept.
|
3
|
-
|
4
|
-
module Schema
|
5
|
-
|
6
|
-
# Provides a common set of address fields such as, street_address_1, street_address_2, city, state, zip_code and country as String fields.
|
7
|
-
def addressable
|
8
|
-
apply_cable_schema :street_address_1, String
|
9
|
-
apply_cable_schema :street_address_2, String
|
10
|
-
apply_cable_schema :city, String
|
11
|
-
apply_cable_schema :state, String
|
12
|
-
apply_cable_schema :zip_code, String
|
13
|
-
apply_cable_schema :country, String
|
14
|
-
end
|
15
|
-
|
16
|
-
def nameable
|
17
|
-
apply_cable_schema :first_name, String
|
18
|
-
apply_cable_schema :middle_name, String
|
19
|
-
apply_cable_schema :last_name, String
|
20
|
-
end
|
21
|
-
|
22
|
-
def contactable
|
23
|
-
nameable
|
24
|
-
apply_cable_schema :email_address, String
|
25
|
-
apply_cable_schema :phone_number, String
|
26
|
-
end
|
27
|
-
|
28
|
-
# Provides a convenience method for all the needed fields used in Cable menus.
|
29
|
-
def menuable
|
30
|
-
apply_cable_schema :title, String
|
31
|
-
apply_cable_schema :cable_menuable_id , Integer
|
32
|
-
apply_cable_schema :cable_menuable_type, String
|
33
|
-
apply_cable_schema :parent_id, Integer
|
34
|
-
apply_cable_schema :lft, Integer
|
35
|
-
apply_cable_schema :rgt, Integer
|
36
|
-
apply_cable_schema :url, String
|
37
|
-
apply_cable_schema :menu_identifier, String
|
38
|
-
apply_cable_schema :show_in_menu, :boolean, :default => true
|
39
|
-
apply_cable_schema :meta_description, String
|
40
|
-
apply_cable_schema :meta_keywords, String
|
41
|
-
apply_cable_schema :special_action, String
|
42
|
-
apply_cable_schema :marketable_url, String
|
43
|
-
apply_cable_schema :show_on_landing_page, :boolean
|
44
|
-
apply_cable_schema :template, String
|
45
|
-
apply_cable_schema :tree_id, Integer
|
46
|
-
apply_cable_schema :options, :text
|
47
|
-
end
|
48
|
-
# @note Overwrite with specific modification to create your own schema.
|
49
|
-
def apply_cable_schema(name, type, options={})
|
50
|
-
raise NotImplementedError
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|