Module: TinyMCE
- Defined in:
- lib/tiny_mce/spell_checker.rb,
lib/tiny_mce.rb,
lib/tiny_mce/base.rb,
lib/tiny_mce/helpers.rb,
lib/tiny_mce/option_validator.rb
Overview
The base module we include into ActionController::Base
Defined Under Namespace
Modules: Base, Helpers, OptionValidator, SpellChecker
Class Method Summary collapse
Class Method Details
.install_or_update_tinymce ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/tiny_mce.rb', line 8 def self.install_or_update_tinymce require 'fileutils' orig = File.join(File.dirname(__FILE__), 'tiny_mce', 'assets', 'tiny_mce') dest = File.join(Rails.public_path, 'javascripts', 'tiny_mce') tiny_mce_js = File.join(dest, 'tiny_mce.js') unless File.exists?(tiny_mce_js) && FileUtils.identical?(File.join(orig, 'tiny_mce.js'), tiny_mce_js) if File.exists?(tiny_mce_js) # upgrade begin puts "Removing directory #{dest}..." FileUtils.rm_rf dest puts "Creating directory #{dest}..." FileUtils.mkdir_p dest puts "Copying TinyMCE to #{dest}..." FileUtils.cp_r "#{orig}/.", dest puts "Successfully updated TinyMCE." rescue puts 'ERROR: Problem updating TinyMCE. Please manually copy ' puts orig puts 'to' puts dest end else # install begin puts "Creating directory #{dest}..." FileUtils.mkdir_p dest puts "Copying TinyMCE to #{dest}..." FileUtils.cp_r "#{orig}/.", dest puts "Successfully installed TinyMCE." rescue puts "ERROR: Problem installing TinyMCE. Please manually copy " puts orig puts "to" puts dest end end end end |