This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Rakefile
75 lines (64 loc) · 1.61 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
# -*- ruby -*-
require "rubygems"
require 'rake/clean'
require 'fileutils'
require 'find'
@package='simp-processgraph'
@rakefile_dir=File.dirname(__FILE__)
CLEAN.include "#{@package}-*.gem"
CLEAN.include 'pkg'
CLEAN.include 'dist'
CLEAN.include 'spec.log'
Find.find( @rakefile_dir ) do |path|
if File.directory? path
CLEAN.include path if File.basename(path) == 'tmp'
else
Find.prune
end
end
desc 'default - help'
task :default => [:help]
task :test => [:spec]
desc 'help'
task :help do
sh 'rake -T'
end
#desc 'Ensure gemspec-safe permissions on all files'
#task :chmod do
# gemspec = File.expand_path( "#{@package}.gemspec", @rakefile_dir ).strip
# spec = Gem::Specification::load( gemspec )
# spec.files.each do |file|
# FileUtils.chmod 'go=r', file
# end
#end
desc 'run all RSpec tests'
task :spec do
Dir.chdir @rakefile_dir
rtnval = `rspec spec > spec.log`
puts " test results are #{$?}, logged in spec.log"
if $? != 0
puts IO.read('spec.log')
else
puts "spec tests passed - results are #{$?}, logged in spec.log"
end
end
namespace :pkg do
desc "build rubygem package for #{@package}"
task :gem do
Dir.chdir @rakefile_dir
Dir['*.gemspec'].each do |spec_file|
cmd = %Q{SIMP_RPM_BUILD=1 gem build "#{spec_file}"}
sh cmd
FileUtils.mkdir_p 'dist'
FileUtils.mv Dir.glob("#{@package}*.gem"), 'dist/'
end
end
desc "build and install rubygem package for #{@package}"
task :install_gem => [:clean, :gem] do
Dir.chdir @rakefile_dir
Dir.glob("dist/#{@package}*.gem") do |pkg|
sh %Q{gem install #{pkg}}
end
end
end
# vim: syntax=ruby