[![Build Status](https://travis-ci.org/Ahalogy/ember_cli_deploy_redis_ruby.svg?branch=master)](https://travis-ci.org/Ahalogy/ember_cli_deploy_redis_ruby) [![Code Climate](https://codeclimate.com/github/Ahalogy/ember_cli_deploy_redis_ruby/badges/gpa.svg)](https://codeclimate.com/github/Ahalogy/ember_cli_deploy_redis_ruby) [![Coverage Status](https://coveralls.io/repos/Ahalogy/ember_cli_deploy_redis_ruby/badge.svg?branch=master&service=github)](https://coveralls.io/github/Ahalogy/ember_cli_deploy_redis_ruby?branch=master) # ember_cli_deploy_redis Ruby interaction with [the Ahalogy fork of ember-cli-deploy-redis][2] to support [ember-cli][1] project deployments. [ember-cli-deploy-redis][2] stores deployment information including the index page contents in Redis. This gem allows access to that content so that it can be served. ## Installing ```ruby gem install ember_cli_deploy_redis ``` Or if you are using bundler add to your Gemfile: ```ruby gem ember_cli_deploy_redis, '~> 0.0.1' ``` ## Usage ### Configuration ```ruby 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 ```ruby EmberCliDeployRedis.revisions ``` This will raise an `EmberCliDeployRedis::ConfigurationError` if `default_app_name` was not configured. ### Getting the currently-active revision for the default app ```ruby EmberCliDeployRedis.active_revision ``` This will raise an `EmberCliDeployRedis::ConfigurationError` if `default_app_name` was not configured. ### Get a specific app ```ruby EmberCliDeployRedis::Application.new('app_name') ``` ### Get specific revision from an app ```ruby application.revision_by_name('revision_identifier') ``` ### Getting the contents of a deployed file ```ruby 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](https://github.com/mperham/sidekiq/wiki/Monitoring). Add sinatra to your Gemfile: ```ruby # if you require 'sinatra' you get the DSL extended to Object gem 'sinatra', :require => nil ``` Add the following to your config/routes.rb: ```ruby 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 ```ruby 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. [1]: http://ember-cli.com "Ember CLI" [2]: https://github.com/Ahalogy/ember-cli-deploy-redis "ember-cli-deploy-redis"