Skip to content
Browse files

update rakefile

  • Loading branch information...
1 parent d993f07 commit cc0480076d81a9a004ace2015d76cf6d87c08d8a @kakugawa kakugawa committed Dec 7, 2010
Showing with 45 additions and 6 deletions.
  1. +45 −6 Rakefile
View
51 Rakefile
@@ -1,10 +1,49 @@
-require 'rubygems' unless ENV['NO_RUBYGEMS']
+require 'rubygems'
+require 'yaml'
+require 'json'
+require 'date'
-desc "runs ant tests"
-task :test do
- system('ant test') || raise("Build failed")
+def conformance_version(dir)
+ require 'digest'
+ Dir[File.join(dir, '*')].inject(Digest::SHA1.new){|digest, file| digest.update(Digest::SHA1.file(file).hexdigest) }
end
-desc "runs cruise control build"
-task :cruise => [:test] do
+namespace :test do
+ namespace :conformance do
+ desc "Update conformance testing data"
+ task :update do
+ puts "Updating conformance data ... "
+ system("git submodule init") || raise("Failed to init submodule")
+ system("git submodule update") || raise("Failed to update submodule")
+ puts "Updating conformance data ... DONE"
+ end
+
+ desc "Change conformance test data to the lastest version"
+ task :latest => ['conformance:update'] do
+ current_dir = File.dirname(__FILE__)
+ submodule_dir = File.join(File.dirname(__FILE__), "test-data", "twitter-text-conformance")
+ version_before = conformance_version(submodule_dir)
+ system("cd #{submodule_dir} && git pull origin master") || raise("Failed to pull submodule version")
+ system("cd #{current_dir}")
+ if conformance_version(submodule_dir) != version_before
+ system("cd #{current_dir} && git add #{submodule_dir}") || raise("Failed to add upgrade files")
+ system("git commit -m \"Upgraded to the latest conformance suite\" #{submodule_dir}") || raise("Failed to commit upgraded conformacne data")
+ puts "Upgraded conformance suite."
+ else
+ puts "No conformance suite changes."
+ end
+ end
+
+ desc "Run conformance test suite"
+ task :run do
+ exec('mvn test')
+ end
+ end
+
+ desc "Run conformance test suite"
+ task :conformance => ['conformance:latest', 'conformance:run'] do
+ end
end
+
+desc "Run conformance test suite"
+task :test => ['test:conformance']

0 comments on commit cc04800

Please sign in to comment.
Something went wrong with that request. Please try again.