forked from shvets/google-translate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
65 lines (51 loc) · 1.32 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
# Rakefile for google_translate
require 'rubygems'
require 'rake/gempackagetask'
require 'rake/testtask'
require 'spec/rake/spectask'
require 'rake/rdoctask'
require 'rcov/rcovtask'
spec_name = 'google_translate.gemspec'
SPEC = Gem::Specification.load(spec_name)
Rake::GemPackageTask.new(SPEC) do |pkg|
pkg.need_tar = true
pkg.need_zip = true
end
Spec::Rake::SpecTask.new do |task|
task.libs << 'lib'
task.pattern = 'spec/**/*_spec.rb'
task.verbose = false
end
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'teststuff'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Rcov::RcovTask.new do |task|
task.libs << 'test'
task.test_files = FileList['test/**/*_test.rb']
task.verbose = true
end
desc "Run gem code locally"
task :"run:gem" do
command = "bin/translate " + ENV['params']
puts ruby "#{command}"
end
desc "test gem compatibility with github"
task :"github:validate" do
require 'yaml'
require 'rubygems/specification'
data = File.read(spec_name)
spec = nil
if data !~ %r{!ruby/object:Gem::Specification}
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
else
spec = YAML.load(data)
end
spec.validate
puts spec
puts "OK"
end
task :default => :rcov