GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/zmack/mephisto.git
svenfuchs (author)
Wed Feb 20 11:11:20 -0800 2008
commit  1ad1b56b4a6c9284534b0afbb9d5d87715ae4312
tree    adc435b61f05728a991fd314188bc3e75cfb6038
parent  2772ec18227b04b3cb618748a2900a7b93b84d94
mephisto / lib / mephisto / plugin_about_patch.rb
100644 26 lines (22 sloc) 0.723 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# separately patching Rails::Plugin assuming that this patch will be accepted:
# http://dev.rubyonrails.org/ticket/10979
 
unless Rails::Plugin.respond_to?(:directory)
  Rails::Plugin.class_eval do
    attr_reader :directory, :name, :about
  
    alias :initialize_without_about_info :initialize
    def initialize(directory)
      initialize_without_about_info(directory)
      load_about_information
    end
 
    private
 
    def load_about_information
      begin
        about_yml_path = File.join(@directory, "about.yml")
        parsed_yml = File.exist?(about_yml_path) ? YAML.load(File.read(about_yml_path)) : {}
        @about = parsed_yml || {}
      rescue Exception
        @about = {}
      end
    end
  end
end