Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow gem version to be set inside lib/#{name}.rb

  • Loading branch information...
commit e7ac2ab7665493269dedbf3e039f703be2b6766d 1 parent 0a2a4df
@indirect indirect authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 lib/bundler/gem_helper.rb
View
14 lib/bundler/gem_helper.rb
@@ -101,10 +101,18 @@ def tag_version
end
def current_version
- unless File.exist?(version_file_path)
- raise("Version file could not be found at #{version_file_path}")
+ file = [version_file_path, library_file_path].find{|p| File.exist?(p) }
+ version = File.read(file)[/V(?i:ersion)\s*=\s*(["'])(.*?)\1/, 2]
+
+ unless version
+ raise("Version could not be found in lib/#{name}/version.rb")
+ else
+ version
end
- File.read(version_file_path)[/V(ERSION|ersion)\s*=\s*(["'])(.*?)\2/, 3]
+ end
+
+ def library_file_path
+ File.join(base, 'lib', "#{name}.rb")
end
def version_file_path
Please sign in to comment.
Something went wrong with that request. Please try again.