rails_12factor 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/LICENSE +19 -19
- data/README.md +8 -8
- data/Rakefile +9 -0
- data/lib/rails_12factor/version.rb +2 -2
- data/rails_12factor.gemspec +3 -1
- data/test/helper.rb +5 -0
- data/test/test_rails_12factor.rb +11 -0
- metadata +46 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57f5cf55fb8be3fa5bede1513b57c930fcdebf32
|
4
|
+
data.tar.gz: 487d7dbcf732d85a2f8cf670178edd4f0c982059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b2476a19085e0c14b401b402d69b790b4614207b5863915879c10a4533afff1fa1a5643095473c4241328cf7a6b82b74a07588ed67fb3fce9f7564a2e94f612
|
7
|
+
data.tar.gz: c2b9b1cc368b289e738bb5a4f08251e7df298d4fe0a9d86db319f4586069c4e9d247c8e4e2c7e82a2b991590a595f9e9d0813b429c2e613cc6ab056636f476e8
|
data/.travis.yml
ADDED
data/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
|
2
|
-
All rights reserved.
|
1
|
+
The MIT License (MIT)
|
3
2
|
|
4
|
-
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
6
|
-
* Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
8
|
-
* Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
3
|
+
Copyright (c) 2013,2014 Heroku
|
11
4
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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.
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# Rails 12factor
|
1
|
+
# Rails 12factor [![Build Status](https://travis-ci.org/heroku/rails_12factor.png)](https://travis-ci.org/heroku/rails_12factor)
|
2
2
|
|
3
|
-
Makes running your Rails app easier. Based on the ideas behind [12factor.net](http://
|
3
|
+
Makes running your Rails app easier. Based on the ideas behind [12factor.net](http://12factor.net)
|
4
4
|
|
5
5
|
## What
|
6
6
|
|
7
|
-
Rails gets a lot right when it comes to twelve-factor apps, but it could still be better. The two biggest areas right now
|
7
|
+
Rails gets a lot right when it comes to twelve-factor apps, but it could still be better. The two biggest areas right now are that in production [logs should be directed to stdout](http://www.12factor.net/logs) and [dev/prod parity](http://www.12factor.net/dev-prod-parity) while delivering assets.
|
8
8
|
|
9
|
-
This gem enables serving assets in production and setting your logger to standard out, both of which are required
|
9
|
+
This gem enables serving assets in production and setting your logger to standard out, both of which are required to run a Rails 4 application on a twelve-factor provider. The gem also makes the appropriate changes for Rails 3 apps.
|
10
10
|
|
11
11
|
## Install
|
12
12
|
|
@@ -26,24 +26,24 @@ Now you're good to go.
|
|
26
26
|
|
27
27
|
## How
|
28
28
|
|
29
|
-
This gem adds two other gems `rails_serve_static_assets` and `rails_stdout_logging`. These gems are required to run your Rails app with both logging aggregation and static assets serving in production. All you need to do to get the functionality of both gems is to add the `
|
29
|
+
This gem adds two other gems `rails_serve_static_assets` and `rails_stdout_logging`. These gems are required to run your Rails app with both logging aggregation and static assets serving in production. All you need to do to get the functionality of both gems is to add the `rails_12factor` gem to your project. Here is how they work:
|
30
30
|
|
31
31
|
## Rails 4 Logging
|
32
32
|
|
33
33
|
By default Rails writes its logs to a specific file, which is convenient if you only have one log file to tail. When you start scaling to multiple instances running your app, finding a single request or failure across multiple files becomes much harder. Storing logs on disk can also take down a server if the hard drive fills up. Because of these limitations, every Rails core member we’ve talked to uses a custom logger to replace Rail's default functionality. By using the `rails_stdout_logging` gem, the logger is set for you.
|
34
34
|
|
35
|
-
The gem `rails_stdout_logging` ensures that your logs will be sent to standard out, and from there the twelve-factor platform can send them to a log aggregation service ( like [logplex](https://github.com/heroku/logplex) on Heroku, or [Papertrail](https://papertrailapp.com)) so you can access them from one place. By using stdout instead of files, you can [treat logs as event streams](http://www.
|
35
|
+
The gem `rails_stdout_logging` ensures that your logs will be sent to standard out, and from there the twelve-factor platform can send them to a log aggregation service ( like [logplex](https://github.com/heroku/logplex) on Heroku, or [Papertrail](https://papertrailapp.com)) so you can access them from one place. By using stdout instead of files, you can [treat logs as event streams](http://www.12factor.net/logs).
|
36
36
|
|
37
37
|
|
38
38
|
## Rails 4 Serve Static Assets
|
39
39
|
|
40
40
|
In the default Rails development environment assets are served through a middleware called [sprockets](https://github.com/sstephenson/sprockets). In production however most one-off Rails deployments will put their ruby server behind a reverse HTTP proxy server such as Nginx, which can then load balance the app and serve static files directly. When Nginx sees a request for an asset such as `/assets/rails.png` it will grab it from disk at `/public/assets/rails.png` and serve it. The Rails server will never see these requests.
|
41
41
|
|
42
|
-
On a twelve-factor platform, Nginx is typically not required to run your application. Your app should be capable of handling requests directly, or through a [routing layer](https://devcenter.heroku.com/articles/http-routing) that may
|
42
|
+
On a twelve-factor platform, Nginx is typically not required to run your application. Your app should be capable of handling requests directly, or through a [routing layer](https://devcenter.heroku.com/articles/http-routing) that may handle load balancing while you scale out horizontally. Note that the caching behavior of Nginx is not needed if your application is serving static assets through an [edge caching CDN](https://en.wikipedia.org/wiki/Content_delivery_network), which is generally recommended.
|
43
43
|
|
44
44
|
By default Rails 4 will return a 404 if an asset is not handled via an external proxy such as Nginx. While this default behavior may help you debug your Nginx configuration, it makes a default Rails app with assets unusable on a twelve-factor platform. To fix this we've released a gem: `rails_serve_static_assets`.
|
45
45
|
|
46
|
-
The `rails_serve_static_assets` gem enables your Rails server to deliver your assets directly, instead of returning a 404. You can use this to populate an edge cache CDN, or serve files directly from your web app. This gives your app total control, allowing you to do things like redirects or setting headers in your Ruby code. The gem
|
46
|
+
The `rails_serve_static_assets` gem enables your Rails server to deliver your assets directly, instead of returning a 404. You can use this to populate an edge cache CDN, or serve files directly from your web app. This gives your app total control, allowing you to do things like redirects or setting headers in your Ruby code. The gem achieves this behavior in your app by simply setting a single configuration option, `config.serve_static_assets = true`. By using the `rails_serve_static_assets` gem, you do not need to set this configuration manually.
|
47
47
|
|
48
48
|
|
49
49
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Rails12factor
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.3"
|
3
|
+
end
|
data/rails_12factor.gemspec
CHANGED
@@ -14,8 +14,10 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.name = "rails_12factor"
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Rails12factor::VERSION
|
17
|
-
gem.
|
17
|
+
gem.licenses = ['MIT']
|
18
18
|
|
19
|
+
gem.add_development_dependency "minitest"
|
20
|
+
gem.add_development_dependency "rake"
|
19
21
|
gem.add_dependency "rails_serve_static_assets"
|
20
22
|
gem.add_dependency "rails_stdout_logging"
|
21
23
|
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestRails12factor < Minitest::Test
|
4
|
+
def test_gem_dependencies_are_loaded
|
5
|
+
assert !defined?(RailsServeStaticAssets)
|
6
|
+
assert !defined?(RailsStdoutLogging)
|
7
|
+
require 'rails_12factor'
|
8
|
+
assert defined?(RailsServeStaticAssets)
|
9
|
+
assert defined?(RailsStdoutLogging)
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_12factor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
@@ -9,34 +9,62 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: minitest
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
14
42
|
- !ruby/object:Gem::Dependency
|
15
43
|
name: rails_serve_static_assets
|
16
44
|
requirement: !ruby/object:Gem::Requirement
|
17
45
|
requirements:
|
18
|
-
- -
|
46
|
+
- - ">="
|
19
47
|
- !ruby/object:Gem::Version
|
20
48
|
version: '0'
|
21
49
|
type: :runtime
|
22
50
|
prerelease: false
|
23
51
|
version_requirements: !ruby/object:Gem::Requirement
|
24
52
|
requirements:
|
25
|
-
- -
|
53
|
+
- - ">="
|
26
54
|
- !ruby/object:Gem::Version
|
27
55
|
version: '0'
|
28
56
|
- !ruby/object:Gem::Dependency
|
29
57
|
name: rails_stdout_logging
|
30
58
|
requirement: !ruby/object:Gem::Requirement
|
31
59
|
requirements:
|
32
|
-
- -
|
60
|
+
- - ">="
|
33
61
|
- !ruby/object:Gem::Version
|
34
62
|
version: '0'
|
35
63
|
type: :runtime
|
36
64
|
prerelease: false
|
37
65
|
version_requirements: !ruby/object:Gem::Requirement
|
38
66
|
requirements:
|
39
|
-
- -
|
67
|
+
- - ">="
|
40
68
|
- !ruby/object:Gem::Version
|
41
69
|
version: '0'
|
42
70
|
description: Run Rails the 12factor way
|
@@ -47,7 +75,8 @@ executables: []
|
|
47
75
|
extensions: []
|
48
76
|
extra_rdoc_files: []
|
49
77
|
files:
|
50
|
-
- .gitignore
|
78
|
+
- ".gitignore"
|
79
|
+
- ".travis.yml"
|
51
80
|
- Gemfile
|
52
81
|
- LICENSE
|
53
82
|
- README.md
|
@@ -55,9 +84,11 @@ files:
|
|
55
84
|
- lib/rails_12factor.rb
|
56
85
|
- lib/rails_12factor/version.rb
|
57
86
|
- rails_12factor.gemspec
|
87
|
+
- test/helper.rb
|
88
|
+
- test/test_rails_12factor.rb
|
58
89
|
homepage: https://github.com/heroku/rails_12factor
|
59
90
|
licenses:
|
60
|
-
-
|
91
|
+
- MIT
|
61
92
|
metadata: {}
|
62
93
|
post_install_message:
|
63
94
|
rdoc_options: []
|
@@ -65,19 +96,22 @@ require_paths:
|
|
65
96
|
- lib
|
66
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
98
|
requirements:
|
68
|
-
- -
|
99
|
+
- - ">="
|
69
100
|
- !ruby/object:Gem::Version
|
70
101
|
version: '0'
|
71
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
103
|
requirements:
|
73
|
-
- -
|
104
|
+
- - ">="
|
74
105
|
- !ruby/object:Gem::Version
|
75
106
|
version: '0'
|
76
107
|
requirements: []
|
77
108
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.2.2
|
79
110
|
signing_key:
|
80
111
|
specification_version: 4
|
81
112
|
summary: Following best practices from http://12factor.net run a maintainable, clean,
|
82
113
|
and scalable app on Rails
|
83
|
-
test_files:
|
114
|
+
test_files:
|
115
|
+
- test/helper.rb
|
116
|
+
- test/test_rails_12factor.rb
|
117
|
+
has_rdoc:
|