ember_cli_deploy_redis 0.1.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 +15 -0
- data/.hound.yml +6 -0
- data/.rubocop.yml +1068 -0
- data/.ruby-version +1 -0
- data/.tm_properties +4 -0
- data/.travis.yml +15 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +121 -0
- data/README.md +64 -0
- data/Rakefile +12 -0
- data/ember_cli_deploy_redis.gemspec +33 -0
- data/lib/ember_cli_deploy_redis.rb +34 -0
- data/lib/ember_cli_deploy_redis/application.rb +22 -0
- data/lib/ember_cli_deploy_redis/configuration.rb +23 -0
- data/lib/ember_cli_deploy_redis/errors.rb +4 -0
- data/lib/ember_cli_deploy_redis/revision.rb +54 -0
- data/lib/ember_cli_deploy_redis/revision_list.rb +32 -0
- data/lib/ember_cli_deploy_redis/version.rb +3 -0
- data/spec/lib/ember_cli_deploy_redis/application_spec.rb +26 -0
- data/spec/lib/ember_cli_deploy_redis/configuration_spec.rb +55 -0
- data/spec/lib/ember_cli_deploy_redis/revision_list_spec.rb +70 -0
- data/spec/lib/ember_cli_deploy_redis/revision_spec.rb +103 -0
- data/spec/lib/ember_cli_deploy_redis_spec.rb +47 -0
- data/spec/spec_helper.rb +18 -0
- metadata +212 -0
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.3
|
data/.tm_properties
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
notifications:
|
2
|
+
email: false
|
3
|
+
language: ruby
|
4
|
+
rvm:
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1.6
|
7
|
+
- 2.2.3
|
8
|
+
script: bundle exec rspec
|
9
|
+
deploy:
|
10
|
+
provider: rubygems
|
11
|
+
gem: ember_cli_deploy_redis
|
12
|
+
api_key:
|
13
|
+
secure: gq1/wSyT7kNEiSgkduRxur3WNlSG6tHqthTPiqTKvVOGZYWueyHYVEFqDWJLfBcUl7pDygjyrHfTY+caMp0Qtgjc8toNqeEaMY+mrTfoaFRubdd1Dc1zKFt03r195JlCIkKAu7y1iOa509BovIvZ76yshSaAodbLjx4RJVQ3/uA=
|
14
|
+
on:
|
15
|
+
tags: true
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ember_cli_deploy_redis (0.1.0)
|
5
|
+
redis
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (4.1.9)
|
11
|
+
i18n (~> 0.6, >= 0.6.9)
|
12
|
+
json (~> 1.7, >= 1.7.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
binding_of_caller (0.7.2)
|
17
|
+
debug_inspector (>= 0.0.1)
|
18
|
+
byebug (3.4.0)
|
19
|
+
columnize (~> 0.8)
|
20
|
+
debugger-linecache (~> 1.2)
|
21
|
+
slop (~> 3.6)
|
22
|
+
coderay (1.1.0)
|
23
|
+
columnize (0.8.9)
|
24
|
+
coveralls (0.8.10)
|
25
|
+
json (~> 1.8)
|
26
|
+
rest-client (>= 1.6.8, < 2)
|
27
|
+
simplecov (~> 0.11.0)
|
28
|
+
term-ansicolor (~> 1.3)
|
29
|
+
thor (~> 0.19.1)
|
30
|
+
tins (~> 1.6.0)
|
31
|
+
debug_inspector (0.0.2)
|
32
|
+
debugger-linecache (1.2.0)
|
33
|
+
diff-lcs (1.2.5)
|
34
|
+
docile (1.1.5)
|
35
|
+
domain_name (0.5.25)
|
36
|
+
unf (>= 0.0.5, < 1.0.0)
|
37
|
+
dotenv (0.11.1)
|
38
|
+
dotenv-deployment (~> 0.0.2)
|
39
|
+
dotenv-deployment (0.0.2)
|
40
|
+
fakeredis (0.5.0)
|
41
|
+
redis (~> 3.0)
|
42
|
+
http-cookie (1.0.2)
|
43
|
+
domain_name (~> 0.5)
|
44
|
+
i18n (0.7.0)
|
45
|
+
interception (0.5)
|
46
|
+
json (1.8.2)
|
47
|
+
method_source (0.8.2)
|
48
|
+
mime-types (2.99)
|
49
|
+
minitest (5.5.1)
|
50
|
+
netrc (0.11.0)
|
51
|
+
pry (0.10.1)
|
52
|
+
coderay (~> 1.1.0)
|
53
|
+
method_source (~> 0.8.1)
|
54
|
+
slop (~> 3.4)
|
55
|
+
pry-byebug (2.0.0)
|
56
|
+
byebug (~> 3.4)
|
57
|
+
pry (~> 0.10)
|
58
|
+
pry-doc (0.6.0)
|
59
|
+
pry (~> 0.9)
|
60
|
+
yard (~> 0.8)
|
61
|
+
pry-rescue (1.4.1)
|
62
|
+
interception (>= 0.5)
|
63
|
+
pry
|
64
|
+
pry-stack_explorer (0.4.9.1)
|
65
|
+
binding_of_caller (>= 0.7)
|
66
|
+
pry (>= 0.9.11)
|
67
|
+
redis (3.2.0)
|
68
|
+
rest-client (1.8.0)
|
69
|
+
http-cookie (>= 1.0.2, < 2.0)
|
70
|
+
mime-types (>= 1.16, < 3.0)
|
71
|
+
netrc (~> 0.7)
|
72
|
+
rspec (3.1.0)
|
73
|
+
rspec-core (~> 3.1.0)
|
74
|
+
rspec-expectations (~> 3.1.0)
|
75
|
+
rspec-mocks (~> 3.1.0)
|
76
|
+
rspec-core (3.1.1)
|
77
|
+
rspec-support (~> 3.1.0)
|
78
|
+
rspec-expectations (3.1.0)
|
79
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
+
rspec-support (~> 3.1.0)
|
81
|
+
rspec-mocks (3.1.0)
|
82
|
+
rspec-support (~> 3.1.0)
|
83
|
+
rspec-support (3.1.0)
|
84
|
+
shoulda-matchers (2.7.0)
|
85
|
+
activesupport (>= 3.0.0)
|
86
|
+
simplecov (0.11.1)
|
87
|
+
docile (~> 1.1.0)
|
88
|
+
json (~> 1.8)
|
89
|
+
simplecov-html (~> 0.10.0)
|
90
|
+
simplecov-html (0.10.0)
|
91
|
+
slop (3.6.0)
|
92
|
+
term-ansicolor (1.3.2)
|
93
|
+
tins (~> 1.0)
|
94
|
+
thor (0.19.1)
|
95
|
+
thread_safe (0.3.4)
|
96
|
+
tins (1.6.0)
|
97
|
+
tzinfo (1.2.2)
|
98
|
+
thread_safe (~> 0.1)
|
99
|
+
unf (0.1.4)
|
100
|
+
unf_ext
|
101
|
+
unf_ext (0.0.7.1)
|
102
|
+
yard (0.8.7.4)
|
103
|
+
|
104
|
+
PLATFORMS
|
105
|
+
ruby
|
106
|
+
|
107
|
+
DEPENDENCIES
|
108
|
+
coveralls
|
109
|
+
dotenv
|
110
|
+
ember_cli_deploy_redis!
|
111
|
+
fakeredis
|
112
|
+
pry
|
113
|
+
pry-byebug
|
114
|
+
pry-doc
|
115
|
+
pry-rescue
|
116
|
+
pry-stack_explorer
|
117
|
+
rspec
|
118
|
+
shoulda-matchers
|
119
|
+
|
120
|
+
BUNDLED WITH
|
121
|
+
1.10.6
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
[](https://travis-ci.org/Ahalogy/ember_cli_deploy_redis_ruby)
|
2
|
+
[](https://codeclimate.com/github/Ahalogy/ember_cli_deploy_redis_ruby)
|
3
|
+
[](https://coveralls.io/github/Ahalogy/ember_cli_deploy_redis_ruby?branch=master)
|
4
|
+
|
5
|
+
# ember_cli_deploy_redis
|
6
|
+
|
7
|
+
Ruby interaction with [ember-cli-deploy-redis][2] to support [ember-cli][1] project deployments.
|
8
|
+
|
9
|
+
[ember-cli-deploy-redis][2] stores deployment information including
|
10
|
+
the index page contents in Redis, and this gem allows access to it so that it can be served.
|
11
|
+
|
12
|
+
## Installing
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem install ember_cli_deploy_redis
|
16
|
+
```
|
17
|
+
|
18
|
+
Or if you are using bundler add to your Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem ember_cli_deploy_redis, '~> 0.0.1'
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
The following errors may be raised by the methods mentioned below:
|
27
|
+
|
28
|
+
* `EmberCliDeployRedis::NoDeployments`
|
29
|
+
* `EmberCliDeployRedis::FileMissingFromDeployment`
|
30
|
+
|
31
|
+
### Configuration
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
EmberCliDeployRedis.configure do |config|
|
35
|
+
config.app_name = "ember_cli_project_name"
|
36
|
+
# Optional:
|
37
|
+
config.keyspace = "optional_redis_keyspace"
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
### Getting deployed revisions
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
EmberCliDeployRedis.revisions
|
45
|
+
```
|
46
|
+
|
47
|
+
### Getting the latest deployed revision
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
EmberCliDeployRedis.latest_revision
|
51
|
+
```
|
52
|
+
|
53
|
+
### Getting the contents of a deployed file
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
EmberCliDeployRedis.latest_revision.contents_of('index.html')
|
57
|
+
```
|
58
|
+
|
59
|
+
## To Do
|
60
|
+
|
61
|
+
* Support for the activated revision instead of just the most recent.
|
62
|
+
|
63
|
+
[1]: http://ember-cli.com "Ember CLI"
|
64
|
+
[2]: https://github.com/Ahalogy/ember-cli-deploy-redis "ember-cli-deploy-redis"
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
desc 'Default: run specs.'
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
desc 'Run specs'
|
9
|
+
RSpec::Core::RakeTask.new do |t|
|
10
|
+
# t.pattern = './spec/**/*_spec.rb' # it's default.
|
11
|
+
# Put spec opts in a file named .rspec in root
|
12
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ember_cli_deploy_redis/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ember_cli_deploy_redis"
|
7
|
+
s.version = EmberCliDeployRedis::VERSION
|
8
|
+
s.authors = ["Ahalogy"]
|
9
|
+
s.email = ["robin@robindaugherty.net"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = "Ruby interaction with ember-cli-deploy-redis"
|
12
|
+
s.description = <<-MD
|
13
|
+
Supports ember-cli project deployments
|
14
|
+
made using ember-cli-deploy-redis, which stores deployment information including
|
15
|
+
the index page contents in Redis.
|
16
|
+
MD
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_dependency "redis"
|
24
|
+
s.add_development_dependency "fakeredis"
|
25
|
+
s.add_development_dependency "shoulda-matchers"
|
26
|
+
s.add_development_dependency "dotenv"
|
27
|
+
s.add_development_dependency "rspec"
|
28
|
+
s.add_development_dependency "pry"
|
29
|
+
s.add_development_dependency 'pry-byebug'
|
30
|
+
s.add_development_dependency 'pry-doc'
|
31
|
+
s.add_development_dependency 'pry-rescue'
|
32
|
+
s.add_development_dependency 'pry-stack_explorer'
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "ember_cli_deploy_redis/version"
|
2
|
+
require "ember_cli_deploy_redis/errors"
|
3
|
+
require "ember_cli_deploy_redis/application"
|
4
|
+
require "ember_cli_deploy_redis/configuration"
|
5
|
+
require "ember_cli_deploy_redis/revision"
|
6
|
+
require "ember_cli_deploy_redis/revision_list"
|
7
|
+
# require "ostruct"
|
8
|
+
|
9
|
+
module EmberCliDeployRedis
|
10
|
+
class << self
|
11
|
+
def configure
|
12
|
+
yield(configuration) if block_given?
|
13
|
+
end
|
14
|
+
|
15
|
+
def configuration
|
16
|
+
@configuration ||= EmberCliDeployRedis::Configuration.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_app
|
20
|
+
unless configuration.default_app_name
|
21
|
+
fail 'No default_app_name has been configured for the ember-cli project.'
|
22
|
+
end
|
23
|
+
@default_app ||= EmberCliDeployRedis::Application.new(configuration.default_app_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
def revisions
|
27
|
+
default_app.revisions
|
28
|
+
end
|
29
|
+
|
30
|
+
def latest_revision
|
31
|
+
default_app.latest_revision
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module EmberCliDeployRedis
|
2
|
+
# An application that is deployed and whose revisions can be retrieved.
|
3
|
+
class Application
|
4
|
+
attr_reader :name
|
5
|
+
|
6
|
+
def initialize(name)
|
7
|
+
self.name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def revisions
|
11
|
+
EmberCliDeployRedis::RevisionList.from_redis(self)
|
12
|
+
end
|
13
|
+
|
14
|
+
def latest_revision
|
15
|
+
EmberCliDeployRedis::Revision.latest_from_redis(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_writer :name
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module EmberCliDeployRedis
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :redis, :keyspace
|
4
|
+
attr_reader :default_app_name
|
5
|
+
|
6
|
+
def keyspace
|
7
|
+
@keyspace ||= 'ember-cli-deploy'
|
8
|
+
end
|
9
|
+
|
10
|
+
def default_app_name=(name)
|
11
|
+
@default_app_name = name
|
12
|
+
@default_app = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def redis_key_for_revision_list(application)
|
16
|
+
[keyspace, application.name].compact.join(":")
|
17
|
+
end
|
18
|
+
|
19
|
+
def redis_key_for_revision_file(application, revision, filename)
|
20
|
+
[[redis_key_for_revision_list(application), revision].join(":"), filename].join("/")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module EmberCliDeployRedis
|
2
|
+
# A single revision that has been deployed to Redis.
|
3
|
+
# Fetches the contents of deployed files for the given revision.
|
4
|
+
class Revision
|
5
|
+
attr_reader :application
|
6
|
+
attr_reader :name
|
7
|
+
|
8
|
+
def self.latest_from_redis(application)
|
9
|
+
new application, latest_revision_from_redis(application)
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(application, name)
|
13
|
+
self.application = application
|
14
|
+
self.name = name
|
15
|
+
end
|
16
|
+
|
17
|
+
def contents_of(filename)
|
18
|
+
contents_of_file_from_redis(filename)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_writer :application
|
24
|
+
attr_writer :name
|
25
|
+
|
26
|
+
def self.latest_revision_from_redis(application)
|
27
|
+
key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application)
|
28
|
+
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
|
+
names.first
|
36
|
+
end
|
37
|
+
|
38
|
+
def contents_of_file_from_redis(filename)
|
39
|
+
key = EmberCliDeployRedis.configuration.redis_key_for_revision_file(
|
40
|
+
application,
|
41
|
+
name,
|
42
|
+
filename,
|
43
|
+
)
|
44
|
+
contents = EmberCliDeployRedis.configuration.redis.get(key)
|
45
|
+
unless contents
|
46
|
+
fail(
|
47
|
+
EmberCliDeployRedis::FileMissingFromDeployment,
|
48
|
+
"The file '#{filename}' was not deployed to Redis",
|
49
|
+
)
|
50
|
+
end
|
51
|
+
contents
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module EmberCliDeployRedis
|
4
|
+
# Holds a list of deployed application revisions that may be used.
|
5
|
+
class RevisionList
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
attr_reader :application
|
9
|
+
attr_reader :revisions
|
10
|
+
|
11
|
+
def_delegators :revisions, :[], :first, :last
|
12
|
+
|
13
|
+
def self.from_redis(application)
|
14
|
+
new application, list_from_redis(application).map { |r| Revision.new(application, r) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(application, revisions)
|
18
|
+
self.application = application
|
19
|
+
self.revisions = revisions
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_writer :application
|
25
|
+
attr_writer :revisions
|
26
|
+
|
27
|
+
def self.list_from_redis(application)
|
28
|
+
key = EmberCliDeployRedis.configuration.redis_key_for_revision_list(application)
|
29
|
+
EmberCliDeployRedis.configuration.redis.lrange(key, 0, -1)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|