enforce_mysql_version 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e9f94786b4e7a21cc520410bf91b4f9be416320
4
+ data.tar.gz: f00fddfc917464b42c8e4b11e85ccbacb4d7a834
5
+ SHA512:
6
+ metadata.gz: e39b243d657fa52f6aeddadac59b09e597f49bb013a3ed5b1f0bb3dec3aa97ca2156a8f9ad3e9afc51aea9080247ddf02c32ee0d17dd64452222725990643c8e
7
+ data.tar.gz: bc98c5792b82378f1b8369b44e63d1625764ba897a0609bf16e1d6edb4396616c6ccbebd5f06382f9ed1a72ad86cbed7f9a53d5fb5094ffb7c8c46a8f1222726
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,25 @@
1
+ sudo: required
2
+ dist: trusty
3
+ language: ruby
4
+ rvm:
5
+ - 2.0.0-p648
6
+ - 2.1.10
7
+ - 2.2.5
8
+ - 2.3.1
9
+ env:
10
+ - RAILS_VERSION="~>4.0.0"
11
+ - RAILS_VERSION="~>4.1.0"
12
+ - RAILS_VERSION="~>4.2.0"
13
+ services:
14
+ - docker
15
+
16
+ before_script:
17
+ - docker-compose up -d
18
+ - while ! nc -w 1 127.0.0.1 33055 2>/dev/null; do sleep 1; done
19
+ - while ! nc -w 1 127.0.0.1 33056 2>/dev/null; do sleep 1; done
20
+ - while ! nc -w 1 127.0.0.1 33057 2>/dev/null; do sleep 1; done
21
+
22
+ script:
23
+ - bundle install
24
+ - bundle install --gemfile spec/rails_app/Gemfile
25
+ - bundle exec rspec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in enforce_mysql_version.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Pip Taylor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Enforce MySQL Version
2
+
3
+ [![Build
4
+ Status](https://travis-ci.org/pipt/enforce_mysql_version.png?branch=master)](https://travis-ci.org/pipt/enforce_mysql_version)
5
+
6
+ This gem will allow you to prevent your rails app from starting unless
7
+ the version of MySQL it's running against is a specific major/minor
8
+ version.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem "enforce_mysql_version", require: "5.6"
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ ## Usage
23
+
24
+ Adding the gem to your `Gemfile` as shown in the installation
25
+ instructions is all you need to do. MySQL versions that can be required
26
+ are `5.5`, `5.6` and `5.7`. If you don't provide a required version in
27
+ your `Gemfile`, this gem will have no effect.
28
+
29
+ ## Compatibility
30
+
31
+ The gem is tested against Ruby versions `2.0`, `2.1`, `2.2` and `2.3` as well as
32
+ Rails versions `4.0`, `4.1` and `4.2`.
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bundle` to install ruby dependecies. Run `docker-compose up` to install and start versions `5.5`, `5.6` and `5.7` of MySQL. Then, run `bundle exec rspec` to run the tests.
37
+
38
+ 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).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pipt/enforce_mysql_version.
43
+
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,18 @@
1
+ mysql55:
2
+ image: mysql:5.5
3
+ ports:
4
+ - "33055:3306"
5
+ environment:
6
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
7
+ mysql56:
8
+ image: mysql:5.6
9
+ ports:
10
+ - "33056:3306"
11
+ environment:
12
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
13
+ mysql57:
14
+ image: mysql:5.7
15
+ ports:
16
+ - "33057:3306"
17
+ environment:
18
+ - MYSQL_ALLOW_EMPTY_PASSWORD=true
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'enforce_mysql_version/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "enforce_mysql_version"
8
+ spec.version = EnforceMysqlVersion::VERSION
9
+ spec.authors = ["Pip Taylor"]
10
+ spec.email = ["git@evilgeek.co.uk"]
11
+
12
+ spec.summary = %q{Only start Rails if MySQL is a specific version}
13
+ spec.homepage = "https://github.com/pipt/enforce_mysql_version"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.12"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+ end
data/lib/5.5.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "enforce_mysql_version"
2
+
3
+ EnforceMysqlVersion::REQUIRED_VERSION = "5.5"
4
+
5
+ require "enforce_mysql_version/railtie" if defined?(Rails)
data/lib/5.6.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "enforce_mysql_version"
2
+
3
+ EnforceMysqlVersion::REQUIRED_VERSION = "5.6"
4
+
5
+ require "enforce_mysql_version/railtie" if defined?(Rails)
data/lib/5.7.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "enforce_mysql_version"
2
+
3
+ EnforceMysqlVersion::REQUIRED_VERSION = "5.7"
4
+
5
+ require "enforce_mysql_version/railtie" if defined?(Rails)
@@ -0,0 +1,12 @@
1
+ module EnforceMysqlVersion
2
+ class Railtie < Rails::Railtie
3
+ initializer "enforce_mysql_version" do
4
+ mysql_version = ActiveRecord::Base.connection.select_value("select version()")
5
+
6
+ unless mysql_version.start_with?(EnforceMysqlVersion::REQUIRED_VERSION)
7
+ puts "App startup was prevented by the gem enforce_mysql_version. This app won't start unless the MySQL major/minor version is #{EnforceMysqlVersion::REQUIRED_VERSION}"
8
+ exit(false)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module EnforceMysqlVersion
2
+ VERSION = "1.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ module EnforceMysqlVersion
2
+ end
3
+
4
+ require "enforce_mysql_version/version"
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: enforce_mysql_version
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.1'
5
+ platform: ruby
6
+ authors:
7
+ - Pip Taylor
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - git@evilgeek.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - docker-compose.yml
70
+ - enforce_mysql_version.gemspec
71
+ - lib/5.5.rb
72
+ - lib/5.6.rb
73
+ - lib/5.7.rb
74
+ - lib/enforce_mysql_version.rb
75
+ - lib/enforce_mysql_version/railtie.rb
76
+ - lib/enforce_mysql_version/version.rb
77
+ homepage: https://github.com/pipt/enforce_mysql_version
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.5.1
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Only start Rails if MySQL is a specific version
101
+ test_files: []