Rakefile in switchery-rails-0.8.1 vs Rakefile in switchery-rails-0.8.1.1
- old
+ new
@@ -1,10 +1,14 @@
require 'bundler/gem_tasks'
require 'fileutils'
desc 'Update the Switchery Javascript and CSS files'
-task :update_switchery do
+task :update do
+ def remove_extra_version(version)
+ version.scan(/(\d\.\d\.\d)/).flatten.first
+ end
+
def download_switchery(version)
base_url = 'https://raw.githubusercontent.com/abpetkov/switchery'
puts "Downlading Switchery #{version} ..."
`curl -o vendor/assets/javascripts/switchery.js \
#{base_url}/#{version}/dist/switchery.js`
@@ -12,8 +16,8 @@
#{base_url}/#{version}/dist/switchery.css`
end
FileUtils.mkdir_p('vendor/assets/javascripts')
FileUtils.mkdir_p('vendor/assets/stylesheets')
- download_switchery(Switchery::Rails::VERSION)
+ download_switchery(remove_extra_version(Switchery::Rails::VERSION))
puts "\e[32mDone!\e[0m"
end