Sha256: 97657a7b5cc7abec1c83e19c09875a69e77c0079bf74bc182cb59865744d8166

Contents?: true

Size: 1.52 KB

Versions: 53

Compression:

Stored size: 1.52 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 jQuery & unminified source files" do
   `rm -rf tmp/tinymce`
   `unzip -u tmp/tinymce.dev.zip -d tmp`
   `mv tmp/tinymce/js/tinymce/jquery.tinymce.min.js vendor/assets/javascripts/tinymce/jquery.tinymce.js`
   `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
  end
end


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

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
tinymce-rails-4.9.11 Rakefile
tinymce-rails-4.9.10 Rakefile
tinymce-rails-4.9.8 Rakefile
tinymce-rails-4.9.7.1 Rakefile
tinymce-rails-4.9.7 Rakefile
tinymce-rails-4.9.6 Rakefile
tinymce-rails-4.9.4 Rakefile
tinymce-rails-5.0.2 Rakefile
tinymce-rails-5.0.1 Rakefile
tinymce-rails-5.0.0 Rakefile
tinymce-rails-4.9.3 Rakefile
tinymce-rails-4.9.2 Rakefile
tinymce-rails-4.9.1 Rakefile
tinymce-rails-4.9.0 Rakefile
tinymce-rails-4.8.4 Rakefile
tinymce-rails-4.8.3 Rakefile
tinymce-rails-4.8.2 Rakefile
tinymce-rails-4.8.1 Rakefile
tinymce-rails-4.8.0 Rakefile
tinymce-rails-4.7.13 Rakefile