forked from assaf/vanity
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added upgrade command. When upgrading to 1.4 (or even head, from now …
…on), please run: vanity upgrade Using Redis namespace and all Vanity objects are now in the vanity: namespace.
- Loading branch information
Showing
14 changed files
with
103 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Vanity | ||
module Commands | ||
class << self | ||
# Upgrade to newer version of Vanity (this usually means doing magic in | ||
# the database) | ||
def upgrade | ||
if Vanity.playground.connection.respond_to?(:redis) | ||
redis = Vanity.playground.connection.redis | ||
# Upgrade metrics from 1.3 to 1.4 | ||
keys = redis.keys("metrics:*") | ||
if keys.empty? | ||
puts "No metrics to upgrade" | ||
else | ||
puts "Updating #{keys.map { |name| name.split(":")[1] }.uniq.length} metrics" | ||
keys.each do |key| | ||
redis.renamenx key, "vanity:#{key}" | ||
end | ||
end | ||
# Upgrade experiments from 1.3 to 1.4 | ||
keys = redis.keys("vanity:1:*") | ||
if keys.empty? | ||
puts "No experiments to upgrade" | ||
else | ||
puts "Updating #{keys.map { |name| name.split(":")[2] }.uniq.length} experiments" | ||
keys.each do |key| | ||
redis.renamenx key, key.gsub(":1:", ":experiments:") | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters