-
Notifications
You must be signed in to change notification settings - Fork 21
/
Rakefile
41 lines (36 loc) · 1.05 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
require 'rubygems' unless defined?(Gem)
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rake/testtask'
%w(install release).each do |task|
Rake::Task[task].enhance do
sh "rm -rf pkg"
end
end
desc 'Bump version on github'
task :bump do
if `git status -s`.strip == ''
puts "\e[31mNothing to commit (working directory clean)\e[0m"
else
version = Bundler.load_gemspec(Dir[File.expand_path('../*.gemspec', __FILE__)].first).version
sh "git add .; git commit -a -m \"Bump to version #{version}\""
end
end
Rake::TestTask.new(:spec) do |t|
t.test_files = Dir['spec/**/*_spec.rb']
t.verbose = true
end
namespace :example do
Dir['./examples/*'].each do |path|
next if File.directory?(path)
name = File.basename(path)
desc "Run example #{name}"
task name, :fork do |t, args|
ENV['FORK'] = args[:fork]
log = File.expand_path("../log/#{name}.log", path)
exec "#{Gem.ruby} #{path} && sleep 5 && tail -f -n 150 #{log}; #{path} stop"
end
end
end
task :release => :bump
task :default => :spec