forked from olbrich/ruby-units
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RakeFile
110 lines (92 loc) · 3.03 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
require 'rubygems'
require 'rake'
require 'rake/testtask'
require './lib/ruby-units'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "ruby-units"
gem.summary = %Q{A class that performs unit conversions and unit math}
gem.description = %Q{Provides classes and methods to perform unit math and conversions}
gem.authors = ["Kevin Olbrich, Ph.D."]
gem.email = ["kevin.olbrich+ruby_units@gmail.com"]
gem.homepage = "https://github.com/olbrich/ruby-units"
gem.files.exclude(".*")
gem.post_install_message = <<-EOS
====================
Deprecation Warning
====================
Several convenience methods that ruby-units added to the string class have
been deprecated in this release. These methods include String#to, String#from, String#ago, String#before and others.
If your code relies on these functions, they can be added back by adding this line to your code.
require 'ruby-units/string/extras'
# note that these methods do not play well with Rails, which is one of the reasons they are being removed.
The extra functions mostly work the same, but will no longer properly handle cases when they are called with strings..
'min'.from("4-1-2011") # => Exception
Pass in a Date, Time, or DateTime object to get the expected result.
They will probably go away completely in an upcoming release, so it would be a good idea to refactor your code
to avoid using them. They will also throw deprecation warnings when they are used.
EOS
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
begin
require 'rcov/rcovtask'
desc "Generate code coverage"
Rcov::RcovTask.new do |t|
t.test_files = FileList['test/test*.rb']
#t.verbose = true # uncomment to see the executed command
end
rescue LoadError
end
begin
require 'rspec/core/rake_task'
desc "Run specs"
RSpec::Core::RakeTask.new do |spec|
puts
puts %x{rvm current}
puts
end
desc "Run all specs with rcov"
RSpec::Core::RakeTask.new("spec:rcov") do |t|
t.rcov = true
t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/}
end
rescue LoadError
end
desc "Run unit tests"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/test*.rb']
end
task :specs => :spec
desc "Run tests against several ruby versions, requires rvm"
task :multitest do
rubies = %w{
ruby-1.8.7@ruby-units
ruby-1.8.7@ruby-units-with-chronic
ruby-1.9.2@ruby-units
ruby-1.9.2@ruby-units-with-chronic
ruby-1.9.3@ruby-units
rbx@ruby-units
jruby-1.6.4@ruby-units
}
exec "rvm #{rubies.join(',')} tests"
end
desc "Run specs against several ruby versions, requires rvm"
task :multispec do
rubies = %w{
ruby-1.8.7@ruby-units
ruby-1.8.7@ruby-units-with-chronic
ruby-1.9.2@ruby-units
ruby-1.9.2@ruby-units-with-chronic
ruby-1.9.3@ruby-units
rbx@ruby-units
jruby-1.6.4@ruby-units
}
exec "rvm #{rubies.join(',')} specs"
end
task :default => :test
task :tests => :test