Rakefile in flatpickr-3.0.7.0 vs Rakefile in flatpickr-4.5.2.0
- old
+ new
@@ -1,29 +1,37 @@
+# frozen_string_literal: true
+
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'flatpickr/version'
RSpec::Core::RakeTask.new(:spec)
-task :default => :spec
+task default: :spec
namespace :flatpickr do
namespace :assets do
- desc 'Update Flatpickr\'s assets.'
+ desc 'Update Flatpickr assets from source.'
task update: :clean do
version = ARGV[1] || "v#{Flatpickr::VERSION.sub(/.\d+$/, '')}"
- sh 'git clone git@github.com:chmln/flatpickr.git flatpickr_source'
+ sh 'git clone git@github.com:flatpickr/flatpickr.git flatpickr_source'
sh "cd flatpickr_source && git checkout tags/#{version}"
+ sh 'cd flatpickr_source && npm install && npm run build:pre && npm run build:build'
sh 'cp flatpickr_source/dist/flatpickr.js vendor/assets/javascripts/flatpickr.js'
+ sh 'cp -R flatpickr_source/dist/plugins/ vendor/assets/javascripts/flatpickr/plugins/'
+ sh 'cd vendor/assets/javascripts/flatpickr/plugins/ && find . -name "*.css" -type f -delete'
sh 'cp -R flatpickr_source/dist/l10n/ vendor/assets/javascripts/flatpickr/l10n/'
- sh 'cp flatpickr_source/dist/flatpickr.min.css vendor/assets/stylesheets/flatpickr.css'
- sh 'cp -R flatpickr_source/dist/rtl/ vendor/assets/stylesheets/flatpickr/rtl/'
+ sh 'cp flatpickr_source/dist/flatpickr.css vendor/assets/stylesheets/flatpickr.css'
+ sh 'cp -R flatpickr_source/dist/plugins/ vendor/assets/stylesheets/flatpickr/plugins/'
+ sh 'cd vendor/assets/stylesheets/flatpickr/plugins/ && find . -name "*.js" -type f -delete'
sh 'cp -R flatpickr_source/dist/themes/ vendor/assets/stylesheets/flatpickr/themes/'
+ sh 'cp flatpickr_source/dist/ie.css vendor/assets/stylesheets/flatpickr/ie.css'
- puts "\n=*=*=*=*=*=*=*=*=*=*\n=* ASSETS UPDATED! *=\n=*=*=*=*=*=*=*=*=*=*\n"
+ puts "\n===============================\n"
+ puts "ASSETS UPDATED to #{version}! ✨"
end
desc 'Remove previous Flatpickr assets.'
task :clean do
sh 'rm -rf vendor'