Rakefile in dbf-1.2.9 vs Rakefile in dbf-1.3.0
- old
+ new
@@ -1,40 +1,68 @@
-PROJECT_ROOT = File.expand_path(File.dirname(__FILE__))
-$: << File.join(PROJECT_ROOT, 'lib')
+# encoding: utf-8
require 'rubygems'
-require 'jeweler'
-require 'spec/rake/spectask'
+require 'rubygems/specification'
-Jeweler::Tasks.new do |s|
- s.name = 'dbf'
- s.description = 'A small fast library for reading dBase, xBase, Clipper and FoxPro database files.'
- s.summary = 'Read xBase files'
- s.platform = Gem::Platform::RUBY
- s.authors = ['Keith Morrison']
- s.email = 'keithm@infused.org'
- s.add_dependency('activesupport', ['>= 2.3.5'])
- s.add_dependency('fastercsv', ['>= 1.4.0'])
- s.homepage = 'http://github.com/infused/dbf'
+def gemspec
+ @gemspec ||= begin
+ file = File.expand_path('../dbf.gemspec', __FILE__)
+ eval(File.read(file), binding, file)
+ end
end
-Jeweler::GemcutterTasks.new
+begin
+ require 'rake/gempackagetask'
+rescue LoadError
+ task(:gem) { $stderr.puts '`gem install rake` to package gems' }
+else
+ Rake::GemPackageTask.new(gemspec) do |pkg|
+ pkg.gem_spec = gemspec
+ end
+ task :gem => :gemspec
+end
-task :default => :spec
+begin
+ require 'spec/rake/spectask'
+rescue LoadError
+ raise 'Run `gem install rspec` to be able to run specs'
+else
+ task :clear_tmp do
+ FileUtils.rm_rf(File.expand_path("../tmp", __FILE__))
+ end
-desc "Run specs"
-Spec::Rake::SpecTask.new :spec do |t|
- t.spec_files = FileList['spec/**/*spec.rb']
+ desc "Run specs"
+ Spec::Rake::SpecTask.new do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.spec_opts = %w(-fs --color)
+ t.warning = true
+ end
+ task :spec
end
-desc "Run rcov"
-Spec::Rake::SpecTask.new :rcov do |t|
- t.spec_files = FileList['spec/**/*spec.rb']
- t.rcov = true
- t.rcov_opts = ["--exclude ~\/.gem"]
+require 'rake'
+require 'rake/rdoctask'
+Rake::RDocTask.new { |rdoc|
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "DBF - A small fast library for reading dBase, xBase, Clipper and FoxPro database files."
+ rdoc.options << '--line-numbers'
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
+ rdoc.rdoc_files.include('README.md', 'docs/supported_types.markdown', 'lib/**/*.rb')
+}
+
+desc "install the gem locally"
+task :install => :package do
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
end
-desc "Run spec docs"
-Spec::Rake::SpecTask.new :specdoc do |t|
- t.spec_opts = ["-f specdoc"]
- t.spec_files = FileList['spec/**/*spec.rb']
+desc "validate the gemspec"
+task :gemspec do
+ gemspec.validate
end
+
+task :package => :gemspec
+task :default => :spec
+
+desc "Open an irb session preloaded with this library"
+task :console do
+ sh "irb -rubygems -I lib -r dbf.rb"
+end
\ No newline at end of file