cockpit 0.2.4.1 → 0.2.4.2
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/cockpit/core/include.rb +1 -1
- data/lib/cockpit/core/settings.rb +7 -3
- data/lib/cockpit/core/view_helper.rb +20 -0
- metadata +5 -5
- data/lib/cockpit/core/helpers.rb +0 -12
data/lib/cockpit/core/include.rb
CHANGED
@@ -10,7 +10,7 @@ module Cockpit
|
|
10
10
|
if block_given?
|
11
11
|
options = {:store => options.to_sym} unless options.is_a?(Hash)
|
12
12
|
@cockpit = Cockpit::Settings.define!(options.merge(:for => self), &block)
|
13
|
-
|
13
|
+
|
14
14
|
@cockpit.roots.map(&:key).flatten.each do |key|
|
15
15
|
define_method key do
|
16
16
|
send(:cockpit).send(key)
|
@@ -25,9 +25,9 @@ module Cockpit
|
|
25
25
|
|
26
26
|
settings = Cockpit::Settings.new(options)
|
27
27
|
|
28
|
-
if options[:class] == NilClass
|
29
|
-
|
30
|
-
end
|
28
|
+
#if options[:class] == NilClass
|
29
|
+
global_setting options[:name], options[:class], settings
|
30
|
+
#end
|
31
31
|
|
32
32
|
settings
|
33
33
|
end
|
@@ -88,6 +88,10 @@ module Cockpit
|
|
88
88
|
def method_missing(method, *args, &block)
|
89
89
|
global.send(method, *args, &block)
|
90
90
|
end
|
91
|
+
|
92
|
+
def for(clazz, name = :default)
|
93
|
+
global_setting(name, clazz)
|
94
|
+
end
|
91
95
|
end
|
92
96
|
|
93
97
|
attr_reader :name, :record, :store, :store_type, :record_type
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Cockpit
|
2
|
+
module ViewHelper
|
3
|
+
unless respond_to?(:c)
|
4
|
+
def c(key)
|
5
|
+
Cockpit::Settings.global[key]
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def setting_options(key, scope = nil)
|
10
|
+
setting_attribute(key, :options, scope)
|
11
|
+
end
|
12
|
+
|
13
|
+
def setting_attribute(key, attribute, scope = nil)
|
14
|
+
Cockpit::Settings.for(scope.to_s.camelize).definition(key).attributes[attribute]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
::ActionView::Helpers.send(:include, Cockpit::ViewHelper) if defined?(::ActionView::Helpers)
|
20
|
+
::Sinatra.helpers.send(:helper, Cockpit::ViewHelper) if defined?(::Sinatra)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cockpit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 75
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 4
|
10
|
-
-
|
11
|
-
version: 0.2.4.
|
10
|
+
- 2
|
11
|
+
version: 0.2.4.2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Lance Pollard
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-05 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -46,12 +46,12 @@ files:
|
|
46
46
|
- MIT-LICENSE.markdown
|
47
47
|
- lib/cockpit/core/definition.rb
|
48
48
|
- lib/cockpit/core/global.rb
|
49
|
-
- lib/cockpit/core/helpers.rb
|
50
49
|
- lib/cockpit/core/include.rb
|
51
50
|
- lib/cockpit/core/scope.rb
|
52
51
|
- lib/cockpit/core/settings.rb
|
53
52
|
- lib/cockpit/core/spec.rb
|
54
53
|
- lib/cockpit/core/store.rb
|
54
|
+
- lib/cockpit/core/view_helper.rb
|
55
55
|
- lib/cockpit/stores/active_record.rb
|
56
56
|
- lib/cockpit/stores/file_system.rb
|
57
57
|
- lib/cockpit/stores/memory.rb
|
data/lib/cockpit/core/helpers.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module Cockpit
|
2
|
-
module ViewHelpers
|
3
|
-
unless respond_to?(:c)
|
4
|
-
def c(key)
|
5
|
-
Cockpit::Settings.global[key]
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
::ActionView::Helpers.send(:include, Cockpit::ViewHelpers) if defined?(::ActionView::Helpers)
|
12
|
-
::Sinatra.helpers.send(:helper, Cockpit::ViewHelpers) if defined?(::Sinatra)
|