Sha256: adee7caa2ac11d26afc5a9d1e6d520e085c30d5cc5d2fc3657eed8613ff5827d

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

module EmberCliDeployRedis
  class Configuration
    attr_accessor :redis

    def keyspace
      @keyspace ||= 'ember-cli-deploy'
    end

    attr_writer :keyspace

    attr_reader :default_app_name

    def default_app_name=(name)
      fail ArgumentError, "default_app_name has already been set" if @default_app_name
      @default_app_name = name
    end

    # Array of names of Ember applications that will be supported.
    def web_application_names
      @web_application_names ||= [default_app_name]
    end

    def web_application_names=(names)
      fail ArgumentError, "names must be an array" unless names.respond_to? :each
      @web_application_names = names
    end

    attr_reader :revision_specifier_query_param
    def revision_specifier_query_param=(param_name)
      @revision_specifier_query_param = param_name
    end

    def on_revision_activated(&block)
      @on_revision_activated_block = block
    end

    attr_reader :on_revision_activated_block

    def revision_has_been_activated(revision)
      @on_activate_revision_block.call(revision) if @on_activate_revision_block
    end

    def redis_key_for_revision_list(application)
      [keyspace, application.name].compact.join(":")
    end

    def redis_key_for_revision_file(application, revision, filename)
      [[redis_key_for_revision_list(application), revision].join(":"), filename].join("/")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ember_cli_deploy_redis-1.0.2 lib/ember_cli_deploy_redis/configuration.rb
ember_cli_deploy_redis-1.0.1 lib/ember_cli_deploy_redis/configuration.rb
ember_cli_deploy_redis-1.0.0 lib/ember_cli_deploy_redis/configuration.rb