Class: JsonVersioner
Constant Summary collapse
- VERSION_REGEX =
/^(\s\s['\"]version['\"]:\s['\"])(.*)(['\"])/i
Instance Method Summary collapse
Methods inherited from Versioner
for, #get_next_version, #increment_version, #initialize
Constructor Details
This class inherits a constructor from Versioner
Instance Method Details
#get_current_version ⇒ Object
132 133 134 |
# File 'lib/rake-extensions.rb', line 132 def get_current_version() current_version_with_regex(['package.json'], VERSION_REGEX) end |
#update_version(new_version) ⇒ Object
135 136 137 138 139 140 141 142 143 |
# File 'lib/rake-extensions.rb', line 135 def update_version(new_version) FileUtils.cd @version_dir, :verbose => false do ['package.json'].each do |file| text = File.read(file) new_contents = text.gsub(VERSION_REGEX, "\\1#{new_version}\\3") File.open(file, "w") { |f| f.puts new_contents } end end end |