Debian Codegraph @

src/ruby/Rakefile

raw
1 # Copyright 2014 John O. Woods ([email protected]), West Virginia
2 # University's Applied Space Exploration Lab, and West Virginia Robotic
3 # Technology Center. All rights reserved.
4 #
5 # THE BSD LICENSE
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 #
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 require 'rubygems'
29 require 'rubygems/package_task'
30 require 'bundler'
31 begin
32 Bundler.setup(:default, :development)
33 rescue
34 $stderr.puts e.message
35 $stderr.puts "Run `bundle install` to install missing gems"
36 exit e.status_code
37 end
38
39 require 'rake'
40
41 gemspec = eval(IO.read("flann.gemspec"))
42
43 Gem::PackageTask.new(gemspec).define
44
45 desc "install the gem locally"
46 task :install => [:package] do
47 sh %{gem install pkg/flann-#{NMatrix::VERSION}.gem}
48 end
49
50
51 require 'rspec/core/rake_task'
52 require 'rspec/core'
53 require 'rspec/core/rake_task'
54 RSpec::Core::RakeTask.new(:spec) do |spec|
55 spec.pattern = FileList['spec/**/*_spec.rb'].uniq
56 end
57
58 task :console do |task|
59 cmd = [ 'irb', "-r './lib/flann.rb'" ]
60 run *cmd
61 end
62
63 task :pry do |task|
64 cmd = [ 'pry', "-r './lib/flann.rb'" ]
65 run *cmd
66 end
67
68
69 task :default => :spec
70
71 def run *cmd
72 sh(cmd.join(" "))
73 end
74
75
76 desc "Check the manifest for correctness"
77 task :check_manifest do |task|
78 manifest_files = File.read("Manifest.txt").split
79
80 git_files = `git ls-files |grep -v 'spec/'`.split
81 ignore_files = %w{.gitignore .rspec}
82
83 possible_files = git_files - ignore_files
84
85 missing_files = possible_files - manifest_files
86 extra_files = manifest_files - possible_files
87
88 unless missing_files.empty?
89 STDERR.puts "The following files are in the git repo but not the Manifest:"
90 missing_files.each { |f| STDERR.puts " -- #{f}"}
91 end
92
93 unless extra_files.empty?
94 STDERR.puts "The following files are in the Manifest but may not be necessary:"
95 extra_files.each { |f| STDERR.puts " -- #{f}"}
96 end
97
98 if extra_files.empty? && missing_files.empty?
99 STDERR.puts "Manifest looks good!"
100 end
101
102 end
103
104
105 require "rdoc/task"
106 RDoc::Task.new do |rdoc|
107 rdoc.main = "README.rdoc"
108 rdoc.rdoc_files.include(%w{README.rdoc History.txt LICENSE.txt lib/flann/**/*.rb})
109 end
110
111 # vim: syntax=ruby