rinfo 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +14 -1
- data/config/routes.rb +1 -1
- data/lib/rinfo.rb +21 -10
- data/lib/rinfo/version.rb +1 -1
- data/spec/controllers/rinfo_controller_spec.rb +9 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ef45bcac62d24bde6ca081f30cb07c2378ebabc
|
4
|
+
data.tar.gz: 4ae40805b18e2935917768eb86e49a108bfdfcdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54b50f87424e960cf2da52729b6b40acd217a64d0919ed6281f35439eafda2e02ea2aefa0e5bbe71aeac9a17c43a8e8ee2e24828090577ce578a2167acaaa313
|
7
|
+
data.tar.gz: 89a72994604b35ef3c86af49174480da4a0123ce30c54ec00ab92905f37831d12ea481ca23a275baa9f989c14f7b9b8636b3c163bed50058627577eea7520884
|
data/README.md
CHANGED
@@ -28,6 +28,9 @@ Accessing your `rinfo.json` page will product something like this:
|
|
28
28
|
|
29
29
|
It's as easy as that!
|
30
30
|
|
31
|
+
**NOTE:** For now, the `Deployed At` value is being estimated as the
|
32
|
+
timestamp on the most latest commit.
|
33
|
+
|
31
34
|
## Installation
|
32
35
|
|
33
36
|
To add `rinfo` to your Rails application, add the `rinfo` gem to your `Gemfile`:
|
@@ -52,9 +55,13 @@ something like this:
|
|
52
55
|
|
53
56
|
```ruby
|
54
57
|
# config/initializers/rinfo.rb
|
55
|
-
Rinfo.env_blacklist = :
|
58
|
+
Rinfo.env_blacklist = :prod, :production
|
59
|
+
|
60
|
+
Rinfo.filename = 'rinfo.json'
|
56
61
|
```
|
57
62
|
|
63
|
+
### `env_blacklist`
|
64
|
+
|
58
65
|
The `env_blacklist` attribute is a list of environments such that if it
|
59
66
|
includes your `RAILS_ENV`, the `/rinfo.json` route will return a `404`
|
60
67
|
response insetad of a `JSON` blob. The arguments provided can be a
|
@@ -65,3 +72,9 @@ either a string or a symbol. The default blacklist is `[:prod,
|
|
65
72
|
**NOTE:** There is one special value `:all`, which, if included in your
|
66
73
|
list, will prevent `rinfo.json` from showing up entirely, regardless of
|
67
74
|
your `RAILS_ENV`
|
75
|
+
|
76
|
+
### `filename`
|
77
|
+
|
78
|
+
The `filename` attribute allows you to set the filename at which your
|
79
|
+
release information is available. The default value of `rinfo.json` will
|
80
|
+
mean your file is available at `/rinfo.json`.
|
data/config/routes.rb
CHANGED
data/lib/rinfo.rb
CHANGED
@@ -8,17 +8,14 @@ class Rinfo
|
|
8
8
|
autoload :VERSION, 'rinfo/version'
|
9
9
|
|
10
10
|
class << self
|
11
|
+
attr_writer :filename
|
12
|
+
|
11
13
|
def inform!
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"Rails Env": "#{env}",
|
18
|
-
"Branch": "#{branch}",
|
19
|
-
"Rev": "#{rev}"
|
20
|
-
}
|
21
|
-
RINFO
|
14
|
+
if should_inform?
|
15
|
+
JSON.pretty_generate(rinfo)
|
16
|
+
else
|
17
|
+
fail ActionController::RoutingError 'Not Found'
|
18
|
+
end
|
22
19
|
end
|
23
20
|
|
24
21
|
def should_inform?
|
@@ -33,8 +30,22 @@ class Rinfo
|
|
33
30
|
@env_blacklist = [*args].map(&:to_sym)
|
34
31
|
end
|
35
32
|
|
33
|
+
def filename
|
34
|
+
@filename ||= 'rinfo.json'
|
35
|
+
end
|
36
|
+
|
36
37
|
private
|
37
38
|
|
39
|
+
def rinfo
|
40
|
+
{
|
41
|
+
deployed_by: author,
|
42
|
+
deployed_at: date,
|
43
|
+
rails_env: env,
|
44
|
+
branch: branch,
|
45
|
+
rev: rev
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
38
49
|
def git
|
39
50
|
@git ||= Git.open(root)
|
40
51
|
end
|
data/lib/rinfo/version.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'tmpdir'
|
4
4
|
require 'git'
|
5
|
+
require 'time'
|
5
6
|
|
6
7
|
describe RinfoController, type: :controller do
|
7
8
|
before(:all) do
|
@@ -37,7 +38,7 @@ describe RinfoController, type: :controller do
|
|
37
38
|
end
|
38
39
|
|
39
40
|
let(:author) { @name }
|
40
|
-
let(:deploy_time) { "#{@date}" }
|
41
|
+
let(:deploy_time) { "#{@date.iso8601}" }
|
41
42
|
let(:rails_env) { 'test' }
|
42
43
|
let(:branch) { @branch_name }
|
43
44
|
let(:rev) { @rev }
|
@@ -46,15 +47,13 @@ describe RinfoController, type: :controller do
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def rinfo
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
RINFO
|
50
|
+
JSON.pretty_generate(
|
51
|
+
deployed_by: author,
|
52
|
+
deployed_at: deploy_time,
|
53
|
+
rails_env: "#{Rinfo.send(:env)}",
|
54
|
+
branch: branch,
|
55
|
+
rev: rev
|
56
|
+
)
|
58
57
|
end
|
59
58
|
|
60
59
|
describe 'GET #info' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafe Colton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|