Sha256: 757c20f99904c2e6649aeccc1a3901edb85437b7763e2cb3696d9cf0bbf5befd
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
module EmberCliDeployRedis # A single revision that has been deployed to Redis. # Fetches the contents of deployed files for the given revision. class Revision attr_reader :application attr_reader :name def self.active_from_redis(application) revision_name = active_revision_from_redis(application) new application, revision_name if revision_name end def initialize(application, name) self.application = application self.name = name end def contents_of(filename) contents_of_file_from_redis(filename) end def active? self == application.active_revision end def ==(other) other.name == name end def activate! key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application) EmberCliDeployRedis.configuration.redis.lpush(key, name) end private attr_writer :application attr_writer :name def self.active_revision_from_redis(application) key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application) names = EmberCliDeployRedis.configuration.redis.lrange(key, 0, 0) names.first end def contents_of_file_from_redis(filename) key = EmberCliDeployRedis.configuration.redis_key_for_revision_file( application, name, filename, ) contents = EmberCliDeployRedis.configuration.redis.get(key) unless contents fail( EmberCliDeployRedis::FileMissingFromDeployment, "The file '#{filename}' was not deployed to Redis", ) end contents end end end
Version data entries
3 entries across 3 versions & 1 rubygems