bourbon_house 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/README.md +35 -1
- data/bourbon_house.gemspec +1 -1
- data/lib/bourbon_house/config.rb +2 -0
- data/lib/bourbon_house/middleware.rb +21 -4
- data/lib/bourbon_house/version.rb +1 -1
- data/lib/generators/bourbon_house/templates/bourbon_house_config.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a92e2bb9896fe26670a093d0df925c702661d650
|
4
|
+
data.tar.gz: 8c62a7013e7f918c5123d06db398af99055a857c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277f8ff2d5565771479b0728673b97c82d0737113f7ecc16fe2f628e5ab184857662a1bd963e2cc353134663025eccd695271f16bf11637a1040c989803746bc
|
7
|
+
data.tar.gz: 826f7b25f3bca448a1a0cee5c1f8a50bed8825417b12d1ea2ca8676cb8d409dffa3fa9bf855e6ee4db86e16eaed802043552f86e34fe592388182a0dfa2cf5df
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,41 @@ Or install it yourself as:
|
|
36
36
|
|
37
37
|
## Usage
|
38
38
|
|
39
|
-
|
39
|
+
### Use with bourbon_house only
|
40
|
+
|
41
|
+
```sh
|
42
|
+
$ bourbon_house
|
43
|
+
[2017-02-21 19:54:06] INFO WEBrick 1.3.1
|
44
|
+
[2017-02-21 19:54:06] INFO ruby 2.5.0 (2017-01-13) [x86_64-darwin16]
|
45
|
+
[2017-02-21 19:54:06] INFO WEBrick::HTTPServer#start: pid=35483 port=9292
|
46
|
+
|
47
|
+
$ curl localhost:9292
|
48
|
+
やあ (´・ω・`)
|
49
|
+
ようこそ、バーボンハウスへ。
|
50
|
+
このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
|
51
|
+
|
52
|
+
うん、「また」なんだ。済まない。
|
53
|
+
仏の顔もって言うしね、謝って許してもらおうとも思っていない。
|
54
|
+
|
55
|
+
でも、このレスポンスを見たとき、君は、きっと言葉では言い表せない
|
56
|
+
「ときめき」みたいなものを感じてくれたと思う。
|
57
|
+
殺伐とした世の中で、そういう気持ちを忘れないで欲しい
|
58
|
+
そう思って、このライブラリを作ったんだ。
|
59
|
+
|
60
|
+
じゃあ、注文を聞こうか。
|
61
|
+
```
|
62
|
+
|
63
|
+
### Use with Rails
|
64
|
+
|
65
|
+
```sh
|
66
|
+
$ echo "gem 'bourbon_house', group: :development" >> Gemfile
|
67
|
+
$ bundle install
|
68
|
+
$ bin/rails g bourbon_house:config
|
69
|
+
create config/initializers/bourbon_house_config.rb
|
70
|
+
# Edit bourbon_house_config.rb
|
71
|
+
$ bin/rails s
|
72
|
+
# Let's bourbon!
|
73
|
+
```
|
40
74
|
|
41
75
|
## Development
|
42
76
|
|
data/bourbon_house.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency "rack", "~> 2.0"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.13"
|
29
|
-
spec.add_development_dependency "otacop", "~> 0.
|
29
|
+
spec.add_development_dependency "otacop", "~> 0.5"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
31
31
|
spec.add_development_dependency "test-unit", "~> 3.0"
|
32
32
|
end
|
data/lib/bourbon_house/config.rb
CHANGED
@@ -6,15 +6,32 @@ module BourbonHouse
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def call(env)
|
9
|
-
|
9
|
+
return @app.call(env) unless enabled?
|
10
10
|
|
11
|
-
return
|
11
|
+
return bourbon_house_app.call(env) if force?
|
12
12
|
|
13
|
-
if rand(10).zero?
|
14
|
-
|
13
|
+
if rand(10).zero? && allow_method?(env["REQUEST_METHOD"])
|
14
|
+
bourbon_house_app.call(env)
|
15
15
|
else
|
16
16
|
@app.call(env)
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def allow_method?(method)
|
22
|
+
BourbonHouse.config.allow_methods.include?(method.downcase.to_sym)
|
23
|
+
end
|
24
|
+
|
25
|
+
def bourbon_house_app
|
26
|
+
BourbonHouse::Application.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def enabled?
|
30
|
+
!!BourbonHouse.config.enabled
|
31
|
+
end
|
32
|
+
|
33
|
+
def force?
|
34
|
+
!!BourbonHouse.config.force
|
35
|
+
end
|
19
36
|
end
|
20
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bourbon_house
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryoji Yoshioka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|