Sha256: 7ca679e0fd243f9c5caa0c86e02de00e1712f667e0a956d796c8609e2b07bedc

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'lib/amrita2/version'

Gem.manage_gems

TMP='/tmp'
PACKAGE_NAME = "amrita2"
PACKAGE_VERSION = Amrita2::Version::STRING
package_name = "#{PACKAGE_NAME}-#{PACKAGE_VERSION}"
package_dir = "pkg"
package_dir_path = "#{package_dir}/#{package_name}"

tar_file = "#{package_name}.tar.gz"
gem_file = "#{package_name}.gem"

ENV['RUBYLIB'] = "lib"

task :default => [ :specs, :test_login_engine, :spec1 ]
task :test => [ :specs ]

desc "Run all specs"
Spec::Rake::SpecTask.new('specs') do |t|
  t.spec_files = FileList['specs/**/*.rb']
  t.spec_opts = %w(-Du)
end

desc "Run all specs one by one"
task :spec1 do
  tmp = "/tmp/amrita_spec.out"
  Dir['specs/**/*.rb'].each do |f|
    begin
      sh %{spec #{f} > #{tmp} }
      sh %{spec -r amrita2/gettext #{f} > #{tmp} }
    rescue
      puts File::open(tmp).read
      raise
    end
  end
end

task :clean do
  Dir['**/*~'].each do |f|
    puts f
    FileUtils::rm_f f
  end

  Dir['docs'].each do |f|
    puts f
    FileUtils::rm_rf f
  end
end

task :test_login_engine do
  Dir::chdir("sample/login_engine") do
    Dir::mkdir "log" unless FileTest::directory?("log")
    sh %{rake test}
  end
end

desc "Generate documentation for the application"
Rake::RDocTask.new("appdoc") { |rdoc|
  rdoc.rdoc_dir = 'docs/app'
  rdoc.title    = "Amrita2 Documentation"
  rdoc.rdoc_files = Dir['lib/amrita2/*.rb']
  rdoc.rdoc_files  << 'README'
}

task :tar do
  Dir::chdir(TMP) do
    system 'rm -rf amrita2'
    system "svn export http://svn.brain-tokyo.net/amrita2/trunk/amrita2 #{package_name}"
    system "tar zcvf #{tar_file} #{package_name}"
  end
end

task :gem => :clean do
  spec = eval(File.read("amrita2.gemspec"))
  Gem::Builder.new(spec).build
  mv gem_file, "#{TMP}/#{gem_file}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amrita2-2.0.2 Rakefile