Sha256: 672fe5a54caf6c28c855a4f041ed6cfc37d2f9675bc68e56009327ebea843f09

Contents?: true

Size: 1.57 KB

Versions: 38

Compression:

Stored size: 1.57 KB

Contents

require File.expand_path('../lib/tinymce/rails/version', __FILE__)

def step(name)
  print "#{name} ..."
  yield
  puts " DONE"
end

def download(url, filename)
  puts "Downloading #{url} ..."
  `mkdir -p tmp`
  `curl -L -# #{url} -o tmp/#{filename}`
end

desc "Update TinyMCE to version #{TinyMCE::Rails::TINYMCE_VERSION}"
task :update => [ :fetch, :extract, :rename ]

task :fetch do
  download("http://download.ephox.com/tinymce/community/tinymce_#{TinyMCE::Rails::TINYMCE_VERSION}.zip", "tinymce.zip")
  download("http://download.ephox.com/tinymce/community/tinymce_#{TinyMCE::Rails::TINYMCE_VERSION}_dev.zip", "tinymce.dev.zip")
end

task :extract do
  step "Extracting core files" do
    `rm -rf tmp/tinymce`
    `unzip -u tmp/tinymce.zip -d tmp`
    `rm -rf vendor/assets/javascripts/tinymce`
    `mkdir -p vendor/assets/javascripts/tinymce`
    `mv tmp/tinymce/js/tinymce/* vendor/assets/javascripts/tinymce/`
  end

  step "Extracting unminified source" do
   `rm -rf tmp/tinymce`
   `unzip -u tmp/tinymce.dev.zip -d tmp`
   `mkdir -p app/assets/source/tinymce`
   `mv tmp/tinymce/js/tinymce/tinymce.js app/assets/source/tinymce/tinymce.js`
  end
end

task :rename do
  step "Renaming files" do
    Dir["vendor/assets/javascripts/tinymce/**/*.min.js"].each do |file|
      FileUtils.mv(file, file.sub(/\.min\.js$/, '.js'))
    end

    Dir["vendor/assets/javascripts/tinymce/**/*.min.css"].each do |file|
      FileUtils.cp(file, file.sub(/\.min\.css$/, '.css'))
    end
  end
end

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

require "bundler/gem_tasks"

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
tinymce-rails-7.5.1 Rakefile
tinymce-rails-7.5.0 Rakefile
tinymce-rails-6.8.5 Rakefile
tinymce-rails-7.4.1 Rakefile
tinymce-rails-7.4.0 Rakefile
tinymce-rails-7.3.0 Rakefile
tinymce-rails-7.2.1 Rakefile
tinymce-rails-6.8.4 Rakefile
tinymce-rails-7.2.0 Rakefile
tinymce-rails-7.1.2.1 Rakefile
tinymce-rails-7.1.2 Rakefile
tinymce-rails-7.0.1 Rakefile
tinymce-rails-7.0.0.1 Rakefile
tinymce-rails-6.8.3 Rakefile
tinymce-rails-6.8.2 Rakefile
tinymce-rails-6.8.1 Rakefile
tinymce-rails-6.8.0 Rakefile
tinymce-rails-6.7.2 Rakefile
tinymce-rails-6.7.1 Rakefile
tinymce-rails-6.7.0 Rakefile