This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Rakefile
83 lines (69 loc) · 2.46 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# encoding: utf-8
require 'rubygems'
require 'bundler'
require "bundler/gem_tasks"
require 'rake/version_task'
Rake::VersionTask.new
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "toastr-rails"
gem.version = File.open('VERSION').read
gem.authors = ["Tyler Gannon"]
gem.email = ["tgannon@gmail.com"]
gem.homepage = "https://github.com/tylergannon/toastr-rails"
gem.summary = "Toastr: Simple javascript toast notifications"
gem.description = "Toastr: Simple javascript toast notifications, plugged into the rails asset pipeline."
gem.required_rubygems_version = ">= 1.3.6"
gem.add_runtime_dependency "railties", ">= 3.1.0"
gem.add_development_dependency "bundler", ">= 1.1.3"
gem.add_development_dependency "jeweler", ">= 1.8.3"
gem.add_development_dependency "version"
gem.files = `git ls-files`.split("\n").reject { |f| f =~ /^tests/ || f =~ /\A\./ }
gem.require_path = 'lib'
end
Jeweler::RubygemsDotOrgTasks.new
namespace :submodules do
desc "Initialize git submodules"
task :init do
system "git submodule init"
system "git submodule update"
end
end
namespace :toastr do
desc "Update Toastr"
task :update => 'submodules:init' do
files = {
File.join('toastr', 'toastr.min.js') => File.join('vendor', 'assets', 'javascripts', 'toastr.min.js'),
File.join('toastr', 'toastr.min.css') => File.join('vendor', 'assets', 'stylesheets', 'toastr.min.css')
}
files.each do |source, destination|
cp source, destination, verbose: true
system "git add '#{destination}'"
end
version = File.open(File.join('toastr', 'nuget', 'content', 'scripts', 'toastr.js')).read.match(/version\s+\=\s+['"]?([\d\.]+)/i)[1]
if version
ENV['VERSION'] = version
Rake::Task["version:create"].invoke
system "git add VERSION"
puts "Updated toastr and bumped version to #{version}"
system "git commit -m 'Updated toastr and bumped version to #{version}'"
end
end
end
task :default => :test
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "toastr-rails #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end