Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make version detection more robust

  • Loading branch information...
commit bacbc87ceecfd115a7fc7623f5975ee676780772 1 parent 259dce5
Cody Fauser authored
Showing with 11 additions and 11 deletions.
  1. +11 −11 Rakefile
22 Rakefile
View
@@ -56,17 +56,17 @@ namespace :schema do
task :update_version do
schema = File.dirname(__FILE__) + '/lib/ebay/schema/ebaySvc.xsd'
# Update the schema version string
- version = File.open(schema) do |f|
- version_string = f.gets
- version_string.match(/Version (\d+)/)
- $1
- end
-
- version_file_path = File.dirname(__FILE__) + "/lib/ebay/schema/version.rb"
- version_file = File.read(version_file_path)
- version_file.gsub!(/VERSION = \d+/, "VERSION = #{version}")
- File.open(version_file_path, 'w') do |f|
- f.puts version_file
+
+ File.read(schema) =~ /Version (\d+)/m
+ if version = $1
+ version_file_path = File.dirname(__FILE__) + "/lib/ebay/schema/version.rb"
+ version_file = File.read(version_file_path)
+ version_file.gsub!(/VERSION = \d+/, "VERSION = #{version}")
+ File.open(version_file_path, 'w') do |f|
+ f.puts version_file
+ end
+ else
+ raise "Unable to parse the version from the schema"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.