summaryrefslogtreecommitdiff
path: root/Rakefile
blob: 2e3c60447717a1ecd033d35281fa1050d34cfda3 (plain)
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
begin
  require 'rake/testtask'
  require 'bundler'
  Bundler.setup
rescue LoadError
  warn 'bunler missing'
  exit 42
end

gemspec = eval(File.read(Dir['*.gemspec'].first))
file    = [gemspec.name, gemspec.version].join('-') + '.gem'

desc 'Validate gemspec'
task :gemspec do
  gemspec.validate
end

desc 'Run minitest'
task :test do
  Rake::TestTask.new do |t|
    t.libs.push "lib"
    t.test_files = FileList['spec/*_spec.rb']
    t.verbose = true
  end
end

desc 'Build gem'
task :build do
  system "gem build #{gemspec.name}.gemspec"
  FileUtils.mkdir_p 'gems'
  FileUtils.mv file, 'gems'
end

desc 'Install gem'
task :install => :build do
  system "sudo -E sh -c \'umask 022; gem install gems/#{file}\'"
end

desc 'Remove gems'
task :clean do
  FileUtils.rm_rf 'gems'
end

desc 'Push to rubygems'
task :push do
  system "gem push gems/#{file}"
end