bourbon_house 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.rubocop.yml +5 -0
- data/.travis.yml +6 -1
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +12 -3
- data/bin/console +1 -0
- data/bourbon_house.gemspec +8 -4
- data/exe/bourbon_house +1 -0
- data/lib/bourbon_house/application.rb +3 -18
- data/lib/bourbon_house/bartender.rb +24 -0
- data/lib/bourbon_house/config.rb +10 -0
- data/lib/bourbon_house/middleware.rb +8 -19
- data/lib/bourbon_house/railtie.rb +2 -1
- data/lib/bourbon_house/server.rb +1 -0
- data/lib/bourbon_house/version.rb +2 -1
- data/lib/bourbon_house.rb +8 -10
- data/lib/generators/bourbon_house/config_generator.rb +16 -0
- data/lib/generators/bourbon_house/templates/bourbon_house_config.rb +4 -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: 36758996945655b54ce39067905c5649df329d73
|
4
|
+
data.tar.gz: 0af6632f318cccfc7136bd329e94fadd9b2479db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f42ee701a847851fca1d92ff54f58183d828d03b76851a7784d9e31934b4274d88736095b0bf354c76b69f4864275cc790f4d89bd467b54b43dc298c55d3a677
|
7
|
+
data.tar.gz: 39b97b50c223748cb4871a13a79a7217d5d26099db849600404e2e7b872b3573cf4bff85ed9a7e9ac30cfeb366f53ff1bf2fee6669fb54ff08716927f2503751
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# BourbonHouse [![Gem Version](https://badge.fury.io/rb/bourbon_house.svg)](https://badge.fury.io/rb/bourbon_house)
|
1
|
+
# BourbonHouse [![Gem Version](https://badge.fury.io/rb/bourbon_house.svg)](https://badge.fury.io/rb/bourbon_house) [![Build Status](https://travis-ci.org/ojiry/bourbon_house.svg?branch=master)](https://travis-ci.org/ojiry/bourbon_house)
|
2
2
|
|
3
3
|
```
|
4
4
|
やあ (´・ω・`)
|
data/Rakefile
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "bundler/gem_tasks"
|
2
|
-
require "
|
3
|
+
require "rake/testtask"
|
4
|
+
require "rubocop/rake_task"
|
3
5
|
|
4
|
-
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.libs << 'test'
|
8
|
+
t.test_files = FileList['test/**/*_test.rb']
|
9
|
+
t.warning = true
|
10
|
+
t.verbose = true
|
11
|
+
end
|
5
12
|
|
6
|
-
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
15
|
+
task default: %i(test rubocop)
|
data/bin/console
CHANGED
data/bourbon_house.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'bourbon_house/version'
|
@@ -9,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
9
10
|
spec.authors = ["Ryoji Yoshioka"]
|
10
11
|
spec.email = ["yoshioka.ryoji@gmail.com"]
|
11
12
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
13
|
+
spec.summary = "Write a short summary, because Rubygems requires one."
|
14
|
+
spec.description = "Write a longer description or delete this line."
|
14
15
|
spec.homepage = "https://github.com/ojiry/bourbon_house"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
@@ -21,8 +22,11 @@ Gem::Specification.new do |spec|
|
|
21
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
23
|
spec.require_paths = ["lib"]
|
23
24
|
|
25
|
+
spec.add_dependency "activesupport", ">= 5.0"
|
26
|
+
spec.add_dependency "rack", "~> 2.0"
|
27
|
+
|
24
28
|
spec.add_development_dependency "bundler", "~> 1.13"
|
29
|
+
spec.add_development_dependency "otacop", "~> 0.4"
|
25
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "rack", "~> 2.0"
|
31
|
+
spec.add_development_dependency "test-unit", "~> 3.0"
|
28
32
|
end
|
data/exe/bourbon_house
CHANGED
@@ -1,23 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module BourbonHouse
|
2
3
|
class Application
|
3
|
-
def call(
|
4
|
-
html =
|
5
|
-
やあ (´・ω・`)
|
6
|
-
|
7
|
-
ようこそ、バーボンハウスへ。
|
8
|
-
このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
|
9
|
-
|
10
|
-
うん、「また」なんだ。済まない。
|
11
|
-
仏の顔もって言うしね、謝って許してもらおうとも思っていない。
|
12
|
-
|
13
|
-
でも、この Response を見たとき、君は、きっと言葉では言い表せない
|
14
|
-
「ときめき」みたいなものを感じてくれたと思う。
|
15
|
-
|
16
|
-
殺伐とした世の中で、そういう気持ちを忘れないで欲しい
|
17
|
-
そう思って、この Gem を作ったんだ。
|
18
|
-
|
19
|
-
じゃあ、注文を聞こうか。
|
20
|
-
HTML
|
4
|
+
def call(_env)
|
5
|
+
html = BourbonHouse::Bartender.message
|
21
6
|
|
22
7
|
[200, { 'Content-Type' => 'text/plain' }, [html]]
|
23
8
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module BourbonHouse
|
3
|
+
class Bartender
|
4
|
+
class << self
|
5
|
+
def message
|
6
|
+
<<~HTML
|
7
|
+
やあ (´・ω・`)
|
8
|
+
ようこそ、バーボンハウスへ。
|
9
|
+
このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
|
10
|
+
|
11
|
+
うん、「また」なんだ。済まない。
|
12
|
+
仏の顔もって言うしね、謝って許してもらおうとも思っていない。
|
13
|
+
|
14
|
+
でも、このレスポンスを見たとき、君は、きっと言葉では言い表せない
|
15
|
+
「ときめき」みたいなものを感じてくれたと思う。
|
16
|
+
殺伐とした世の中で、そういう気持ちを忘れないで欲しい
|
17
|
+
そう思って、このライブラリを作ったんだ。
|
18
|
+
|
19
|
+
じゃあ、注文を聞こうか。
|
20
|
+
HTML
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module BourbonHouse
|
2
3
|
class Middleware
|
3
4
|
def initialize(app)
|
@@ -5,27 +6,15 @@ module BourbonHouse
|
|
5
6
|
end
|
6
7
|
|
7
8
|
def call(env)
|
8
|
-
|
9
|
+
bh_app = BourbonHouse::Application.new
|
9
10
|
|
10
|
-
|
11
|
-
やあ (´・ω・`)
|
11
|
+
return bh_app.call(env) if BourbonHouse.config.force
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
でも、この Response を見たとき、君は、きっと言葉では言い表せない
|
20
|
-
「ときめき」みたいなものを感じてくれたと思う。
|
21
|
-
|
22
|
-
殺伐とした世の中で、そういう気持ちを忘れないで欲しい
|
23
|
-
そう思って、この Gem を作ったんだ。
|
24
|
-
|
25
|
-
じゃあ、注文を聞こうか。
|
26
|
-
HTML
|
27
|
-
|
28
|
-
[200, { 'Content-Type' => 'text/plain' }, [html]]
|
13
|
+
if rand(10).zero?
|
14
|
+
bh_app.call(env)
|
15
|
+
else
|
16
|
+
@app.call(env)
|
17
|
+
end
|
29
18
|
end
|
30
19
|
end
|
31
20
|
end
|
data/lib/bourbon_house/server.rb
CHANGED
data/lib/bourbon_house.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module BourbonHouse
|
3
|
+
end
|
2
4
|
|
3
|
-
require "bourbon_house/
|
5
|
+
require "bourbon_house/config"
|
4
6
|
require "bourbon_house/application"
|
7
|
+
require "bourbon_house/bartender"
|
8
|
+
require "bourbon_house/server"
|
9
|
+
require "bourbon_house/middleware"
|
5
10
|
|
6
|
-
if defined?
|
7
|
-
require 'bourbon_house/middleware'
|
8
|
-
require 'bourbon_house/railtie'
|
9
|
-
end
|
10
|
-
|
11
|
-
module BourbonHouse
|
12
|
-
# Your code goes here...
|
13
|
-
end
|
11
|
+
require "bourbon_house/railtie" if defined? ::Rails::Railtie
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module BourbonHouse
|
3
|
+
module Generators
|
4
|
+
class ConfigGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
6
|
+
|
7
|
+
desc <<DESC
|
8
|
+
Description:
|
9
|
+
Copies BourbonHouse configuration file to your application's initializer directory.
|
10
|
+
DESC
|
11
|
+
def copy_config_file
|
12
|
+
template 'bourbon_house_config.rb', 'config/initializers/bourbon_house_config.rb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryoji Yoshioka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,47 +53,47 @@ dependencies:
|
|
25
53
|
- !ruby/object:Gem::Version
|
26
54
|
version: '1.13'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
56
|
+
name: otacop
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
59
|
- - "~>"
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
61
|
+
version: '0.4'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
68
|
+
version: '0.4'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
70
|
+
name: rake
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
75
|
+
version: '10.0'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '10.0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: test-unit
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
89
|
+
version: '3.0'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
96
|
+
version: '3.0'
|
69
97
|
description: Write a longer description or delete this line.
|
70
98
|
email:
|
71
99
|
- yoshioka.ryoji@gmail.com
|
@@ -75,6 +103,8 @@ extensions: []
|
|
75
103
|
extra_rdoc_files: []
|
76
104
|
files:
|
77
105
|
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".rubocop.yml"
|
78
108
|
- ".travis.yml"
|
79
109
|
- Gemfile
|
80
110
|
- LICENSE.txt
|
@@ -86,10 +116,14 @@ files:
|
|
86
116
|
- exe/bourbon_house
|
87
117
|
- lib/bourbon_house.rb
|
88
118
|
- lib/bourbon_house/application.rb
|
119
|
+
- lib/bourbon_house/bartender.rb
|
120
|
+
- lib/bourbon_house/config.rb
|
89
121
|
- lib/bourbon_house/middleware.rb
|
90
122
|
- lib/bourbon_house/railtie.rb
|
91
123
|
- lib/bourbon_house/server.rb
|
92
124
|
- lib/bourbon_house/version.rb
|
125
|
+
- lib/generators/bourbon_house/config_generator.rb
|
126
|
+
- lib/generators/bourbon_house/templates/bourbon_house_config.rb
|
93
127
|
homepage: https://github.com/ojiry/bourbon_house
|
94
128
|
licenses:
|
95
129
|
- MIT
|
@@ -110,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
144
|
version: '0'
|
111
145
|
requirements: []
|
112
146
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.6.8
|
114
148
|
signing_key:
|
115
149
|
specification_version: 4
|
116
150
|
summary: Write a short summary, because Rubygems requires one.
|