hitimes 1.1.1-x86-mingw32 → 1.2.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/CONTRIBUTING.md +45 -0
- data/{HISTORY → HISTORY.md} +42 -18
- data/LICENSE +11 -8
- data/Manifest.txt +45 -0
- data/README.md +163 -0
- data/Rakefile +23 -62
- data/ext/hitimes/c/extconf.rb +24 -0
- data/ext/hitimes/{hitimes_ext.c → c/hitimes.c} +1 -1
- data/ext/hitimes/{hitimes_instant_clock_gettime.c → c/hitimes_instant_clock_gettime.c} +0 -0
- data/ext/hitimes/c/hitimes_instant_osx.c +45 -0
- data/ext/hitimes/{hitimes_instant_windows.c → c/hitimes_instant_windows.c} +0 -0
- data/ext/hitimes/{hitimes_interval.c → c/hitimes_interval.c} +15 -7
- data/ext/hitimes/{hitimes_interval.h → c/hitimes_interval.h} +5 -5
- data/ext/hitimes/{hitimes_stats.c → c/hitimes_stats.c} +0 -0
- data/ext/hitimes/{hitimes_stats.h → c/hitimes_stats.h} +0 -0
- data/ext/hitimes/java/src/hitimes/Hitimes.java +54 -0
- data/ext/hitimes/java/src/hitimes/HitimesInterval.java +181 -0
- data/ext/hitimes/java/src/hitimes/HitimesService.java +16 -0
- data/ext/hitimes/java/src/hitimes/HitimesStats.java +112 -0
- data/lib/hitimes.rb +15 -5
- data/lib/hitimes/1.9/hitimes.so +0 -0
- data/lib/hitimes/2.0/hitimes.so +0 -0
- data/lib/hitimes/2.1/hitimes.so +0 -0
- data/lib/hitimes/version.rb +1 -50
- data/spec/hitimes_spec.rb +14 -0
- data/spec/interval_spec.rb +40 -37
- data/spec/metric_spec.rb +8 -10
- data/spec/mutex_stats_spec.rb +10 -8
- data/spec/paths_spec.rb +3 -5
- data/spec/spec_helper.rb +9 -3
- data/spec/stats_spec.rb +28 -30
- data/spec/timed_metric_spec.rb +42 -42
- data/spec/timed_value_metric_spec.rb +54 -55
- data/spec/value_metric_spec.rb +26 -28
- data/spec/version_spec.rb +4 -30
- data/tasks/default.rake +242 -0
- data/tasks/extension.rake +31 -101
- data/tasks/this.rb +206 -0
- metadata +158 -145
- data/README +0 -135
- data/ext/hitimes/extconf.rb +0 -17
- data/ext/hitimes/hitimes_instant_osx.c +0 -16
- data/gemspec.rb +0 -64
- data/lib/hitimes/1.8/hitimes_ext.so +0 -0
- data/lib/hitimes/1.9/hitimes_ext.so +0 -0
- data/tasks/announce.rake +0 -42
- data/tasks/config.rb +0 -109
- data/tasks/distribution.rake +0 -93
- data/tasks/documentation.rake +0 -32
- data/tasks/rspec.rake +0 -33
- data/tasks/rubyforge.rake +0 -55
- data/tasks/utils.rb +0 -80
data/README
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
== hitimes
|
2
|
-
|
3
|
-
* Homepage[http://copiousfreetime.rubyforge.org/hitimes]
|
4
|
-
* {Rubyforge project}[http://rubyforge.org/projects/copiousfreetime/]
|
5
|
-
* email jeremy at copiousfreetime dot org
|
6
|
-
* git clone url git://github.com/copiousfreetime/hitimes.git
|
7
|
-
|
8
|
-
== INSTALL
|
9
|
-
|
10
|
-
* gem install hitimes
|
11
|
-
|
12
|
-
== DESCRIPTION
|
13
|
-
|
14
|
-
Hitimes is a fast, high resolution timer library for recording
|
15
|
-
performance metrics. It uses the appropriate low method calls for each
|
16
|
-
system to get the highest granularity time increments possible.
|
17
|
-
|
18
|
-
It currently supports any of the following systems:
|
19
|
-
|
20
|
-
* any system with the POSIX call <tt>clock_gettime()</tt>,
|
21
|
-
* Mac OS X
|
22
|
-
* Windows
|
23
|
-
* JRuby
|
24
|
-
|
25
|
-
Using Hitimes can be faster than using a series of +Time.new+ calls, and
|
26
|
-
it will have a much higher granularity. It is definitely faster than
|
27
|
-
using +Process.times+.
|
28
|
-
|
29
|
-
== SYNOPSIS
|
30
|
-
|
31
|
-
=== Interval
|
32
|
-
|
33
|
-
Use Hitimes::Interval to calculate only the duration of a block of code
|
34
|
-
|
35
|
-
duration = Hitimes::Interval.measure do
|
36
|
-
# some operation ...
|
37
|
-
end
|
38
|
-
|
39
|
-
puts duration
|
40
|
-
|
41
|
-
=== TimedMetric
|
42
|
-
|
43
|
-
Use a Hitimes::TimedMetric to calculate statistics about an iterative operation
|
44
|
-
|
45
|
-
timed_metric = Hitimes::TimedMetric.new('operation on items')
|
46
|
-
|
47
|
-
Explicitly use +start+ and +stop+:
|
48
|
-
|
49
|
-
collection.each do |item|
|
50
|
-
timed_metric.start
|
51
|
-
# .. do something with item
|
52
|
-
timed_metric.stop
|
53
|
-
end
|
54
|
-
|
55
|
-
Or use the block. In TimedMetric the return value of +measure+ is the return
|
56
|
-
value of the block
|
57
|
-
|
58
|
-
collection.each do |item|
|
59
|
-
result_of_do_something = timed_metric.measure { do_something( item ) }
|
60
|
-
end
|
61
|
-
|
62
|
-
And then look at the stats
|
63
|
-
|
64
|
-
puts timed_metric.mean
|
65
|
-
puts timed_metric.max
|
66
|
-
puts timed_metric.min
|
67
|
-
puts timed_metric.stddev
|
68
|
-
puts timed_metric.rate
|
69
|
-
|
70
|
-
=== ValueMetric
|
71
|
-
|
72
|
-
Use a Hitimes::ValueMetric to calculate statistics about measured samples
|
73
|
-
|
74
|
-
value_metric = Hitimes::ValueMetric.new( 'size of thing' )
|
75
|
-
loop do
|
76
|
-
# ... do stuff changing sizes of 'thing'
|
77
|
-
value_metric.measure( thing.size )
|
78
|
-
# ... do other stuff that may change size of thing
|
79
|
-
end
|
80
|
-
|
81
|
-
puts value_metric.mean
|
82
|
-
puts value_metric.max
|
83
|
-
puts value_metric.min
|
84
|
-
puts value_metric.stddev
|
85
|
-
puts value_metric.rate
|
86
|
-
|
87
|
-
|
88
|
-
=== TimedValueMetric
|
89
|
-
|
90
|
-
Use a Hitimes::TimedValueMetric to calculate statistics about batches of samples
|
91
|
-
|
92
|
-
timed_value_metric = Hitimes::TimedValueMetric.new( 'batch times' )
|
93
|
-
loop do
|
94
|
-
batch = ... # get a batch of things
|
95
|
-
timed_value_metric.start
|
96
|
-
# .. do something with batch
|
97
|
-
timed_value_metric.stop( batch.size )
|
98
|
-
end
|
99
|
-
|
100
|
-
puts timed_value_metric.rate
|
101
|
-
|
102
|
-
puts timed_value_metric.timed_stats.mean
|
103
|
-
puts timed_value_metric.timed_stats.max
|
104
|
-
puts timed_value_metric.timed_stats.min
|
105
|
-
puts timed_value_metric.timed_stats.stddev
|
106
|
-
|
107
|
-
puts timed_value_metric.value_stats.mean
|
108
|
-
puts timed_value_metric.value_stats.max
|
109
|
-
puts timed_value_metric.value_stats.min
|
110
|
-
puts timed_value_metric.value_stats.stddev
|
111
|
-
|
112
|
-
|
113
|
-
== CHANGES
|
114
|
-
|
115
|
-
Read the HISTORY file.
|
116
|
-
|
117
|
-
== CREDITS
|
118
|
-
|
119
|
-
* Bruce Williams for suggesting the idea
|
120
|
-
|
121
|
-
== ISC License
|
122
|
-
|
123
|
-
Copyright (c) 2008 Jeremy Hinegardner
|
124
|
-
|
125
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
126
|
-
purpose with or without fee is hereby granted, provided that the above
|
127
|
-
copyright notice and this permission notice appear in all copies.
|
128
|
-
|
129
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
130
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
131
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
132
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
133
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
134
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
135
|
-
PERFORMANCE OF THIS SOFTWARE.
|
data/ext/hitimes/extconf.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'mkmf'
|
3
|
-
|
4
|
-
if Config::CONFIG['host_os'] =~ /darwin/ then
|
5
|
-
$CFLAGS += " -DUSE_INSTANT_OSX=1 -Wall"
|
6
|
-
$LDFLAGS += " -framework CoreServices"
|
7
|
-
elsif Config::CONFIG['host_os'] =~ /win32/ or Config::CONFIG['host_os'] =~ /mingw/ then
|
8
|
-
$CFLAGS += " -DUSE_INSTANT_WINDOWS=1"
|
9
|
-
else
|
10
|
-
if have_library("rt", "clock_gettime") then
|
11
|
-
$CFLAGS += " -DUSE_INSTANT_CLOCK_GETTIME=1"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# put in a different location if on windows so we can have fat binaries
|
16
|
-
subdir = RUBY_VERSION.gsub(/\.\d$/,'')
|
17
|
-
create_makefile("hitimes/#{subdir}/hitimes_ext")
|
@@ -1,16 +0,0 @@
|
|
1
|
-
#ifdef USE_INSTANT_OSX
|
2
|
-
|
3
|
-
#include "hitimes_interval.h"
|
4
|
-
#include <CoreServices/CoreServices.h>
|
5
|
-
|
6
|
-
/*
|
7
|
-
* returns the number of nanoseconds since the machine was booted
|
8
|
-
*/
|
9
|
-
hitimes_instant_t hitimes_get_current_instant( )
|
10
|
-
{
|
11
|
-
Nanoseconds nano = AbsoluteToNanoseconds( UpTime() );
|
12
|
-
|
13
|
-
return *( hitimes_instant_t *)&nano;
|
14
|
-
}
|
15
|
-
|
16
|
-
#endif
|
data/gemspec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'hitimes/version'
|
3
|
-
require 'tasks/config'
|
4
|
-
|
5
|
-
Hitimes::GEM_SPEC = Gem::Specification.new do |spec|
|
6
|
-
proj = Configuration.for('project')
|
7
|
-
spec.name = proj.name
|
8
|
-
spec.version = Hitimes::VERSION
|
9
|
-
|
10
|
-
spec.author = proj.author
|
11
|
-
spec.email = proj.email
|
12
|
-
spec.homepage = proj.homepage
|
13
|
-
spec.summary = proj.summary
|
14
|
-
spec.description = proj.description
|
15
|
-
spec.platform = Gem::Platform::RUBY
|
16
|
-
|
17
|
-
|
18
|
-
pkg = Configuration.for('packaging')
|
19
|
-
spec.files = pkg.files.all
|
20
|
-
spec.executables = pkg.files.bin.collect { |b| File.basename(b) }
|
21
|
-
|
22
|
-
# add dependencies here
|
23
|
-
spec.add_development_dependency("rake", "~> 0.8.1")
|
24
|
-
spec.add_development_dependency("configuration", " ~> 0.0.5")
|
25
|
-
spec.add_development_dependency( "json", "~> 1.1.3")
|
26
|
-
spec.add_development_dependency( "rake-compiler", "~> 0.5.0")
|
27
|
-
|
28
|
-
if ext_conf = Configuration.for_if_exist?("extension") then
|
29
|
-
spec.extensions << ext_conf.configs
|
30
|
-
spec.require_paths << 'ext'
|
31
|
-
spec.extensions.flatten!
|
32
|
-
end
|
33
|
-
|
34
|
-
if rdoc = Configuration.for_if_exist?('rdoc') then
|
35
|
-
spec.has_rdoc = true
|
36
|
-
spec.extra_rdoc_files = pkg.files.rdoc
|
37
|
-
spec.rdoc_options = rdoc.options + [ "--main" , rdoc.main_page ]
|
38
|
-
else
|
39
|
-
spec.has_rdoc = false
|
40
|
-
end
|
41
|
-
|
42
|
-
if test = Configuration.for_if_exist?('testing') then
|
43
|
-
spec.test_files = test.files
|
44
|
-
end
|
45
|
-
|
46
|
-
if rf = Configuration.for_if_exist?('rubyforge') then
|
47
|
-
spec.rubyforge_project = rf.project
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
Hitimes::GEM_SPEC_MSWIN32 = Hitimes::GEM_SPEC.clone
|
52
|
-
Hitimes::GEM_SPEC_MSWIN32.platform = ::Gem::Platform.new( "i386-mswin32" )
|
53
|
-
Hitimes::GEM_SPEC_MSWIN32.extensions = []
|
54
|
-
|
55
|
-
Hitimes::GEM_SPEC_MINGW32= Hitimes::GEM_SPEC.clone
|
56
|
-
Hitimes::GEM_SPEC_MINGW32.platform = ::Gem::Platform.new( "i386-mingw32" )
|
57
|
-
Hitimes::GEM_SPEC_MINGW32.extensions = []
|
58
|
-
|
59
|
-
Hitimes::GEM_SPEC_JAVA = Hitimes::GEM_SPEC.clone
|
60
|
-
Hitimes::GEM_SPEC_JAVA.platform = ::Gem::Platform.new( 'java' )
|
61
|
-
Hitimes::GEM_SPEC_JAVA.extensions = []
|
62
|
-
|
63
|
-
Hitimes::SPECS = [ Hitimes::GEM_SPEC, Hitimes::GEM_SPEC_MSWIN32, Hitimes::GEM_SPEC_MINGW32, Hitimes::GEM_SPEC_JAVA ]
|
64
|
-
|
Binary file
|
Binary file
|
data/tasks/announce.rake
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'tasks/config'
|
2
|
-
#-------------------------------------------------------------------------------
|
3
|
-
# announcement methods
|
4
|
-
#-------------------------------------------------------------------------------
|
5
|
-
|
6
|
-
proj_config = Configuration.for('project')
|
7
|
-
namespace :announce do
|
8
|
-
desc "create email for ruby-talk"
|
9
|
-
task :email do
|
10
|
-
info = Utils.announcement
|
11
|
-
|
12
|
-
File.open("email.txt", "w") do |mail|
|
13
|
-
mail.puts "From: #{proj_config.author} <#{proj_config.email}>"
|
14
|
-
mail.puts "To: ruby-talk@ruby-lang.org"
|
15
|
-
mail.puts "Date: #{Time.now.rfc2822}"
|
16
|
-
mail.puts "Subject: [ANN] #{info[:subject]}"
|
17
|
-
mail.puts
|
18
|
-
mail.puts info[:title]
|
19
|
-
mail.puts
|
20
|
-
mail.puts "{{ Release notes for Version #{Hitimes::VERSION} }}"
|
21
|
-
mail.puts
|
22
|
-
mail.puts info[:release_notes]
|
23
|
-
mail.puts
|
24
|
-
mail.puts " #{info[:urls]}"
|
25
|
-
mail.puts
|
26
|
-
mail.puts "=== Installation"
|
27
|
-
mail.puts
|
28
|
-
mail.puts " gem install #{Hitimes::GEM_SPEC.name}"
|
29
|
-
mail.puts
|
30
|
-
mail.puts "=== Description"
|
31
|
-
mail.puts
|
32
|
-
mail.puts info[:description]
|
33
|
-
end
|
34
|
-
puts "Created the following as email.txt:"
|
35
|
-
puts "-" * 72
|
36
|
-
puts File.read("email.txt")
|
37
|
-
puts "-" * 72
|
38
|
-
end
|
39
|
-
|
40
|
-
CLOBBER << "email.txt"
|
41
|
-
end
|
42
|
-
|
data/tasks/config.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'configuration'
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'tasks/utils'
|
5
|
-
require 'yaml'
|
6
|
-
|
7
|
-
#-----------------------------------------------------------------------
|
8
|
-
# General project configuration
|
9
|
-
#-----------------------------------------------------------------------
|
10
|
-
Configuration.for('project') {
|
11
|
-
name "hitimes"
|
12
|
-
version Hitimes::Version.to_s
|
13
|
-
author "Jeremy Hinegardner"
|
14
|
-
email "jeremy at copiousfreetime dot org"
|
15
|
-
homepage "http://copiousfreetime.rubyforge.org/hitimes/"
|
16
|
-
description Utils.section_of("README", "description")
|
17
|
-
summary description.split(".").first
|
18
|
-
history "HISTORY"
|
19
|
-
license FileList["LICENSE"]
|
20
|
-
readme "README"
|
21
|
-
}
|
22
|
-
|
23
|
-
#-----------------------------------------------------------------------
|
24
|
-
# Packaging
|
25
|
-
#-----------------------------------------------------------------------
|
26
|
-
Configuration.for('packaging') {
|
27
|
-
# files in the project
|
28
|
-
proj_conf = Configuration.for('project')
|
29
|
-
files {
|
30
|
-
bin FileList["bin/*"]
|
31
|
-
ext FileList["ext/hitimes/*.{c,h,rb}"]
|
32
|
-
examples FileList["examples/*.rb"]
|
33
|
-
lib FileList["lib/**/*.rb"]
|
34
|
-
test FileList["spec/**/*.rb", "test/**/*.rb"]
|
35
|
-
data FileList["data/**/*"]
|
36
|
-
tasks FileList["tasks/**/*.r{ake,b}"]
|
37
|
-
rdoc FileList[proj_conf.readme, proj_conf.history,
|
38
|
-
proj_conf.license] + lib + FileList["ext/*.c"]
|
39
|
-
all bin + examples + ext + lib + test + data + rdoc + tasks + FileList["Rakefile"]
|
40
|
-
}
|
41
|
-
|
42
|
-
# ways to package the results
|
43
|
-
formats {
|
44
|
-
tgz true
|
45
|
-
zip true
|
46
|
-
rubygem Configuration::Table.has_key?('gem')
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
#-----------------------------------------------------------------------
|
51
|
-
# Gem packaging
|
52
|
-
#-----------------------------------------------------------------------
|
53
|
-
Configuration.for("gem") {
|
54
|
-
spec "gemspec.rb"
|
55
|
-
Configuration.for('packaging').files.all << spec
|
56
|
-
}
|
57
|
-
|
58
|
-
#-----------------------------------------------------------------------
|
59
|
-
# Testing
|
60
|
-
# - change mode to 'testunit' to use unit testing
|
61
|
-
#-----------------------------------------------------------------------
|
62
|
-
Configuration.for('test') {
|
63
|
-
mode "spec"
|
64
|
-
files Configuration.for("packaging").files.test
|
65
|
-
options %w[ --format specdoc --color ]
|
66
|
-
ruby_opts %w[ ]
|
67
|
-
}
|
68
|
-
|
69
|
-
#-----------------------------------------------------------------------
|
70
|
-
# Rcov
|
71
|
-
#-----------------------------------------------------------------------
|
72
|
-
Configuration.for('rcov') {
|
73
|
-
output_dir "coverage"
|
74
|
-
libs %w[ lib ]
|
75
|
-
rcov_opts %w[ --html ]
|
76
|
-
ruby_opts %w[ ]
|
77
|
-
test_files Configuration.for('packaging').files.test
|
78
|
-
}
|
79
|
-
|
80
|
-
#-----------------------------------------------------------------------
|
81
|
-
# Rdoc
|
82
|
-
#-----------------------------------------------------------------------
|
83
|
-
Configuration.for('rdoc') {
|
84
|
-
files Configuration.for('packaging').files.rdoc
|
85
|
-
main_page files.first
|
86
|
-
title Configuration.for('project').name
|
87
|
-
options %w[ --line-numbers ]
|
88
|
-
output_dir "doc"
|
89
|
-
}
|
90
|
-
|
91
|
-
#-----------------------------------------------------------------------
|
92
|
-
# Extension
|
93
|
-
#-----------------------------------------------------------------------
|
94
|
-
Configuration.for('extension') {
|
95
|
-
configs Configuration.for('packaging').files.ext.find_all { |x| %w[ mkrf_conf.rb extconf.rb ].include?(File.basename(x)) }
|
96
|
-
cross_rbconfig ::YAML::load_file( File.expand_path("~/.rake-compiler/config.yml"))
|
97
|
-
}
|
98
|
-
|
99
|
-
#-----------------------------------------------------------------------
|
100
|
-
# Rubyforge
|
101
|
-
#-----------------------------------------------------------------------
|
102
|
-
Configuration.for('rubyforge') {
|
103
|
-
project "copiousfreetime"
|
104
|
-
user "jjh"
|
105
|
-
host "rubyforge.org"
|
106
|
-
rdoc_location "#{user}@#{host}:/var/www/gforge-projects/#{project}/hitimes"
|
107
|
-
}
|
108
|
-
|
109
|
-
|
data/tasks/distribution.rake
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
require 'tasks/config'
|
2
|
-
|
3
|
-
#-------------------------------------------------------------------------------
|
4
|
-
# Distribution and Packaging
|
5
|
-
#-------------------------------------------------------------------------------
|
6
|
-
if pkg_config = Configuration.for_if_exist?("packaging") then
|
7
|
-
|
8
|
-
require 'gemspec'
|
9
|
-
require 'rake/gempackagetask'
|
10
|
-
require 'rake/contrib/sshpublisher'
|
11
|
-
|
12
|
-
namespace :dist do
|
13
|
-
|
14
|
-
Rake::GemPackageTask.new(Hitimes::GEM_SPEC) do |pkg|
|
15
|
-
pkg.need_tar = pkg_config.formats.tgz
|
16
|
-
pkg.need_zip = pkg_config.formats.zip
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "Install as a gem"
|
20
|
-
task :install => [:clobber, :package] do
|
21
|
-
sh "sudo gem install pkg/#{Hitimes::GEM_SPEC.full_name}.gem"
|
22
|
-
end
|
23
|
-
|
24
|
-
desc "Uninstall gem"
|
25
|
-
task :uninstall do
|
26
|
-
sh "sudo gem uninstall -x #{Hitimes::GEM_SPEC.name}"
|
27
|
-
end
|
28
|
-
|
29
|
-
desc "dump gemspec"
|
30
|
-
task :gemspec do
|
31
|
-
puts Hitimes::GEM_SPEC.to_ruby
|
32
|
-
end
|
33
|
-
|
34
|
-
desc "dump gemspec for win"
|
35
|
-
task :gemspec_win do
|
36
|
-
puts Hitimes::GEM_SPEC_WIN.to_ruby
|
37
|
-
end
|
38
|
-
|
39
|
-
desc "dump gemspec for java"
|
40
|
-
task :gemspec_java do
|
41
|
-
puts Hitimes::GEM_SPEC_JAVA.to_ruby
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "reinstall gem"
|
45
|
-
task :reinstall => [:uninstall, :repackage, :install]
|
46
|
-
|
47
|
-
desc "package up a windows gem"
|
48
|
-
task :package_win => :clean do
|
49
|
-
Configuration.for("extension").cross_rbconfig.keys.each do |rbconfig|
|
50
|
-
v = rbconfig.split("-").last
|
51
|
-
s = v.sub(/\.\d$/,'')
|
52
|
-
sh "rake ext:build_win-#{v}"
|
53
|
-
mkdir_p "lib/hitimes/#{s}", :verbose => true
|
54
|
-
cp "ext/hitimes/hitimes_ext.so", "lib/hitimes/#{s}/", :verbose => true
|
55
|
-
end
|
56
|
-
|
57
|
-
Hitimes::SPECS.each do |spec|
|
58
|
-
next if spec.platform == "ruby"
|
59
|
-
spec.files += FileList["lib/hitimes/{1.8,1.9}/**.{dll,so}"]
|
60
|
-
Gem::Builder.new( spec ).build
|
61
|
-
mkdir "pkg" unless File.directory?( 'pkg' )
|
62
|
-
mv Dir["*.gem"].first, "pkg"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
if RUBY_PLATFORM == "java" then
|
67
|
-
desc "package up a jruby gem"
|
68
|
-
task :package_java => "ext:build_java" do
|
69
|
-
Hitimes::GEM_SPEC_JAVA.files += FileList["lib/hitimes/*.jar"]
|
70
|
-
Hitimes::GEM_SPEC_JAVA.files += FileList["ext/java/src/hitimes/*.java"]
|
71
|
-
Gem::Builder.new( Hitimes::GEM_SPEC_JAVA ).build
|
72
|
-
mv Dir["*.gem"].first, "pkg"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
task :clobber do
|
77
|
-
rm_rf "lib/hitimes/1.8"
|
78
|
-
rm_rf "lib/hitimes/1.9"
|
79
|
-
rm_rf "lib/hitimes/*.jar"
|
80
|
-
end
|
81
|
-
|
82
|
-
task :prep => [:clean, :package, :package_win, :package_java ]
|
83
|
-
|
84
|
-
desc "distribute copiously"
|
85
|
-
task :copious => [:clean, :package, :package_win, :package_java ] do
|
86
|
-
gems = Hitimes::SPECS.collect { |s| "#{s.full_name}.gem" }
|
87
|
-
Rake::SshFilePublisher.new('jeremy@copiousfreetime.org',
|
88
|
-
'/var/www/vhosts/www.copiousfreetime.org/htdocs/gems/gems',
|
89
|
-
'pkg', *gems).upload
|
90
|
-
sh "ssh jeremy@copiousfreetime.org rake -f /var/www/vhosts/www.copiousfreetime.org/htdocs/gems/Rakefile"
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|