Rakefile in twitter-text-1.0 vs Rakefile in twitter-text-1.0.1
- old
+ new
@@ -3,25 +3,26 @@
require 'rake/rdoctask'
require 'rubygems/specification'
require 'date'
require 'spec/rake/spectask'
require 'spec/rake/verify_rcov'
+require 'digest'
spec = Gem::Specification.new do |s|
s.name = "twitter-text"
- s.version = "1.0"
+ s.version = "1.0.1"
s.author = "Matt Sanford"
s.email = "matt@twitter.com"
s.homepage = "http://twitter.com"
s.description = s.summary = "A gem that provides text handling for Twitter"
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.summary = "Twitter text handling library"
- s.add_dependency "action_view"
+ s.add_dependency "actionpack"
s.require_path = 'lib'
s.autorequire = ''
s.files = %w(LICENSE README.rdoc Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
end
@@ -39,27 +40,50 @@
t.spec_files = FileList['spec/**/*.rb']
t.rcov = true
t.rcov_opts = ['--exclude', 'spec']
end
+
+def conformance_version(dir)
+ Dir[File.join(dir, '*')].inject(Digest::SHA1.new){|digest, file| digest.update(Digest::SHA1.file(file).hexdigest) }
+end
+
namespace :test do
namespace :conformance do
+
+
desc "Update conformance testing data"
task :update do
- dir = File.join(File.dirname(__FILE__), "test", "twitter-text-conformance")
puts "Updating conformance data ... "
- system("cd #{dir} && git pull origin master") || exit(1)
+ 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", "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
ruby "test/conformance_test.rb"
end
end
desc "Run conformance test suite"
- task :conformance => ['conformance:update', 'conformance:run'] do
+ task :conformance => ['conformance:latest', 'conformance:run'] do
end
end
namespace :doc do