aboutsummaryrefslogtreecommitdiffstats
path: root/lib/refinery
diff options
context:
space:
mode:
Diffstat (limited to 'lib/refinery')
-rw-r--r--lib/refinery/blog.rb35
-rw-r--r--lib/refinery/blog/engine.rb20
-rw-r--r--lib/refinery/blog/tabs.rb16
3 files changed, 53 insertions, 18 deletions
diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb
new file mode 100644
index 0000000..326e36a
--- /dev/null
+++ b/lib/refinery/blog.rb
@@ -0,0 +1,35 @@
+require 'refinerycms-core'
+require 'filters_spam'
+require 'rails_autolink'
+
+module Refinery
+ autoload :BlogGenerator, 'generators/refinery/blog/blog_generator'
+
+ module Blog
+ require 'refinery/blog/engine' if defined?(Rails)
+
+ autoload :Version, 'refinery/blog/version'
+ autoload :Tab, 'refinery/blog/tabs'
+
+ class << self
+ attr_writer :root
+ attr_writer :tabs
+
+ def root
+ @root ||= Pathname.new(File.expand_path('../../', __FILE__))
+ end
+
+ def tabs
+ @tabs ||= []
+ end
+
+ def version
+ ::Refinery::Blog::Version.to_s
+ end
+
+ def factory_paths
+ @factory_paths ||= [ File.expand_path("../../spec/factories", __FILE__) ]
+ end
+ end
+ end
+end
diff --git a/lib/refinery/blog/engine.rb b/lib/refinery/blog/engine.rb
index f67d4ab..63b2793 100644
--- a/lib/refinery/blog/engine.rb
+++ b/lib/refinery/blog/engine.rb
@@ -1,23 +1,29 @@
+require 'refinerycms-blog'
+require 'rails'
+
module Refinery
module Blog
class Engine < Rails::Engine
- require 'rails_autolink'
-
- config.to_prepare do
- require 'refinery/blog/tabs'
- end
+ include Refinery::Engine
- initializer "init plugin", :after => :set_routes_reloader do |app|
+ isolate_namespace Refinery
+ engine_name :refinery_blog
+
+ initializer "register refinerycms_blog plugin", :after => :set_routes_reloader do |app|
Refinery::Plugin.register do |plugin|
plugin.pathname = root
plugin.name = "refinerycms_blog"
plugin.url = app.routes.url_helpers.refinery_admin_blog_posts_path
plugin.menu_match = /^\/refinery\/blog\/?(posts|comments|categories)?/
plugin.activity = {
- :class => Refinery::BlogPost
+ :class_name => :'refinery/blog_post'
}
end
end
+
+ config.after_initialize do
+ Refinery.register_engine(Refinery::Blog)
+ end
end
end
end
diff --git a/lib/refinery/blog/tabs.rb b/lib/refinery/blog/tabs.rb
index 083d50b..519b90e 100644
--- a/lib/refinery/blog/tabs.rb
+++ b/lib/refinery/blog/tabs.rb
@@ -1,11 +1,5 @@
module Refinery
- module Blog
- attr_accessor :tabs
-
- def self.tabs
- @tabs ||= []
- end
-
+ module Blog
class Tab
attr_accessor :name, :partial
@@ -18,11 +12,11 @@ module Refinery
raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank?
end
- protected
+ protected
- def initialize
- ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs
- end
+ def initialize
+ ::Refinery::Blog.tabs << self # add me to the collection of registered page tabs
+ end
end
end
end \ No newline at end of file