feeds/lib/feeds/engine.rb

43 lines
1.5 KiB
Ruby

module Feeds
class Engine < ::Rails::Engine
initializer "feeds" do
OrbitApp.registration "Feeds", :type => "ModuleApp" do
module_label "feed.feed"
base_url File.expand_path File.dirname(__FILE__)
categorizable
authorizable
side_bar do
head_label_i18n 'feed.feed', icon_class: "icons-rss"
available_for "managers"
active_for_controllers (['admin/feeds'])
head_link_path "admin_feeds_path"
context_link 'feed.all_feeds',
:link_path=>"admin_feeds_path" ,
:priority=>1,
:active_for_action=>{'admin/feeds'=>'index'},
:available_for => 'managers'
context_link 'feed.new_',
:link_path=>"new_admin_feed_path" ,
:priority=>2,
:active_for_action=>{'admin/feeds'=>'new'},
:available_for => 'managers'
end
end
spec = Gem::Specification.find_by_name("feeds") rescue nil
if !spec.nil?
gem_root = spec.gem_dir
gem_tmp = gem_root + "/tmp/"
f = File.join(gem_tmp + "install_bash")
if File.exists?(f)
File.delete(f)
%x(cp "#{gem_root}/config/schedule.rb" config/schedule.rb)
%x(whenever --update-crontab feeds --set environment="#{ENV["RAILS_ENV"]}")
end
end
end
end
end