Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleanup erb support for tiny_mce.yml, and add attribution

  • Loading branch information...
commit 26b4eb8dd5b85f2cc6a75e5382161316925c1ed5 1 parent 6be7726
Kieran Pilkington authored
Showing with 9 additions and 6 deletions.
  1. +3 −0  CHANGELOG_PLUGIN.rdoc
  2. +6 −6 lib/tiny_mce/configuration.rb
View
3  CHANGELOG_PLUGIN.rdoc
@@ -1,5 +1,8 @@
= Plugin Changelog
+== Version 0.1.5 (unreleased)
+* Added ERB support to fixtures (Daniel Tsadok)
+
== Version 0.1.4
* Upgraded TinyMCE from 3.3.1 to 3.3.6 (see CHANGELOG_TINYMCE)
* Added missing 'formats' tinymce option (Roelof Reitsma)
View
12 lib/tiny_mce/configuration.rb
@@ -16,15 +16,15 @@ def self.default_options
# The YAML file might not exist, might be blank, might be invalid, or
# might be valid. Catch all cases and make sure we always return a Hash
+ # Run it through an ERB parser so that environment specific code can be
+ # put in the file
def self.config_file_options
@@config_file_options ||= begin
tiny_mce_yaml_filepath = File.join(Rails.root.to_s, 'config', 'tiny_mce.yml')
- fixture_content = IO.read(tiny_mce_yaml_filepath) rescue nil
- #Fixtures can be dynamic
- if defined?(ERB)
- fixture_content = ERB.new(fixture_content).result rescue nil
- end
- (YAML::load(fixture_content) rescue nil) || Hash.new
+ return Hash.new unless File.exist?(tiny_mce_yaml_filepath)
+ tiny_mce_config = IO.read(tiny_mce_yaml_filepath)
+ tiny_mce_config = ERB.new(tiny_mce_config).result if defined?(ERB)
+ (YAML::load(tiny_mce_config) rescue nil) || Hash.new
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.