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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddfc39db6d4988502058b00861bf5faaa3ce999f
4
- data.tar.gz: ae9a37d2d869547faa460c8c8c3f765af30ee1b2
3
+ metadata.gz: 36758996945655b54ce39067905c5649df329d73
4
+ data.tar.gz: 0af6632f318cccfc7136bd329e94fadd9b2479db
5
5
  SHA512:
6
- metadata.gz: e65c503700ca466dd6c43dbdf694e630b80d0e3b37605612a818d27940bcf81e72ca01267f25ae495dd95b9420ebad004ca64a442c0e4245c16cc5062a386fab
7
- data.tar.gz: 5323f0bcade6026a9b05a19e819138f18c0d05a8bc8d55000169da205bfc0723fcb47015fecf167059c2ada8f1a2b30400fdaeb525c9c74f34cc83d82ecc4c07
6
+ metadata.gz: f42ee701a847851fca1d92ff54f58183d828d03b76851a7784d9e31934b4274d88736095b0bf354c76b69f4864275cc790f4d89bd467b54b43dc298c55d3a677
7
+ data.tar.gz: 39b97b50c223748cb4871a13a79a7217d5d26099db849600404e2e7b872b3573cf4bff85ed9a7e9ac30cfeb366f53ff1bf2fee6669fb54ff08716927f2503751
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ inherit_gem:
2
+ otacop: "config/default.yml"
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.3
data/.travis.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  sudo: false
2
2
  language: ruby
3
+ before_install: gem install bundler
3
4
  rvm:
5
+ - 2.3.3
4
6
  - 2.4.0
5
- before_install: gem install bundler -v 1.13.0
7
+ - ruby-head
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in bourbon_house.gemspec
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 "rspec/core/rake_task"
3
+ require "rake/testtask"
4
+ require "rubocop/rake_task"
3
5
 
4
- RSpec::Core::RakeTask.new(:spec)
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
- task :default => :spec
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i(test rubocop)
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "bourbon_house"
@@ -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 = %q{Write a short summary, because Rubygems requires one.}
13
- spec.description = %q{Write a longer description or delete this line.}
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 "rspec", "~> 3.0"
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,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "bourbon_house"
@@ -1,23 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module BourbonHouse
2
3
  class Application
3
- def call(env)
4
- html = <<~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
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ require 'active_support/configurable'
3
+
4
+ module BourbonHouse
5
+ include ActiveSupport::Configurable
6
+
7
+ config.instance_eval do
8
+ self.force = false
9
+ end
10
+ 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
- @app.call(env)
9
+ bh_app = BourbonHouse::Application.new
9
10
 
10
- html = <<~HTML
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
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  module BourbonHouse
2
3
  class Railtie < Rails::Railtie
3
- initializer "bourbon_house.configure_rails_initialization" do |app|
4
+ initializer :bourbon_house do |app|
4
5
  app.middleware.use BourbonHouse::Middleware
5
6
  end
6
7
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rack'
2
3
 
3
4
  module BourbonHouse
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module BourbonHouse
2
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
3
4
  end
data/lib/bourbon_house.rb CHANGED
@@ -1,13 +1,11 @@
1
- require "bourbon_house/version"
1
+ # frozen_string_literal: true
2
+ module BourbonHouse
3
+ end
2
4
 
3
- require "bourbon_house/server"
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?(Rails)
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
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ BourbonHouse.configure do |config|
3
+ # config.force = false
4
+ 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.2
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: 2016-11-16 00:00:00.000000000 Z
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: rake
56
+ name: otacop
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - "~>"
32
60
  - !ruby/object:Gem::Version
33
- version: '10.0'
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: '10.0'
68
+ version: '0.4'
41
69
  - !ruby/object:Gem::Dependency
42
- name: rspec
70
+ name: rake
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '3.0'
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: '3.0'
82
+ version: '10.0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: rack
84
+ name: test-unit
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: '2.0'
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: '2.0'
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.5.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.