ember_cli_deploy_redis 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +2 -0
- data/.jrubyrc +1 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/README.md +69 -15
- data/ember_cli_deploy_redis.gemspec +28 -25
- data/lib/ember_cli_deploy_redis.rb +8 -2
- data/lib/ember_cli_deploy_redis/application.rb +12 -1
- data/lib/ember_cli_deploy_redis/configuration.rb +31 -3
- data/lib/ember_cli_deploy_redis/errors.rb +1 -1
- data/lib/ember_cli_deploy_redis/revision.rb +17 -9
- data/lib/ember_cli_deploy_redis/revision_list.rb +12 -6
- data/lib/ember_cli_deploy_redis/version.rb +1 -1
- data/lib/ember_cli_deploy_redis/web.rb +59 -0
- data/lib/ember_cli_deploy_redis/web_helpers.rb +162 -0
- data/spec/lib/ember_cli_deploy_redis/application_spec.rb +12 -2
- data/spec/lib/ember_cli_deploy_redis/revision_list_spec.rb +34 -3
- data/spec/lib/ember_cli_deploy_redis/revision_spec.rb +29 -12
- data/spec/lib/ember_cli_deploy_redis/web_helpers_spec.rb +69 -0
- data/spec/lib/ember_cli_deploy_redis/web_spec.rb +164 -0
- data/spec/lib/ember_cli_deploy_redis_spec.rb +21 -8
- data/spec/spec_helper.rb +15 -5
- data/web/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
- data/web/assets/images/bootstrap/glyphicons-halflings.png +0 -0
- data/web/assets/javascripts/application.js +67 -0
- data/web/assets/javascripts/locales/README.md +27 -0
- data/web/assets/javascripts/locales/jquery.timeago.ar.js +96 -0
- data/web/assets/javascripts/locales/jquery.timeago.bg.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.bs.js +49 -0
- data/web/assets/javascripts/locales/jquery.timeago.ca.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.cs.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.cy.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.da.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.de.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.el.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.en-short.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.en.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.es.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.et.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.fa.js +22 -0
- data/web/assets/javascripts/locales/jquery.timeago.fi.js +28 -0
- data/web/assets/javascripts/locales/jquery.timeago.fr-short.js +16 -0
- data/web/assets/javascripts/locales/jquery.timeago.fr.js +17 -0
- data/web/assets/javascripts/locales/jquery.timeago.he.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.hr.js +49 -0
- data/web/assets/javascripts/locales/jquery.timeago.hu.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.hy.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.id.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.it.js +16 -0
- data/web/assets/javascripts/locales/jquery.timeago.ja.js +19 -0
- data/web/assets/javascripts/locales/jquery.timeago.ko.js +17 -0
- data/web/assets/javascripts/locales/jquery.timeago.lt.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.mk.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.nl.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.no.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.pl.js +31 -0
- data/web/assets/javascripts/locales/jquery.timeago.pt-br.js +16 -0
- data/web/assets/javascripts/locales/jquery.timeago.pt.js +16 -0
- data/web/assets/javascripts/locales/jquery.timeago.ro.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.rs.js +49 -0
- data/web/assets/javascripts/locales/jquery.timeago.ru.js +34 -0
- data/web/assets/javascripts/locales/jquery.timeago.sk.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.sl.js +44 -0
- data/web/assets/javascripts/locales/jquery.timeago.sv.js +18 -0
- data/web/assets/javascripts/locales/jquery.timeago.th.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.tr.js +16 -0
- data/web/assets/javascripts/locales/jquery.timeago.uk.js +34 -0
- data/web/assets/javascripts/locales/jquery.timeago.uz.js +19 -0
- data/web/assets/javascripts/locales/jquery.timeago.zh-cn.js +20 -0
- data/web/assets/javascripts/locales/jquery.timeago.zh-tw.js +20 -0
- data/web/assets/stylesheets/application.css +580 -0
- data/web/assets/stylesheets/bootstrap.css +9 -0
- data/web/locales/en.yml +13 -0
- data/web/views/_footer.erb +14 -0
- data/web/views/application.erb +38 -0
- data/web/views/dashboard.erb +26 -0
- data/web/views/layout.erb +26 -0
- metadata +89 -42
- data/Gemfile.lock +0 -121
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTBjNmE1MTRkMTg2NDY5ZGFjNzY3YTliZjQ4NGUxOTM1MWMxMTZiMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTgwYjZmYTdmZGUwYjQwMjUzMWI5N2I3ZDBmZTFjMjUwMDBhNjhhNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTQ5YmM1MDljMWMxMWYxMzk1M2JlZmVhOTExYTlmMDY5MDg3ZTc1ODBkYWVl
|
10
|
+
NDEwOWVhNmNkMGJlM2VhZDZkM2E3OGYxOTA0ZDM1MTY0YjQ2OTY3ZDQ3M2Fj
|
11
|
+
YjgxZTY0NTYyODUwNDQ4OGUxZGU0NmVkNTE5NTcxYWIwMmJmODU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2M3OTEyMmMwMDJkMDk3ZjNhZmY4ZmY0OTQwODQ2NWM4OTFjZTQ2NDE2MTZj
|
14
|
+
OWMzNmQyYzdhZmNhNTEzYjhmZGU4NDZmNmEwZWE1MGNlNDM2Y2ViZGFmMjI1
|
15
|
+
NDY4YzY5NTYyMGM3OGZiMjAwMmExNWJjOGE4ZGU5YWJkN2NiM2E=
|
data/.gitignore
ADDED
data/.jrubyrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
compat.version=2.0
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color --format documentation
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,56 +4,110 @@
|
|
4
4
|
|
5
5
|
# ember_cli_deploy_redis
|
6
6
|
|
7
|
-
Ruby interaction with [ember-cli-deploy-redis][2] to support [ember-cli][1] project deployments.
|
7
|
+
Ruby interaction with [the Ahalogy fork of ember-cli-deploy-redis][2] to support [ember-cli][1] project deployments.
|
8
8
|
|
9
9
|
[ember-cli-deploy-redis][2] stores deployment information including
|
10
|
-
the index page contents in Redis
|
10
|
+
the index page contents in Redis.
|
11
|
+
This gem allows access to that content so that it can be served.
|
11
12
|
|
12
13
|
## Installing
|
13
14
|
|
14
15
|
```ruby
|
15
|
-
|
16
|
+
gem install ember_cli_deploy_redis
|
16
17
|
```
|
17
18
|
|
18
19
|
Or if you are using bundler add to your Gemfile:
|
19
20
|
|
20
21
|
```ruby
|
21
|
-
|
22
|
+
gem ember_cli_deploy_redis, '~> 0.0.1'
|
22
23
|
```
|
23
24
|
|
24
25
|
## Usage
|
25
26
|
|
26
|
-
The following errors may be raised by the methods mentioned below:
|
27
|
-
|
28
|
-
* `EmberCliDeployRedis::NoDeployments`
|
29
|
-
* `EmberCliDeployRedis::FileMissingFromDeployment`
|
30
|
-
|
31
27
|
### Configuration
|
32
28
|
|
33
29
|
```ruby
|
34
30
|
EmberCliDeployRedis.configure do |config|
|
35
|
-
config.
|
31
|
+
config.default_app_name = "ember_cli_project_name"
|
36
32
|
# Optional:
|
37
33
|
config.keyspace = "optional_redis_keyspace"
|
38
34
|
end
|
39
35
|
```
|
40
36
|
|
41
|
-
### Getting deployed revisions
|
37
|
+
### Getting all deployed revisions for the default app
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
EmberCliDeployRedis.revisions
|
41
|
+
```
|
42
|
+
|
43
|
+
This will raise an `EmberCliDeployRedis::ConfigurationError` if `default_app_name` was not configured.
|
44
|
+
|
45
|
+
### Getting the currently-active revision for the default app
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
EmberCliDeployRedis.active_revision
|
49
|
+
```
|
50
|
+
|
51
|
+
This will raise an `EmberCliDeployRedis::ConfigurationError` if `default_app_name` was not configured.
|
52
|
+
|
53
|
+
### Get a specific app
|
42
54
|
|
43
55
|
```ruby
|
44
|
-
|
56
|
+
EmberCliDeployRedis::Application.new('app_name')
|
45
57
|
```
|
46
58
|
|
47
|
-
###
|
59
|
+
### Get specific revision from an app
|
48
60
|
|
49
61
|
```ruby
|
50
|
-
|
62
|
+
application.revision_by_name('revision_identifier')
|
51
63
|
```
|
52
64
|
|
53
65
|
### Getting the contents of a deployed file
|
54
66
|
|
55
67
|
```ruby
|
56
|
-
|
68
|
+
EmberCliDeployRedis.active_revision.contents_of('index.html')
|
69
|
+
```
|
70
|
+
|
71
|
+
This will raise an `EmberCliDeployRedis::FileMissingFromDeployment` if the file is not present in Redis.
|
72
|
+
|
73
|
+
## Web UI
|
74
|
+
|
75
|
+
Borrowed from the awesome [Sidekiq Web UI](https://github.com/mperham/sidekiq/wiki/Monitoring).
|
76
|
+
|
77
|
+
Add sinatra to your Gemfile:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
# if you require 'sinatra' you get the DSL extended to Object
|
81
|
+
gem 'sinatra', :require => nil
|
82
|
+
```
|
83
|
+
|
84
|
+
Add the following to your config/routes.rb:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
require 'ember_cli_deploy_redis/web'
|
88
|
+
mount EmberCliDeployRedis::Web => '/sidekiq'
|
89
|
+
```
|
90
|
+
|
91
|
+
This interface allows the display of the currently-active revision and the most recent revisions.
|
92
|
+
|
93
|
+
It also includes "test" link for each non-active revision.
|
94
|
+
This is done using a query parameter, the name of which is set in the `revision_specifier_query_param` configuration variable.
|
95
|
+
|
96
|
+
### Configuration
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
EmberCliDeployRedis.configure do |config|
|
100
|
+
# By default, the default_app_name is used. Otherwise, you can specify multiple app names:
|
101
|
+
config.web_application_names = %w(application1 application2)
|
102
|
+
|
103
|
+
# To enable "test" links for revisions:
|
104
|
+
config.revision_specifier_query_param = "_ember_app"
|
105
|
+
|
106
|
+
# To perform an action when a revision is made active:
|
107
|
+
config.on_revision_activated do |new_revision|
|
108
|
+
# Slack webhook here!
|
109
|
+
end
|
110
|
+
end
|
57
111
|
```
|
58
112
|
|
59
113
|
## To Do
|
@@ -2,32 +2,35 @@
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "ember_cli_deploy_redis/version"
|
4
4
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "ember_cli_deploy_redis"
|
7
|
+
spec.version = EmberCliDeployRedis::VERSION
|
8
|
+
spec.licenses = ["MIT"]
|
9
|
+
spec.authors = ["Ahalogy", "Robin Daugherty"]
|
10
|
+
spec.email = ["robin@robindaugherty.net"]
|
11
|
+
spec.homepage = "https://github.com/Ahalogy/ember_cli_deploy_redis_ruby"
|
12
|
+
spec.summary = "Serves up ember-cli content deployed with our fork of ember-cli-deploy-redis"
|
13
|
+
spec.description = <<-MD
|
14
|
+
Handles the serving of page contents of deployed ember-cli projects deployed using our fork of
|
15
|
+
(ember-cli-deploy-redis)[https://github.com/Ahalogy/ember-cli-deploy-redis],
|
16
|
+
which stores deployment information including the index page contents in Redis.
|
16
17
|
MD
|
18
|
+
spec.requirements << 'An Ember-ClI project'
|
19
|
+
spec.requirements << '(ember-cli-deploy)[https://github.com/ember-cli/ember-cli-deploy], 0.4.x'
|
20
|
+
spec.requirements << '(ember-cli-deploy-redis)[https://github.com/Ahalogy/ember-cli-deploy-redis]'
|
21
|
+
spec.requirements << 'A Ruby (Rails/Sinatra/etc) app to serve up the Ember-CLI project and provide it an API.'
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
spec.files = `git ls-files`.split("\n")
|
24
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
spec.required_ruby_version = '~> 2.0'
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
s.add_development_dependency 'pry-rescue'
|
32
|
-
s.add_development_dependency 'pry-stack_explorer'
|
28
|
+
spec.add_runtime_dependency "redis"
|
29
|
+
spec.add_development_dependency "fakeredis"
|
30
|
+
spec.add_development_dependency "shoulda-matchers"
|
31
|
+
spec.add_development_dependency "dotenv"
|
32
|
+
spec.add_development_dependency "rspec"
|
33
|
+
spec.add_development_dependency 'sinatra', '~> 1.4', '>= 1.4.6'
|
34
|
+
spec.add_development_dependency 'rack-test'
|
35
|
+
spec.add_development_dependency 'rspec-html-matchers'
|
33
36
|
end
|
@@ -18,7 +18,7 @@ module EmberCliDeployRedis
|
|
18
18
|
|
19
19
|
def default_app
|
20
20
|
unless configuration.default_app_name
|
21
|
-
fail 'No default_app_name has been configured
|
21
|
+
fail EmberCliDeployRedis::ConfigurationError, 'No default_app_name has been configured.'
|
22
22
|
end
|
23
23
|
@default_app ||= EmberCliDeployRedis::Application.new(configuration.default_app_name)
|
24
24
|
end
|
@@ -27,8 +27,14 @@ module EmberCliDeployRedis
|
|
27
27
|
default_app.revisions
|
28
28
|
end
|
29
29
|
|
30
|
+
# @deprecated use {#active_revision} instead
|
30
31
|
def latest_revision
|
31
|
-
|
32
|
+
warn "[DEPRECATION] `latest_revision` is deprecated, use `active_revision` instead"
|
33
|
+
active_revision
|
34
|
+
end
|
35
|
+
|
36
|
+
def active_revision
|
37
|
+
default_app.active_revision
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
@@ -11,8 +11,19 @@ module EmberCliDeployRedis
|
|
11
11
|
EmberCliDeployRedis::RevisionList.from_redis(self)
|
12
12
|
end
|
13
13
|
|
14
|
+
# @deprecated use {#active_revision} instead
|
14
15
|
def latest_revision
|
15
|
-
|
16
|
+
warn "[DEPRECATION] `latest_revision` is deprecated, use `active_revision` instead"
|
17
|
+
active_revision
|
18
|
+
end
|
19
|
+
|
20
|
+
def active_revision
|
21
|
+
EmberCliDeployRedis::Revision.active_from_redis(self)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the Revision specified by name, or nil if nothing matched.
|
25
|
+
def revision_by_name(revision_name)
|
26
|
+
revisions.find { |r| r.name == revision_name }
|
16
27
|
end
|
17
28
|
|
18
29
|
private
|
@@ -1,15 +1,43 @@
|
|
1
1
|
module EmberCliDeployRedis
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :redis
|
4
|
-
attr_reader :default_app_name
|
3
|
+
attr_accessor :redis
|
5
4
|
|
6
5
|
def keyspace
|
7
6
|
@keyspace ||= 'ember-cli-deploy'
|
8
7
|
end
|
9
8
|
|
9
|
+
attr_writer :keyspace
|
10
|
+
|
11
|
+
attr_reader :default_app_name
|
12
|
+
|
10
13
|
def default_app_name=(name)
|
14
|
+
fail ArgumentError, "default_app_name has already been set" if @default_app_name
|
11
15
|
@default_app_name = name
|
12
|
-
|
16
|
+
end
|
17
|
+
|
18
|
+
# Array of names of Ember applications that will be supported.
|
19
|
+
def web_application_names
|
20
|
+
@web_application_names ||= [default_app_name]
|
21
|
+
end
|
22
|
+
|
23
|
+
def web_application_names=(names)
|
24
|
+
fail ArgumentError, "names must be an array" unless names.respond_to? :each
|
25
|
+
@web_application_names = names
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_reader :revision_specifier_query_param
|
29
|
+
def revision_specifier_query_param=(param_name)
|
30
|
+
@revision_specifier_query_param = param_name
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_revision_activated(&block)
|
34
|
+
@on_revision_activated_block = block
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_reader :on_revision_activated_block
|
38
|
+
|
39
|
+
def revision_has_been_activated(revision)
|
40
|
+
@on_activate_revision_block.call(revision) if @on_activate_revision_block
|
13
41
|
end
|
14
42
|
|
15
43
|
def redis_key_for_revision_list(application)
|
@@ -5,8 +5,9 @@ module EmberCliDeployRedis
|
|
5
5
|
attr_reader :application
|
6
6
|
attr_reader :name
|
7
7
|
|
8
|
-
def self.
|
9
|
-
|
8
|
+
def self.active_from_redis(application)
|
9
|
+
revision_name = active_revision_from_redis(application)
|
10
|
+
new application, revision_name if revision_name
|
10
11
|
end
|
11
12
|
|
12
13
|
def initialize(application, name)
|
@@ -18,20 +19,27 @@ module EmberCliDeployRedis
|
|
18
19
|
contents_of_file_from_redis(filename)
|
19
20
|
end
|
20
21
|
|
22
|
+
def active?
|
23
|
+
self == application.active_revision
|
24
|
+
end
|
25
|
+
|
26
|
+
def ==(other)
|
27
|
+
other.name == name
|
28
|
+
end
|
29
|
+
|
30
|
+
def activate!
|
31
|
+
key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application)
|
32
|
+
EmberCliDeployRedis.configuration.redis.lpush(key, name)
|
33
|
+
end
|
34
|
+
|
21
35
|
private
|
22
36
|
|
23
37
|
attr_writer :application
|
24
38
|
attr_writer :name
|
25
39
|
|
26
|
-
def self.
|
40
|
+
def self.active_revision_from_redis(application)
|
27
41
|
key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application)
|
28
42
|
names = EmberCliDeployRedis.configuration.redis.lrange(key, 0, 0)
|
29
|
-
unless names.size > 0
|
30
|
-
fail(
|
31
|
-
EmberCliDeployRedis::NoDeployments,
|
32
|
-
"No revisions have been deployed to Redis",
|
33
|
-
)
|
34
|
-
end
|
35
43
|
names.first
|
36
44
|
end
|
37
45
|
|
@@ -1,15 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'delegate'
|
2
2
|
|
3
3
|
module EmberCliDeployRedis
|
4
4
|
# Holds a list of deployed application revisions that may be used.
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
# Delegates to the array of revisions, so standard {Array} methods can be called.
|
6
|
+
class RevisionList < SimpleDelegator
|
8
7
|
attr_reader :application
|
9
8
|
attr_reader :revisions
|
10
9
|
|
11
|
-
def_delegators :revisions, :[], :first, :last
|
12
|
-
|
13
10
|
def self.from_redis(application)
|
14
11
|
new application, list_from_redis(application).map { |r| Revision.new(application, r) }
|
15
12
|
end
|
@@ -17,6 +14,15 @@ module EmberCliDeployRedis
|
|
17
14
|
def initialize(application, revisions)
|
18
15
|
self.application = application
|
19
16
|
self.revisions = revisions
|
17
|
+
super(revisions)
|
18
|
+
end
|
19
|
+
|
20
|
+
def method_missing(method, *args, &block)
|
21
|
+
if revisions.respond_to? method
|
22
|
+
revisions.send(method, *args, &block)
|
23
|
+
else
|
24
|
+
super
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
private
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'yaml'
|
3
|
+
require 'sinatra/base'
|
4
|
+
|
5
|
+
require 'ember_cli_deploy_redis'
|
6
|
+
require 'ember_cli_deploy_redis/web_helpers'
|
7
|
+
|
8
|
+
module EmberCliDeployRedis
|
9
|
+
class Web < Sinatra::Base
|
10
|
+
enable :sessions
|
11
|
+
use Rack::Protection, :use => :authenticity_token unless ENV['RACK_ENV'] == 'test'
|
12
|
+
|
13
|
+
set :root, File.expand_path(File.dirname(__FILE__) + "/../../web")
|
14
|
+
set :public_folder, proc { "#{root}/assets" }
|
15
|
+
set :views, proc { "#{root}/views" }
|
16
|
+
set :locales, ["#{root}/locales"]
|
17
|
+
|
18
|
+
helpers WebHelpers
|
19
|
+
|
20
|
+
get '/' do
|
21
|
+
@applications = EmberCliDeployRedis.configuration.web_application_names.map { |name|
|
22
|
+
Application.new(name)
|
23
|
+
}
|
24
|
+
erb :dashboard
|
25
|
+
end
|
26
|
+
|
27
|
+
get "/applications/:app_name" do
|
28
|
+
halt 404 unless params[:app_name]
|
29
|
+
@application = Application.new(params[:app_name])
|
30
|
+
@revisions = @application.revisions
|
31
|
+
erb :application
|
32
|
+
end
|
33
|
+
|
34
|
+
post "/applications/:app_name/activate/:revision_name" do
|
35
|
+
halt 404 unless params[:app_name]
|
36
|
+
halt 404 unless params[:revision_name]
|
37
|
+
application = Application.new(params[:app_name])
|
38
|
+
revision = application.revision_by_name(params[:revision_name])
|
39
|
+
if EmberCliDeployRedis.configuration.on_revision_activated_block
|
40
|
+
EmberCliDeployRedis.configuration.on_revision_activated_block.call(revision)
|
41
|
+
end
|
42
|
+
revision.activate!
|
43
|
+
redirect_with_query("#{root_path}applications/#{application.name}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if defined?(::ActionDispatch::Request::Session) &&
|
49
|
+
!::ActionDispatch::Request::Session.respond_to?(:each)
|
50
|
+
# mperham/sidekiq#2460
|
51
|
+
# Rack apps can't reuse the Rails session store without
|
52
|
+
# this monkeypatch
|
53
|
+
class ActionDispatch::Request::Session
|
54
|
+
def each(&block)
|
55
|
+
hash = self.to_hash
|
56
|
+
hash.each(&block)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|