Skip to content

Commit 315b0fe

Browse files
committed
$ bundle gem ember-cli-rails-deploy-redis
0 parents  commit 315b0fe

File tree

15 files changed

+281
-0
lines changed

15 files changed

+281
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.bundle/
2+
/.yardoc
3+
/Gemfile.lock
4+
/_yardoc/
5+
/coverage/
6+
/doc/
7+
/pkg/
8+
/spec/reports/
9+
/tmp/

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--format documentation
2+
--color

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: ruby
2+
rvm:
3+
- 2.2.2
4+
before_install: gem install bundler -v 1.10.5

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6+
7+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8+
9+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10+
11+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12+
13+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in ember-cli-rails-deploy-redis.gemspec
4+
gemspec

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Sean Doyle
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# EmberCLI Rails - Deploy Redis
2+
3+
[EmberCLI Rails] is an integration story between (surprise suprise) EmberCLI and
4+
Rails 3.1 and up.
5+
6+
[ember-cli-deploy] is a simple, flexible deployment for your Ember CLI app.
7+
8+
[ember-deploy-redis] is the redis-adapter implementation to use Redis with ember-deploy.
9+
10+
`ember-cli-rails-deploy-redis` wires up all three.
11+
12+
[EmberCLI Rails]: https://github.com/rwz/ember-cli-rails
13+
[ember-cli-deploy]: https://github.com/ember-cli/ember-cli-deploy
14+
[ember-deploy-redis]: https://github.com/LevelbossMike/ember-deploy-redis
15+
16+
## Installation
17+
18+
Add this line to your application's Gemfile:
19+
20+
```ruby
21+
gem 'ember-cli-rails-deploy-redis'
22+
```
23+
24+
And then execute:
25+
26+
```bash
27+
$ bundle
28+
```
29+
30+
## Usage
31+
32+
The EmberCLI community recently unified the various deployment techniques into a
33+
single, core-team supported project: [ember-cli-deploy][ember-cli-deploy].
34+
35+
This project attempts to streamline the process of pushing and serving
36+
EmberCLI-built static assets.
37+
38+
To integrate with `ember-cli-deploy`'s ["Lightning Fast Deploys"][lightning]
39+
(using the Redis adapter), instantiate an `EmberCLI::Deploy` in your controller:
40+
41+
```ruby
42+
require "ember-cli/deploy"
43+
44+
class ApplicationController < ActionController::Base
45+
def index
46+
@deploy = EmberCLI::Deploy.new(namespace: "frontend")
47+
48+
render text: @deploy.html, layout: false
49+
end
50+
end
51+
```
52+
53+
`EmberCLI::Deploy` takes a `namespace` (the name of your app declared in your
54+
initializer) and handles all interaction with the Redis instance.
55+
56+
This is great for `staging` and `production` deploys, but introduces an extra
57+
step in the feedback loop during development.
58+
59+
Luckily, `EmberCLI::Deploy` also accepts an `index_html` override, which will
60+
replace the call to the Redis instance. This allows integration with the normal
61+
`ember-cli-rails` workflow:
62+
63+
```ruby
64+
require "ember-cli/deploy"
65+
66+
class ApplicationController < ActionController::Base
67+
def index
68+
@deploy = EmberCLI::Deploy.new(
69+
namespace: "frontend",
70+
index_html: index_html,
71+
)
72+
73+
render text: @deploy.html, layout: false
74+
end
75+
76+
private
77+
78+
def index_html
79+
if serve_with_ember_cli_rails?
80+
render_to_string(:index)
81+
end
82+
end
83+
84+
def serve_with_ember_cli_rails?
85+
! %w[production staging].include?(Rails.env)
86+
end
87+
end
88+
```
89+
90+
Additionally, having access to the outbound HTML beforehand also enables
91+
controllers to inject additional markup, such as metadata, CSRF tokens, or
92+
analytics tags:
93+
94+
95+
```ruby
96+
require "ember-cli/deploy"
97+
98+
class ApplicationController < ActionController::Base
99+
def index
100+
@deploy = EmberCLI::Deploy.new(
101+
namespace: "frontend",
102+
index_html: index_html,
103+
)
104+
105+
@deploy.append_to_head(render_to_string(partial: "my_csrf_and_metadata")
106+
@deploy.append_to_body(render_to_string(partial: "my_analytics")
107+
108+
render text: @deploy.html, layout: false
109+
end
110+
# ...
111+
end
112+
```
113+
114+
[ember-cli-deploy]: https://github.com/ember-cli/ember-cli-deploy
115+
[lightning]: https://github.com/ember-cli/ember-cli-deploy#lightning-approach-workflow
116+
117+
## Development
118+
119+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
120+
121+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
122+
123+
## Contributing
124+
125+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ember-cli-rails-deploy-redis. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
126+
127+
128+
## License
129+
130+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
131+

Rakefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require "bundler/gem_tasks"
2+
require "rspec/core/rake_task"
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
6+
task :default => :spec

bin/console

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env ruby
2+
3+
require "bundler/setup"
4+
require "ember/cli/rails/deploy/redis"
5+
6+
# You can add fixtures and/or initialization code here to make experimenting
7+
# with your gem easier. You can also use a different console, if you like.
8+
9+
# (If you use this, don't forget to add pry to your Gemfile!)
10+
# require "pry"
11+
# Pry.start
12+
13+
require "irb"
14+
IRB.start

bin/setup

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
5+
bundle install
6+
7+
# Do any other automated setup that you need to do here

0 commit comments

Comments
 (0)