Sha256: 3e67ed853477c3614ca8a7ae15f16a8c494eefad1a2b60873c3aab31c6dea5d4
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'rails/generators' module Ckeditor class BaseGenerator < Rails::Generators::Base class_option :version, :type => :string, :default => '3.5.2', :desc => "Version of ckeditor which be install" def self.source_root @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates')) end # copy configuration def copy_initializer template "ckeditor.rb", "config/initializers/ckeditor.rb" end # copy ckeditor files def install_ckeditor puts "Start download #{filename}" file = Ckeditor::Utils.download(download_url) if File.exist?(file.path) Ckeditor::Utils.extract(file.path, Rails.root.join('public', 'javascripts')) directory "ckeditor", "public/javascripts/ckeditor" file.unlink else raise Rails::Generators::Error.new("Cannot download file #{download_url}") end end protected def download_url "http://download.cksource.com/CKEditor/CKEditor/CKEditor%20#{options[:version]}/ckeditor_#{options[:version]}.tar.gz" end def filename "ckeditor_#{options[:version]}.tar.gz" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ckeditor-3.5.2 | lib/generators/ckeditor/base/base_generator.rb |