ready-for-migration 0.1.0

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
+ SHA256:
3
+ metadata.gz: ed093d37434ed4e1f83202c1e3701bca3bcd1001c50a9ecbae29fab4fe7e8e7f
4
+ data.tar.gz: d0fd1e2cd5fc8be803efdd52f9f09af7c0912459aec4f1a6d958915cd5198483
5
+ SHA512:
6
+ metadata.gz: 885d484b08c3f30fd07cb482d11b9fe46f0f9b62d500230c2cf3b892b0a7e85d80621b138332a397287ab12e5689b835e2247d3a877fc3fcfd41af0453662740
7
+ data.tar.gz: bf4f48eea6820fe615f913ce87b7cab643c8a3e4b81869b7eb330900f0c928ac8c575c9077c0eb495bfcc3752c218e6f76ce665268ea0ca30011928ff2ab514d
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2022 sera
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Ready::For::Migration
2
+
3
+ This is an Rails Engine that provides an endpoint that responds whether the application migration has done or not.
4
+
5
+ ## Usage
6
+
7
+ Add this line to your Rails application's config/routes.rb:
8
+
9
+ ```
10
+ mount Ready::For::Migration::Engine, at: '/'
11
+
12
+ ```
13
+
14
+ This makes the path "/healthz" available.
15
+ If your application migration has be done, it returns 200 OK, otherwise it returns 503 Service Unavailable.
16
+
17
+
18
+ ## Installation
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ ```ruby
23
+ gem 'ready-for-migration'
24
+ ```
25
+
26
+ Or install it yourself as:
27
+
28
+ ```bash
29
+ $ gem install ready-for-migration
30
+ ```
31
+
32
+ ## License
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
8
+ load 'rails/tasks/engine.rake'
9
+
10
+ load 'rails/tasks/statistics.rake'
11
+
12
+ require 'bundler/gem_tasks'
13
+
14
+ require 'rake/testtask'
15
+
16
+ Rake::TestTask.new(:test) do |t|
17
+ t.libs << 'test'
18
+ t.pattern = 'test/**/*_test.rb'
19
+ t.verbose = false
20
+ end
21
+
22
+ task default: :test
@@ -0,0 +1,13 @@
1
+ module ReadyForMigration
2
+ class HealthController < ::ActionController::Base
3
+
4
+ def readiness
5
+ if ApplicationRecord.connection.migration_context.needs_migration?
6
+ head 503
7
+ else
8
+ head 200
9
+ end
10
+ end
11
+
12
+ end
13
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ Ready::For::Migration::Engine.routes.draw do
2
+
3
+ get 'healthz', to: 'ready_for_migration/health#readiness'
4
+
5
+ end
@@ -0,0 +1,8 @@
1
+ module Ready
2
+ module For
3
+ module Migration
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Ready
2
+ module For
3
+ module Migration
4
+ VERSION = '0.1.0'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require "ready/for/migration/engine"
2
+
3
+ module Ready
4
+ module For
5
+ module Migration
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ready-for-migration
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - bizside-developers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.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.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: 1.5.0
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '1.3'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: 1.5.0
47
+ description: add api to check ready for DB migration of rails application
48
+ email:
49
+ - bizside-developers@lab.acs-jp.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - MIT-LICENSE
55
+ - README.md
56
+ - Rakefile
57
+ - app/controllers/ready_for_migration/health_controller.rb
58
+ - config/routes.rb
59
+ - lib/ready/for/migration.rb
60
+ - lib/ready/for/migration/engine.rb
61
+ - lib/ready/for/migration/version.rb
62
+ homepage: https://github.com/maedadev/ready-for-migration
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.7.6.2
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: ready for migration
86
+ test_files: []