Build Status Code Climate Coverage Status

ember_cli_deploy_redis

Ruby interaction with the Ahalogy fork of ember-cli-deploy-redis to support ember-cli project deployments.

ember-cli-deploy-redis stores deployment information including the index page contents in Redis. This gem allows access to that content so that it can be served.

Installing

gem install ember_cli_deploy_redis

Or if you are using bundler add to your Gemfile:

gem ember_cli_deploy_redis, '~> 0.0.1'

Usage

Configuration

EmberCliDeployRedis.configure do |config|
  config.default_app_name = "ember_cli_project_name"
  # Optional:
  config.keyspace = "optional_redis_keyspace"
end

Getting all deployed revisions for the default app

EmberCliDeployRedis.revisions

This will raise an EmberCliDeployRedis::ConfigurationError if default_app_name was not configured.

Getting the currently-active revision for the default app

EmberCliDeployRedis.active_revision

This will raise an EmberCliDeployRedis::ConfigurationError if default_app_name was not configured.

Get a specific app

EmberCliDeployRedis::Application.new('app_name')

Get specific revision from an app

application.revision_by_name('revision_identifier')

Getting the contents of a deployed file

EmberCliDeployRedis.active_revision.contents_of('index.html')

This will raise an EmberCliDeployRedis::FileMissingFromDeployment if the file is not present in Redis.

Web UI

Borrowed from the awesome Sidekiq Web UI.

Add sinatra to your Gemfile:

# if you require 'sinatra' you get the DSL extended to Object
gem 'sinatra', :require => nil

Add the following to your config/routes.rb:

require 'ember_cli_deploy_redis/web'
mount EmberCliDeployRedis::Web => '/sidekiq'

This interface allows the display of the currently-active revision and the most recent revisions.

It also includes "test" link for each non-active revision. This is done using a query parameter, the name of which is set in the revision_specifier_query_param configuration variable.

Configuration

EmberCliDeployRedis.configure do |config|
  # By default, the default_app_name is used. Otherwise, you can specify multiple app names:
  config.web_application_names = %w(application1 application2)

  # To enable "test" links for revisions:
  config.revision_specifier_query_param = "_ember_app"

  # To perform an action when a revision is made active:
  config.on_revision_activated do |new_revision|
    # Slack webhook here!
  end

  # By default, the web interface will assume that the Rack app it's mounted in will have sessions
  # enabled. If not, issue the following:
  # EmberCliDeployRedis::Web.enable_sessions!
end

To Do

  • Support for the activated revision instead of just the most recent.