Skip to content

Commit

Permalink
set_version_info.rb now receives addon's version via CLI arg
Browse files Browse the repository at this point in the history
  • Loading branch information
mooz committed Feb 15, 2015
1 parent c6cb53a commit 6cba8b1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions set_version_info.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/usr/bin/env ruby

require "readline"
current_addon_version = File.read("./install.rdf").match(/(<em:version>)(.*?)(<\/em:version>)/)[2]

version = Readline.readline("Input next version of this addon: ", true)
max_version = Readline.readline("Input next max version for target application: ", true)
if ARGV.length != 1
puts "Usage: #{__FILE__} ADDON_VERSION"
puts "Current version #{current_addon_version}"
exit
end

addon_version = ARGV[0]

replace_info = {
"install.rdf" => {
/(<em:version>)(.*?)(<\/em:version>)/ => version,
/(<em:maxVersion>)(.*?)(<\/em:maxVersion>)/ => max_version,
/(<em:version>)(.*?)(<\/em:version>)/ => addon_version
},
"update.rdf" => {
/(updateinfo\/)(.*?)(\.xhtml)/ => version,
/(em:version=")(.*?)(")/ => version,
/(em:maxVersion=")(.*?)(")/ => max_version
/(updateinfo\/)(.*?)(\.xhtml)/ => addon_version,
/(em:version=")(.*?)(")/ => addon_version,
},
}

Expand Down

0 comments on commit 6cba8b1

Please sign in to comment.