-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
134 lines (114 loc) · 3.78 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/contrib/rubyforgepublisher'
require 'rake/contrib/sshpublisher'
require 'fileutils'
include FileUtils
load File.join(File.dirname(__FILE__), 'tasks', 'basic_config.rake')
NAME = "classx"
DESCRIPTION = <<-"END_DESCRIPTION"
Meta Framework extending and flexible attribute like Moose ( perl )
END_DESCRIPTION
BIN_FILES = %w( )
VERS = "0.0.7"
EXTRA_RDOC_FILES = []
HECKLE_ROOT_MODULES = ["Classx"]
SPEC = Gem::Specification.new do |s|
s.name = NAME
s.version = VERS
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = DEFAULT_EXTRA_RDOC_FILES + EXTRA_RDOC_FILES
s.rdoc_options += RDOC_OPTS + ['--title', "#{NAME} documentation", ]
s.summary = DESCRIPTION
s.description = DESCRIPTION
s.author = AUTHOR
s.email = EMAIL
s.homepage = HOMEPATH
s.executables = BIN_FILES
s.rubyforge_project = RUBYFORGE_PROJECT
s.bindir = "bin"
s.require_path = "lib"
s.autorequire = ""
s.test_files = Dir["spec/*_spec.rb"]
if Gem::RubyGemsVersion >= "1.2"
s.add_development_dependency('rspec', '>=1.1.4')
end
#s.required_ruby_version = '>= 1.8.2'
s.files = PKG_FILES + EXTRA_RDOC_FILES
s.extensions = EXTENSIONS
end
desc 'run benchmark script'
task :benchmark do
require 'pathname'
base_dir = Pathname(File.expand_path(File.join(File.dirname(__FILE__), 'bench')))
base_dir.children.each do |script|
next unless script.to_s =~ /\.rb$/
outfile = "#{script}.result.txt"
system("echo '--------------' >> #{outfile}")
system("git show HEAD --pretty=oneline --stat | head -n 1 >> #{outfile}")
system("echo '--------------' >> #{outfile}")
system("#{FileUtils::RUBY} #{script} >> #{outfile}")
end
end
desc 'run generate benchmark history'
task :benchmark_all do
require 'pathname'
require 'yaml'
base_dir = Pathname(File.expand_path(File.join(File.dirname(__FILE__), 'bench')))
base_dir.children.each do |script|
next unless script.to_s =~ /\.rb$/
# extract DATA section from script
yaml = ""
File.open(script) do |f|
rev_fg = false
f.each do |line|
if /^__END__$/ =~ line
rev_fg = true
next
end
next unless rev_fg
yaml << line
end
end
unless yaml == ""
outfile = "#{script}.result.txt"
rm outfile if File.exist? outfile
revisions = YAML.load(yaml)
tmp_script = "#{base_dir}/.backup.rb"
begin
cp script, tmp_script
system("echo '--------------' >> #{outfile}")
system("echo 'system infomation' >> #{outfile}")
system("echo '--------------' >> #{outfile}")
system("uname -a >> #{outfile}")
system("echo '--------------' >> #{outfile}")
system("vm_stat >> #{outfile}")
system("echo '--------------' >> #{outfile}")
system("#{FileUtils::RUBY} -v >> #{outfile}")
system("echo '--------------' >> #{outfile}")
revisions.each do |rev|
system("git checkout #{rev['sha1']}") or raise "git checkout failed!!"
system("echo '--------------' >> #{outfile}")
system("git show HEAD --pretty=oneline --stat | head -n 1 >> #{outfile}")
system("echo '--------------' >> #{outfile}")
system("#{FileUtils::RUBY} #{tmp_script} >> #{outfile}")
end
ensure
rm tmp_script
system("git checkout master")
end
end
end
end
def system str
warn "executed: #{str}"
super
end
task :package => [:benchmark_all]
import File.join(File.dirname(__FILE__), 'tasks', 'basic_tasks.rake')