constellation-base 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'constellation/base'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module Constellation
|
5
|
+
module Base
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
config.constellation = ActiveSupport::OrderedOptions.new unless config.respond_to? :constellation
|
8
|
+
config.constellation.base = ActiveSupport::OrderedOptions.new
|
9
|
+
config.constellation.base.root = __FILE__.gsub('/lib/constellation/base/engine.rb', '')
|
10
|
+
|
11
|
+
initializer "constellation.base.setup" do |app|
|
12
|
+
Object.send :include, Constellation::Base::ObjectExtensions
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Constellation
|
2
|
+
module Base
|
3
|
+
module ObjectExtensions
|
4
|
+
def self.included(recipient)
|
5
|
+
recipient.extend ObjectClassMethods
|
6
|
+
# recipient.class_eval { include ObjectInstanceMethods }
|
7
|
+
end
|
8
|
+
|
9
|
+
module ObjectClassMethods
|
10
|
+
# This method is to be used inside a class in your RAILS_ROOT/app with which you
|
11
|
+
# would like to extend the Constellation-provided functionality rather than
|
12
|
+
# completely replace it.
|
13
|
+
#
|
14
|
+
# Usage:
|
15
|
+
# include_constellation
|
16
|
+
# include_constellation :only => [:cms, :commerce]
|
17
|
+
# include_constellation :except => :cms
|
18
|
+
#
|
19
|
+
# When used without any arguments, this method requires all of the loaded Constellation modules'
|
20
|
+
# classes that match the current class name. Use :only or :except to restrict which modules'
|
21
|
+
# classes you wish to require.
|
22
|
+
def include_constellation(options={})
|
23
|
+
modules = [:authentication, :authorization, :admin, :workflow, :cms, :commerce]
|
24
|
+
|
25
|
+
if options[:only]
|
26
|
+
modules = options[:only].is_a?(Array) ? options[:only] : [options[:only]]
|
27
|
+
elsif options[:except]
|
28
|
+
options[:except] = [options[:except]] unless options[:except].is_a? Array
|
29
|
+
modules.reject!{ |x| options[:except].include?(x) }
|
30
|
+
end
|
31
|
+
|
32
|
+
filename = self.name.underscore
|
33
|
+
modules.each do |m|
|
34
|
+
if Rails.application.config.constellation.include? m
|
35
|
+
root = Rails.application.config.constellation.send(m).root
|
36
|
+
found = false
|
37
|
+
["/lib/", "/app/controllers/", "/app/models/"].each do |path|
|
38
|
+
begin
|
39
|
+
require root + path + filename
|
40
|
+
found = true
|
41
|
+
rescue LoadError
|
42
|
+
end
|
43
|
+
end
|
44
|
+
# TODO: Refer to a FAQ or Guide entry
|
45
|
+
raise LoadError.new "Could not find any Constellation provided files to include! Have you required the gems?" unless found
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: constellation-base
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ian Terrell
|
13
|
+
- Jeff Bozek
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-03 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Helper methods for Constellation software.
|
23
|
+
email: ian@constellationsoft.com;jeff@constellationsoft.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/constellation/base/engine.rb
|
32
|
+
- lib/constellation/base/object_extensions.rb
|
33
|
+
- lib/constellation/base.rb
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: http://github.com/constellationsoft/base
|
36
|
+
licenses: []
|
37
|
+
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.6
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Helper methods for Constellation software.
|
64
|
+
test_files: []
|
65
|
+
|