Sha256: 8cb0e71c9ff19c77ce4b337bd32d04ee13ccf43c47baf42550eebcb2bb30698a

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

module RailsKindeditor
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
    desc "Install kindeditor for your application."

    def copy_kindeditor_files
      if ::Rails.version < "3.1.0"
        warn "Warning: rails_kindeditor ~> v0.3.0 only support Rails3.1+!"
        warn "If you're using rails3.0.x, please check rails_kindeditor v0.2.8"
      else
        template "rails_kindeditor.rb", "config/initializers/rails_kindeditor.rb"
      end
    end

    def insert_or_copy_js_files
      if File.exist?('app/assets/javascripts/application.js')
        insert_into_file "app/assets/javascripts/application.js", "//= require jquery\n//= require jquery_ujs\n//= require kindeditor\n", :before => "//= require_tree ."
      else
        copy_file "application.js", "app/assets/javascripts/application.js"
      end
    end

    def copy_load_kindeditor_coffeescript
      if ::Rails.version < "3.1.0"
        warn "Warning: rails_kindeditor ~> v0.3.0 only support Rails3.1+!"
        warn "If you're using rails3.0.x, please check rails_kindeditor v0.2.8"
      else
        template "load_kindeditor.coffee", "app/assets/javascripts/load_kindeditor.coffee"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_kindeditor-0.5.1 lib/generators/rails_kindeditor/install/install_generator.rb