forked from Nerian/bootstrap-wysihtml5-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
55 lines (44 loc) · 1.54 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
50
51
52
53
54
55
#!/usr/bin/env rake
require File.expand_path('../lib/bootstrap-wysihtml5-rails/version', __FILE__)
require 'json'
BASE_FOLDER = 'bower_components/bootstrap3-wysihtml5-bower/dist'
def copy_locales
Dir["#{BASE_FOLDER}/locales/*"].each do |file|
`cp #{file} vendor/assets/javascripts/bootstrap-wysihtml5/locales/#{File.basename(file).gsub('bootstrap-wysihtml5.', '')}`
end
end
def copy_javascript
`cp #{BASE_FOLDER}/bootstrap3-wysihtml5.all.min.js vendor/assets/javascripts/bootstrap-wysihtml5/bootstrap3-wysihtml5.js`
end
def copy_css
`cp #{BASE_FOLDER}/bootstrap3-wysihtml5.css vendor/assets/stylesheets/bootstrap-wysihtml5/bootstrap3-wysihtml5.css`
end
def print_version
puts "bootstrap3-wysihtml5-bower #{JSON.parse(File.read(BASE_FOLDER + '/../.bower.json'))['version']}"
puts "bootstrap-wysihtml5-rails #{BootstrapWysihtml5Rails::Rails::VERSION}"
end
desc "Update assets"
task 'update' do
if Dir.exist?('bootstrap-wysihtml5')
system("bower update bootstrap3-wysihtml5-bower")
else
system("bower install bootstrap3-wysihtml5-bower")
end
copy_locales
copy_javascript
copy_css
system("git status")
print_version
end
desc "Build"
task "build" do
system("gem build bootstrap-wysihtml5-rails.gemspec")
end
desc "Publish a new version"
task :publish => :build do
tags = `git tag`.split
version = BootstrapWysihtml5Rails::Rails::VERSION
system("git tag -a #{version} -m 'Release #{version}' ") unless tags.include?(version)
system("gem push bootstrap-wysihtml5-rails-#{version}.gem")
system("git push --follow-tags")
end