active_record_rack 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea445f1a396d3499d125025c8d48a58e140144e2
4
+ data.tar.gz: d456322498d66e502c3e7da9d832815b670f532b
5
+ SHA512:
6
+ metadata.gz: 48612cba968921aafc378b592a5b5b9b8f5093ec2ccbc014b7225c7b17720b47a3db877e8d458a0619134ee27d3a238504ae77a5fd4ff6e193a89e1ce2e815b8
7
+ data.tar.gz: e006ca58c198a73221120702edcfdd4be01b80105acb9713cd7d7cd42a1a98b3070eef6403984257ba28df65ce09fce0e513d1dca03f0565c2f97d33d1ed3f4e
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /gemfiles/.bundle
5
+ /gemfiles/*.lock
6
+ /_yardoc/
7
+ /coverage/
8
+ /doc/
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
12
+ /.idea/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1,9 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.1
3
+
4
+ Metrics/LineLength:
5
+ Max: 120
6
+ Enabled: true
7
+
8
+ Style/Documentation:
9
+ Enabled: false
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby-head
4
+ - 2.4
5
+ - 2.3
6
+ - 2.2
7
+ - 2.1
8
+ gemfile:
9
+ - Gemfile
10
+ - gemfiles/activerecord_5.gemfile
11
+ - gemfiles/activerecord_4.gemfile
12
+ matrix:
13
+ exclude:
14
+ - rvm: 2.1
15
+ gemfile: gemfiles/activerecord_5.gemfile
16
+ script: "bundle exec rake spec"
@@ -0,0 +1,7 @@
1
+ appraise 'activerecord_4' do
2
+ gem 'activerecord', '~> 4'
3
+ end
4
+
5
+ appraise 'activerecord_5' do
6
+ gem 'activerecord', '~> 5'
7
+ end
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,51 @@
1
+ [![Gem Version](https://badge.fury.io/rb/active_record_rack.svg)](https://badge.fury.io/rb/active_record_rack)
2
+ [![Build Status](https://travis-ci.org/u2i/active_record_rack.svg?branch=master)](https://travis-ci.org/u2i/active_record_rack)
3
+
4
+ # ActiveRecordRack
5
+
6
+ Rack middleware managing ActiveRecord connections in standalone (non-Rails) applications.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'active_record_rack'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install activerecord_rack
23
+
24
+ ## Usage
25
+
26
+ `ActiveRecordRack::RackMiddleware` class implements Rack interface. Add it to your web application as regular Rack middleware.
27
+
28
+ ### Sinatra example
29
+
30
+ ```ruby
31
+ require 'active_record_rack'
32
+
33
+ class AwesomeApp < Sinatra::Base
34
+ use ActiveRecordRack::RackMiddleware
35
+
36
+ get '/?' do
37
+ # You can use ActiveRecord here and the connections will be automatically returned to the pool
38
+ end
39
+ end
40
+ ```
41
+
42
+ ## Development
43
+
44
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/u2i/active_record_rack.
51
+
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ RuboCop::RakeTask.new(:rubocop) do |task|
8
+ task.options = %w[--display-cop-names --format simple]
9
+ end
10
+
11
+ # rubocop:disable Style/SymbolArray
12
+ task default: [:spec, :rubocop]
13
+ # rubocop:enable Style/SymbolArray
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'active_record_rack/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'active_record_rack'
7
+ spec.version = ActiveRecordRack::VERSION
8
+ spec.authors = ['Marek Mateja']
9
+ spec.email = ['marek.mateja@u2i.com']
10
+
11
+ spec.summary = 'ActiveRecord connection manager for standalone (non-Rails) Rack applications'
12
+ spec.description = 'Rack middleware managing ActiveRecord connections in standalone (non-Rails) applications'
13
+ spec.homepage = 'https://github.com/u2i/active_record_rack'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.required_ruby_version = '>= 2.1'
23
+
24
+ spec.add_dependency 'activerecord', '>= 4'
25
+
26
+ spec.add_development_dependency 'appraisal', '~> 2'
27
+ spec.add_development_dependency 'bundler', '~> 1.14'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'rspec', '~> 3'
30
+ spec.add_development_dependency 'rubocop', '~> 0.51'
31
+ spec.add_development_dependency 'sqlite3', '~> 1'
32
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'active_record_rack'
5
+
6
+ require 'irb'
7
+ IRB.start(__FILE__)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 4"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 5"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ require 'active_record_rack/version'
2
+ require 'active_record_rack/rack_middleware'
3
+
4
+ module ActiveRecordRack
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'active_record'
2
+
3
+ module ActiveRecordRack
4
+ class RackMiddleware
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ ActiveRecord::Base.connection_pool.with_connection { @app.call(env) }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveRecordRack
2
+ VERSION = '0.1.0'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_record_rack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Marek Mateja
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: appraisal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.51'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.51'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1'
111
+ description: Rack middleware managing ActiveRecord connections in standalone (non-Rails)
112
+ applications
113
+ email:
114
+ - marek.mateja@u2i.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".travis.yml"
123
+ - Appraisals
124
+ - Gemfile
125
+ - README.md
126
+ - Rakefile
127
+ - active_record_rack.gemspec
128
+ - bin/console
129
+ - bin/setup
130
+ - gemfiles/activerecord_4.gemfile
131
+ - gemfiles/activerecord_5.gemfile
132
+ - lib/active_record_rack.rb
133
+ - lib/active_record_rack/rack_middleware.rb
134
+ - lib/active_record_rack/version.rb
135
+ homepage: https://github.com/u2i/active_record_rack
136
+ licenses: []
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '2.1'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.6.11
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: ActiveRecord connection manager for standalone (non-Rails) Rack applications
158
+ test_files: []