rack-dev-mark 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +26 -5
- data/lib/rack/dev-mark.rb +8 -0
- data/lib/rack/dev-mark/version.rb +1 -1
- data/{screenshot-development.png → misc/screenshot-development.png} +0 -0
- data/{screenshot-production.png → misc/screenshot-production.png} +0 -0
- data/misc/screenshot.gif +0 -0
- data/spec/rack/dev-mark_spec.rb +13 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWFhYjIwOWI1NzI3MzQ0YWZiYjFiNTJiMTgyMzdlNGM3ODU2YTMxYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzFhZjU3YzE5Zjg4ZGM1MGYzNzAzNDBiZWQ4ZmY0OTEwNDZjMzhjNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTdlYzU3OWNkMjE3ZDYxMTJkMjIzYjAzZWJjYjZjZDNhOWI4MTdhZmMwYWE1
|
10
|
+
MmM5MWFmYjE1ZDUzNzA5MzkzMjdiZjBkMzQ4MmJkODAzY2ZjOTdmZjI0NjUw
|
11
|
+
ZTQ5ZjVlOTM4ODlhNTE4NGRlN2RiZjQ3Y2NlODhkNTI0NTJlNzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTk2ZmFkZjgwNmNlYmE3YTE4ZjUzNTJjNDNhOTg0ZmMwNWY4ZGVlYzZjNzM5
|
14
|
+
MjdhMjYwMTdmYzdkYjhlY2I1YzNmOTYwNjBiYTNmNWExZmNkZDYzZGRlMWNh
|
15
|
+
NGI0ZDkwNDYyOTA0NTgyNTBlMmRhMzU1ZmQwNTUwMmM3MDZkMmY=
|
data/README.md
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
# rack-dev-mark
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/rack-dev-mark.svg)](http://badge.fury.io/rb/rack-dev-mark) [![Build Status](https://secure.travis-ci.org/dtaniwaki/rack-dev-mark.png
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rack-dev-mark.svg)](http://badge.fury.io/rb/rack-dev-mark) [![Build Status](https://secure.travis-ci.org/dtaniwaki/rack-dev-mark.png)](http://travis-ci.org/dtaniwaki/rack-dev-mark) [![Coverage Status](https://coveralls.io/repos/dtaniwaki/rack-dev-mark/badge.png)](https://coveralls.io/r/dtaniwaki/rack-dev-mark) [![Code Climate](https://codeclimate.com/github/dtaniwaki/rack-dev-mark.png)](https://codeclimate.com/github/dtaniwaki/rack-dev-mark)
|
4
4
|
|
5
5
|
Differentiate development environment from production.
|
6
6
|
You can choose [themes](lib/rack/dev-mark/theme/README.md) to differentiate the page.
|
7
7
|
|
8
8
|
## Screenshot
|
9
9
|
|
10
|
-
|
10
|
+
![screenshot development](misc/screenshot.gif)
|
11
11
|
|
12
|
-
|
12
|
+
### On Development Env
|
13
13
|
|
14
|
-
|
14
|
+
![screenshot development](misc/screenshot-development.png)
|
15
15
|
|
16
|
-
|
16
|
+
### On Production Env
|
17
|
+
|
18
|
+
![screenshot production](misc/screenshot-production.png)
|
17
19
|
|
18
20
|
## Installation
|
19
21
|
|
@@ -77,6 +79,25 @@ module MyApp
|
|
77
79
|
end
|
78
80
|
```
|
79
81
|
|
82
|
+
#### Heroku
|
83
|
+
|
84
|
+
Since Heroku [uses production env for staging](https://devcenter.heroku.com/articles/multiple-environments). You can use this settings instead.
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
module MyApp
|
88
|
+
class Application < Rails::Application
|
89
|
+
Rack::DevMark.env = ENV['RACK_DEV_MARK']
|
90
|
+
config.rack_dev_mark.enable = !Rails.env.production? || ENV['RACK_DEV_MARK']
|
91
|
+
end
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
And set the environment variable.
|
96
|
+
|
97
|
+
```bash
|
98
|
+
heroku config:set RACK_DEV_MARK=staging
|
99
|
+
```
|
100
|
+
|
80
101
|
## Custom Theme
|
81
102
|
|
82
103
|
Create your own theme class inheriting `Rack::DevMark::Theme::Base`.
|
data/lib/rack/dev-mark.rb
CHANGED
@@ -11,9 +11,17 @@ module Rack
|
|
11
11
|
@env ||= ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.env=(env)
|
15
|
+
@env = env
|
16
|
+
end
|
17
|
+
|
14
18
|
def self.revision
|
15
19
|
@revision ||= (::File.open('REVISION') { |f| f.read.strip } rescue nil)
|
16
20
|
end
|
21
|
+
|
22
|
+
def self.revision=(revision)
|
23
|
+
@revision = revision
|
24
|
+
end
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
File without changes
|
File without changes
|
data/misc/screenshot.gif
ADDED
Binary file
|
data/spec/rack/dev-mark_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Rack::DevMark do
|
|
11
11
|
ENV['RAILS_ENV'] = @rails_env
|
12
12
|
subject.instance_variable_set("@env", nil)
|
13
13
|
end
|
14
|
-
describe "::env" do
|
14
|
+
describe "::env" do
|
15
15
|
it "returns development as default" do
|
16
16
|
ENV['RAILS_ENV'] = nil
|
17
17
|
ENV['RACK_ENV'] = nil
|
@@ -28,6 +28,12 @@ describe Rack::DevMark do
|
|
28
28
|
expect(subject.env).to eq('def')
|
29
29
|
end
|
30
30
|
end
|
31
|
+
describe "::env=" do
|
32
|
+
it "sets custom env" do
|
33
|
+
Rack::DevMark.env = 'custom'
|
34
|
+
expect(Rack::DevMark.env).to eq('custom')
|
35
|
+
end
|
36
|
+
end
|
31
37
|
describe "::revision" do
|
32
38
|
after do
|
33
39
|
::File.delete('REVISION') if ::File.exists?('REVISION')
|
@@ -43,4 +49,10 @@ describe Rack::DevMark do
|
|
43
49
|
expect(subject.revision).to eq(nil)
|
44
50
|
end
|
45
51
|
end
|
52
|
+
describe "::revision=" do
|
53
|
+
it "sets custom revision" do
|
54
|
+
Rack::DevMark.revision = 'custom'
|
55
|
+
expect(Rack::DevMark.revision).to eq('custom')
|
56
|
+
end
|
57
|
+
end
|
46
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-dev-mark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Taniwaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -101,9 +101,10 @@ files:
|
|
101
101
|
- lib/rack/dev-mark/theme/title.rb
|
102
102
|
- lib/rack/dev-mark/utils.rb
|
103
103
|
- lib/rack/dev-mark/version.rb
|
104
|
+
- misc/screenshot-development.png
|
105
|
+
- misc/screenshot-production.png
|
106
|
+
- misc/screenshot.gif
|
104
107
|
- rack-dev-mark.gemspec
|
105
|
-
- screenshot-development.png
|
106
|
-
- screenshot-production.png
|
107
108
|
- spec/generators/rack/dev-mark/install_generator_spec.rb
|
108
109
|
- spec/rack/dev-mark/middleware_spec.rb
|
109
110
|
- spec/rack/dev-mark/railtie_spec.rb
|