forked from kfatehi/bait
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
72 lines (63 loc) · 1.5 KB
/
Copy pathRakefile
File metadata and controls
72 lines (63 loc) · 1.5 KB
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
ENV['RACK_ENV'] = "development"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :pry do
require 'pry'; binding.pry
end
namespace :assets do
task :precompile do
require 'bait'
Bait.assets.compile!
end
end
def git_master?
`git branch | grep '* master'`
$?.exitstatus == 0
end
namespace :git do
task :dirty do
if `git status --porcelain`.match(/M /)
puts "Dirty working tree! Commit first before building!"
exit
end
end
end
namespace :gem do
task :build do
`bundle install`
Rake::Task['assets:precompile'].invoke
Rake::Task['git:dirty'].invoke
if !git_master?
puts "I'll only build the gem on the master branch"
else
puts "On master branch, running test suite; please wait."
`rspec spec`
if $?.exitstatus != 0
puts "Uhh.. you have failing specs -- not building the gem"
else
puts "Specs pass. you're ready"
Rake::Task['git:dirty'].invoke
puts `gem build bait.gemspec`
puts "Done! You can gem push that now"
end
end
end
task :publish => :build do
require "bait/version"
gem = "bait-#{Bait::VERSION}.gem"
if File.exists?(gem)
begin
puts "Press any key to push to Rubygems"
STDIN.gets
puts "Pushing gem to rubygems"
puts `gem push #{gem}`
rescue Interrupt
puts "ancelled"
end
else
puts "File not found #{gem}"
end
end
end