OSDN Git Service

refactoring decimal method
[mint/mint-lib.git] / Rakefile
1 # -*- coding: utf-8 -*-
2
3 require 'spec/rake/spectask'
4 require 'rake/gempackagetask'
5 require 'rake/rdoctask'
6
7 # For code statistics (use rails task)
8 rails_path = Gem.path.map {|d| Dir[d + '/gems/rails-*'] }.flatten.reverse.
9   find {|d| File.exist?(File.join(d, 'lib', 'code_statistics.rb')) }
10
11 if rails_path
12
13   STATS_DIRECTORIES = [ %w[Apps  lib], %w[Specs spec] ]
14
15   desc "Report code statistics (KLOCs, etc) from the application"
16   task :stats do
17     require File.join(rails_path, 'lib', 'code_statistics.rb')
18     require 'tasks/spec_statistics'
19     SpecStatistics.new(*STATS_DIRECTORIES).to_s
20   end
21 end
22
23 desc 'Run all specs (default)'
24 task :default => :spec
25
26 desc 'Run all specs'
27 Spec::Rake::SpecTask.new do |t|
28   t.spec_files = FileList['spec/**/*_spec.rb']
29   t.spec_opts = ['-c']
30 end
31
32 desc 'Run generator specs'
33 Spec::Rake::SpecTask.new('spec:generator') do |t|
34   t.spec_files = FileList['spec/generator/**/*_spec.rb']
35   t.spec_opts = ['-c']
36 end
37
38 desc 'Run solver specs'
39 Spec::Rake::SpecTask.new('spec:solver') do |t|
40   t.spec_files = FileList['spec/solver/**/*_spec.rb']
41   t.spec_opts = ['-c']
42 end
43
44 PKG_FILES = FileList[
45   'lib/**/*.rb',
46   'spec/**/*_spec.rb',
47   'Rakefile',
48 ]
49
50 spec = Gem::Specification.new do |s|
51   s.name = 'mint-lib'
52   s.version = '0.0.1'
53   s.author = 'Good-Day, Inc.'
54   s.email = 'info@good-day.co.jp'
55   s.homepage = 'http://www.good-day.jp/'
56   s.platform = Gem::Platform::RUBY
57   s.summary = 'Generates mathematical problem and solves it'
58   s.files = PKG_FILES.to_a
59   s.require_path = 'lib'
60   s.has_rdoc = false
61   s.extra_rdoc_files = ['README.rdoc']
62 end
63
64 desc 'Turn this library into a gem.'
65 Rake::GemPackageTask.new(spec) do |pkg|
66   pkg.gem_spec = spec
67 end
68
69 desc 'Generate documentation for the mint-lib.'
70 Rake::RDocTask.new(:rdoc) do |rdoc|
71   rdoc.rdoc_dir = 'rdoc'
72   rdoc.title    = 'mint-lib'
73   rdoc.options << '--line-numbers' << '--inline-source'
74   rdoc.rdoc_files.include('README.rdoc')
75   rdoc.rdoc_files.include('lib/**/*.rb')
76   rdoc.rdoc_files.exclude('lib/**/mint_expression_parser.rb')
77 end
78
79 namespace :dev do
80   desc 'Uninstall and Install mint-lib (for dev)'
81   task :install do
82     system 'rm -rf pkg'
83     system 'rake gem'
84     system 'gem uninstall mint-lib'
85     system 'gem install pkg/mint-lib --no-rdoc --no-ri'
86   end
87 end
88