-
Notifications
You must be signed in to change notification settings - Fork 179
/
Rakefile
49 lines (41 loc) · 1.93 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env rake
require 'json'
require File.expand_path('../lib/bootstrap-datepicker-rails/version', __FILE__)
desc "Update assets"
task :update do
if ARGV.count > 1
checkout_branch = "tags/#{ARGV.last}"
task ARGV.last.to_sym {}
else
checkout_branch = "`git describe --abbrev=0 --tags`"
end
if Dir.exist?('bootstrap-datepicker-src')
system("cd bootstrap-datepicker-src && git checkout master && git pull && git checkout #{checkout_branch}")
else
system("git clone [email protected]:uxsolutions/bootstrap-datepicker.git bootstrap-datepicker-src")
system("cd bootstrap-datepicker-src && git checkout #{checkout_branch}")
end
system("cp bootstrap-datepicker-src/dist/css/bootstrap-datepicker.css vendor/assets/stylesheets/bootstrap-datepicker.css")
system("cp bootstrap-datepicker-src/dist/css/bootstrap-datepicker3.css vendor/assets/stylesheets/bootstrap-datepicker3.css")
system("cp bootstrap-datepicker-src/dist/js/bootstrap-datepicker.js vendor/assets/javascripts/bootstrap-datepicker/core.js")
system("rm -rf vendor/assets/javascripts/bootstrap-datepicker/locales/*")
system("cp bootstrap-datepicker-src/js/locales/*.js vendor/assets/javascripts/bootstrap-datepicker/locales/")
system("git status")
puts "\n"
puts "bootstrap-datepicker version: #{JSON.parse(File.read('./bootstrap-datepicker-src/package.json'))['version']}"
puts "bootstrap-datepicker-rails version: #{BootstrapDatepickerRails::Rails::VERSION}"
end
desc "Build"
task "build" do
system("gem build bootstrap-datepicker-rails.gemspec")
end
desc "Build and publish the gem"
task :publish => :build do
tags = `git tag`.split
current_version = BootstrapDatepickerRails::Rails::VERSION
system("git tag -a #{current_version} -m 'Release #{current_version}'") unless tags.include?(current_version)
system("gem push bootstrap-datepicker-rails-#{current_version}.gem")
system("git push --follow-tags")
end
task :release => :publish do
end