Class: EmberCliDeployRedis::Revision

Inherits:
Object
  • Object
show all
Defined in:
lib/ember_cli_deploy_redis/revision.rb

Overview

A single revision that has been deployed to Redis. Fetches the contents of deployed files for the given revision.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application, name) ⇒ Revision

Returns a new instance of Revision.



13
14
15
16
# File 'lib/ember_cli_deploy_redis/revision.rb', line 13

def initialize(application, name)
  self.application = application
  self.name = name
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



5
6
7
# File 'lib/ember_cli_deploy_redis/revision.rb', line 5

def application
  @application
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/ember_cli_deploy_redis/revision.rb', line 6

def name
  @name
end

Class Method Details

.active_from_redis(application) ⇒ Object



8
9
10
11
# File 'lib/ember_cli_deploy_redis/revision.rb', line 8

def self.active_from_redis(application)
  revision_name = active_revision_from_redis(application)
  new application, revision_name if revision_name
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
# File 'lib/ember_cli_deploy_redis/revision.rb', line 26

def ==(other)
  other.name == name
end

#activate!Object



30
31
32
33
# File 'lib/ember_cli_deploy_redis/revision.rb', line 30

def activate!
  key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application)
  EmberCliDeployRedis.configuration.redis.lpush(key, name)
end

#active?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/ember_cli_deploy_redis/revision.rb', line 22

def active?
  self == application.active_revision
end

#contents_of(filename) ⇒ Object



18
19
20
# File 'lib/ember_cli_deploy_redis/revision.rb', line 18

def contents_of(filename)
  contents_of_file_from_redis(filename)
end