ie_status_controller 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.gitlab-ci.yml +45 -0
  4. data/.rspec +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +147 -0
  8. data/README.rdoc +44 -0
  9. data/Rakefile +10 -0
  10. data/app/controllers/ie_status_controller/status_controller.rb +17 -0
  11. data/app/models/ie_status_controller/uptime_verification.rb +5 -0
  12. data/config/routes.rb +5 -0
  13. data/db/migrate/20160303054342_create_ie_status_controller_uptime_verifications.rb +7 -0
  14. data/dummy/app/assets/javascripts/application.js +15 -0
  15. data/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/dummy/app/controllers/application_controller.rb +3 -0
  17. data/dummy/app/helpers/application_helper.rb +2 -0
  18. data/dummy/app/mailers/.gitkeep +0 -0
  19. data/dummy/app/models/.gitkeep +0 -0
  20. data/dummy/app/views/layouts/application.html.erb +14 -0
  21. data/dummy/config/application.rb +50 -0
  22. data/dummy/config/boot.rb +10 -0
  23. data/dummy/config/database.yml +25 -0
  24. data/dummy/config/environment.rb +5 -0
  25. data/dummy/config/environments/development.rb +30 -0
  26. data/dummy/config/environments/production.rb +67 -0
  27. data/dummy/config/environments/test.rb +37 -0
  28. data/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/dummy/config/initializers/inflections.rb +15 -0
  30. data/dummy/config/initializers/mime_types.rb +5 -0
  31. data/dummy/config/initializers/secret_token.rb +7 -0
  32. data/dummy/config/initializers/session_store.rb +8 -0
  33. data/dummy/config/initializers/wrap_parameters.rb +14 -0
  34. data/dummy/config/locales/en.yml +5 -0
  35. data/dummy/config/routes.rb +4 -0
  36. data/dummy/config.ru +4 -0
  37. data/dummy/lib/assets/.gitkeep +0 -0
  38. data/dummy/log/.gitkeep +0 -0
  39. data/dummy/public/404.html +26 -0
  40. data/dummy/public/422.html +26 -0
  41. data/dummy/public/500.html +25 -0
  42. data/dummy/public/favicon.ico +0 -0
  43. data/dummy/script/rails +6 -0
  44. data/ie_status_controller.gemspec +30 -0
  45. data/lib/ie_status_controller/engine.rb +19 -0
  46. data/lib/ie_status_controller/version.rb +3 -0
  47. data/lib/ie_status_controller.rb +3 -0
  48. data/satorix/CI/deploy/rubygems.rb +77 -0
  49. data/satorix/custom.rb +21 -0
  50. data/spec/requests/status_page_spec.rb +8 -0
  51. data/spec/spec_helper.rb +28 -0
  52. metadata +109 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 031e1973e2ffda392fc40ded2b94ef5da5204cf3a9a44b85c639bacf3ed4815d
4
+ data.tar.gz: d22580023d13a7752e070d23395cba86f3bc2ee69bf38e198b5cceacfd4e27ce
5
+ SHA512:
6
+ metadata.gz: f6222a24a2393c1ebf6bf3df96977a73bced2196be7756fd5527938a51482231ed85a5c9d06760c084882b13aebc717f5e15035fb33687dd851d33c56cb7886d
7
+ data.tar.gz: 385a8efd41b4c91ba4831419bfe73cf64c83f65db96d37316dd05de7abdf112262468ca281db7797c69612fd517d5523ccfc43eaefac0a7391eb8de66438166b
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ pkg/*
4
+ *.log
5
+ *.sqlite3
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,45 @@
1
+ image: 'satorix/base'
2
+
3
+ cache:
4
+ key: "$CI_PROJECT_ID"
5
+ paths:
6
+ - 'tmp/satorix/cache' # To cache buildpack gems between runs.
7
+
8
+
9
+ .satorix: &satorix
10
+ script:
11
+ - gem install satorix --source https://gems.iexposure.com --no-document
12
+ - satorix
13
+
14
+
15
+ # bundler-audit
16
+ # Patch-level verification for Bundler
17
+ # https://github.com/rubysec/bundler-audit
18
+ #bundler_audit:
19
+ #<<: *satorix
20
+
21
+
22
+ ## RSpec
23
+ ## Behaviour Driven Development for Ruby
24
+ ## http://rspec.info/
25
+ #rspec:
26
+ #<<: *satorix
27
+
28
+
29
+ ## RuboCop
30
+ ## A Ruby static code analyzer, based on the community Ruby style guide.
31
+ ## https://github.com/bbatsov/rubocop
32
+ #rubocop:
33
+ #<<: *satorix
34
+ #allow_failure: true
35
+
36
+
37
+
38
+ # This is a custom job, defined at satorix/CI/deploy/rubygems.rb
39
+ deploy_to_rubygems:
40
+ stage: deploy
41
+ only:
42
+ - tags
43
+ except:
44
+ - schedules
45
+ <<: *satorix
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.6.6
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ ruby File.open("#{ File.dirname(__FILE__) }/.ruby-version", &:gets).strip[/ruby-(.+)/i, 1]
2
+
3
+ source "http://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ie_status_controller.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,147 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ie_status_controller (2.3.0)
5
+ rails (>= 4.1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actioncable (6.1.4.1)
11
+ actionpack (= 6.1.4.1)
12
+ activesupport (= 6.1.4.1)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.1.4.1)
16
+ actionpack (= 6.1.4.1)
17
+ activejob (= 6.1.4.1)
18
+ activerecord (= 6.1.4.1)
19
+ activestorage (= 6.1.4.1)
20
+ activesupport (= 6.1.4.1)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.4.1)
23
+ actionpack (= 6.1.4.1)
24
+ actionview (= 6.1.4.1)
25
+ activejob (= 6.1.4.1)
26
+ activesupport (= 6.1.4.1)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.1.4.1)
30
+ actionview (= 6.1.4.1)
31
+ activesupport (= 6.1.4.1)
32
+ rack (~> 2.0, >= 2.0.9)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.4.1)
37
+ actionpack (= 6.1.4.1)
38
+ activerecord (= 6.1.4.1)
39
+ activestorage (= 6.1.4.1)
40
+ activesupport (= 6.1.4.1)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.4.1)
43
+ activesupport (= 6.1.4.1)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.1.4.1)
49
+ activesupport (= 6.1.4.1)
50
+ globalid (>= 0.3.6)
51
+ activemodel (6.1.4.1)
52
+ activesupport (= 6.1.4.1)
53
+ activerecord (6.1.4.1)
54
+ activemodel (= 6.1.4.1)
55
+ activesupport (= 6.1.4.1)
56
+ activestorage (6.1.4.1)
57
+ actionpack (= 6.1.4.1)
58
+ activejob (= 6.1.4.1)
59
+ activerecord (= 6.1.4.1)
60
+ activesupport (= 6.1.4.1)
61
+ marcel (~> 1.0.0)
62
+ mini_mime (>= 1.1.0)
63
+ activesupport (6.1.4.1)
64
+ concurrent-ruby (~> 1.0, >= 1.0.2)
65
+ i18n (>= 1.6, < 2)
66
+ minitest (>= 5.1)
67
+ tzinfo (~> 2.0)
68
+ zeitwerk (~> 2.3)
69
+ builder (3.2.4)
70
+ concurrent-ruby (1.1.9)
71
+ crass (1.0.6)
72
+ erubi (1.10.0)
73
+ globalid (0.5.2)
74
+ activesupport (>= 5.0)
75
+ i18n (1.8.11)
76
+ concurrent-ruby (~> 1.0)
77
+ loofah (2.12.0)
78
+ crass (~> 1.0.2)
79
+ nokogiri (>= 1.5.9)
80
+ mail (2.7.1)
81
+ mini_mime (>= 0.1.1)
82
+ marcel (1.0.2)
83
+ method_source (1.0.0)
84
+ mini_mime (1.1.2)
85
+ mini_portile2 (2.6.1)
86
+ minitest (5.14.4)
87
+ nio4r (2.5.8)
88
+ nokogiri (1.12.5)
89
+ mini_portile2 (~> 2.6.1)
90
+ racc (~> 1.4)
91
+ racc (1.6.0)
92
+ rack (2.2.3)
93
+ rack-test (1.1.0)
94
+ rack (>= 1.0, < 3)
95
+ rails (6.1.4.1)
96
+ actioncable (= 6.1.4.1)
97
+ actionmailbox (= 6.1.4.1)
98
+ actionmailer (= 6.1.4.1)
99
+ actionpack (= 6.1.4.1)
100
+ actiontext (= 6.1.4.1)
101
+ actionview (= 6.1.4.1)
102
+ activejob (= 6.1.4.1)
103
+ activemodel (= 6.1.4.1)
104
+ activerecord (= 6.1.4.1)
105
+ activestorage (= 6.1.4.1)
106
+ activesupport (= 6.1.4.1)
107
+ bundler (>= 1.15.0)
108
+ railties (= 6.1.4.1)
109
+ sprockets-rails (>= 2.0.0)
110
+ rails-dom-testing (2.0.3)
111
+ activesupport (>= 4.2.0)
112
+ nokogiri (>= 1.6)
113
+ rails-html-sanitizer (1.4.2)
114
+ loofah (~> 2.3)
115
+ railties (6.1.4.1)
116
+ actionpack (= 6.1.4.1)
117
+ activesupport (= 6.1.4.1)
118
+ method_source
119
+ rake (>= 0.13)
120
+ thor (~> 1.0)
121
+ rake (13.0.6)
122
+ sprockets (4.0.2)
123
+ concurrent-ruby (~> 1.0)
124
+ rack (> 1, < 3)
125
+ sprockets-rails (3.3.0)
126
+ actionpack (>= 5.2)
127
+ activesupport (>= 5.2)
128
+ sprockets (>= 3.0.0)
129
+ thor (1.1.0)
130
+ tzinfo (2.0.4)
131
+ concurrent-ruby (~> 1.0)
132
+ websocket-driver (0.7.5)
133
+ websocket-extensions (>= 0.1.0)
134
+ websocket-extensions (0.1.5)
135
+ zeitwerk (2.5.1)
136
+
137
+ PLATFORMS
138
+ ruby
139
+
140
+ DEPENDENCIES
141
+ ie_status_controller!
142
+
143
+ RUBY VERSION
144
+ ruby 2.6.6p146
145
+
146
+ BUNDLED WITH
147
+ 1.17.3
data/README.rdoc ADDED
@@ -0,0 +1,44 @@
1
+ = IE Status Controller Gem
2
+
3
+ Gem for adding a consistent entrypoint for application uptime monitoring.
4
+
5
+ == Features
6
+
7
+ Exercises the full application stack, including the database read/write.
8
+
9
+ * Renders <tt>iedb$ok</tt> with a status code of _200_ if everything is OK.
10
+ * Renders <tt>iedb?error</tt> with a status code of _503_ if anything goes wrong.
11
+
12
+ == Supported Versions
13
+ Known to work, other versions may work as well.
14
+
15
+ * Rails > 4.2 (Use version 2.1 of this gem for support for versions: 3.2, 4.0, 4.1)
16
+
17
+ == Installation
18
+
19
+ === Gemfile
20
+
21
+ Ensure this line is at the top of your Gemfile:
22
+ source 'https://gems.iexposure.com'
23
+
24
+ Then, put this line in your Gemfile:
25
+ gem 'ie_status_controller'
26
+
27
+ Run bundle:
28
+ % bundle
29
+
30
+ Finally, run migrations for your application:
31
+ bundle exec rake db:migrate
32
+
33
+ === Routes
34
+
35
+ In <i>config/routes.rb</i>, add:
36
+ mount IeStatusController::Engine => '/status'
37
+
38
+ <i><b>Note:</b> Rails routes are processed from the top down. This route is frequently requested by automated processes,
39
+ and should be placed toward the top of your routes for maximum application performance.</i>
40
+
41
+ == Usage
42
+
43
+ Hit your application at <tt>/status/alive</tt> to check the status.
44
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ begin
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
@@ -0,0 +1,17 @@
1
+ module IeStatusController
2
+ class StatusController < ActionController::Base
3
+
4
+
5
+ layout nil
6
+
7
+
8
+ def alive
9
+ UptimeVerification.first_or_create.touch
10
+ render plain: 'iedb$ok'
11
+ rescue
12
+ render plain: 'iedb?error', status: 503
13
+ end
14
+
15
+
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module IeStatusController
2
+ class UptimeVerification < ActiveRecord::Base
3
+
4
+ end
5
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ IeStatusController::Engine.routes.draw do
2
+ # we're restricting this to get requests only
3
+ # doesn't matter much but is a point of good hygene
4
+ match 'alive' => 'status#alive', via: :get
5
+ end
@@ -0,0 +1,7 @@
1
+ class CreateIeStatusControllerUptimeVerifications < ActiveRecord::Migration[4.2]
2
+ def change
3
+ create_table :ie_status_controller_uptime_verifications do |t|
4
+ t.timestamps null: false
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,50 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+ require 'bundler'
5
+
6
+ Bundler.require
7
+ require "ie_status_controller"
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ # config.autoload_paths += %W(#{config.root}/extras)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # Configure the default encoding used in templates for Ruby 1.9.
34
+ config.encoding = "utf-8"
35
+
36
+ # Configure sensitive parameters which will be filtered from the log file.
37
+ config.filter_parameters += [:password]
38
+
39
+ # Use SQL instead of Active Record's schema dumper when creating the database.
40
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
41
+ # like if you have constraints or database-specific column types
42
+ # config.active_record.schema_format = :sql
43
+
44
+ # Enable the asset pipeline
45
+ config.assets.enabled = true
46
+
47
+ # Version of your assets, change this if you want to expire all your assets
48
+ config.assets.version = '1.0'
49
+ end
50
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,30 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Do not compress assets
26
+ config.assets.compress = false
27
+
28
+ # Expands the lines which load the assets
29
+ config.assets.debug = true
30
+ end
@@ -0,0 +1,67 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
39
+ # Use a different logger for distributed setups
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
+
42
+ # Use a different cache store in production
43
+ # config.cache_store = :mem_cache_store
44
+
45
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
+ # config.action_controller.asset_host = "http://assets.example.com"
47
+
48
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
+ # config.assets.precompile += %w( search.js )
50
+
51
+ # Disable delivery errors, bad email addresses will be ignored
52
+ # config.action_mailer.raise_delivery_errors = false
53
+
54
+ # Enable threaded mode
55
+ # config.threadsafe!
56
+
57
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
+ # the I18n.default_locale when a translation can not be found)
59
+ config.i18n.fallbacks = true
60
+
61
+ # Send deprecation notices to registered listeners
62
+ config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
34
+
35
+ # Print deprecation notices to the stderr
36
+ config.active_support.deprecation = :stderr
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'ed2bb3ba9ac8177042124f87fd598ce0a0670eff5c69b9b73e10d83b47d8399a04324f04e91c70836980e6a70387a9b7b4d6e7b1a4fc2f258215d14d5ee3fa43'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,4 @@
1
+ Dummy::Application.routes.draw do
2
+ mount IeStatusController::Engine => '/status'
3
+
4
+ end
data/dummy/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
File without changes
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ie_status_controller/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ie_status_controller"
7
+ s.version = IeStatusController::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Brad Werth"]
10
+ s.email = ["bwerth@iexposure.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Implements the standard status controller used by all IE projects}
13
+ s.description = %q{Implements the standard status controller used by all IE projects. It attempts to connect to the active record database and run a query, returns an error status if it cannot connect.}
14
+
15
+ s.rubyforge_project = "ie_status_controller"
16
+
17
+ if s.respond_to?(:metadata)
18
+ s.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+ else
20
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
21
+ end
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+
28
+ s.add_dependency 'rails' , '>= 4.1.0'
29
+
30
+ end
@@ -0,0 +1,19 @@
1
+ module IeStatusController
2
+ class Engine < ::Rails::Engine
3
+
4
+
5
+ isolate_namespace IeStatusController
6
+
7
+
8
+ # Run engine migrations from db:migrate in application
9
+ initializer :append_migrations do |app|
10
+ unless app.root.to_s.match root.to_s
11
+ config.paths['db/migrate'].expanded.each do |expanded_path|
12
+ app.config.paths['db/migrate'] << expanded_path
13
+ end
14
+ end
15
+ end
16
+
17
+
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module IeStatusController
2
+ VERSION = '2.3.0'
3
+ end
@@ -0,0 +1,3 @@
1
+ module IeStatusController
2
+ require 'ie_status_controller/engine' if defined?(Rails)
3
+ end
@@ -0,0 +1,77 @@
1
+ module Satorix
2
+ module CI
3
+ module Deploy
4
+ module Rubygems
5
+
6
+ require 'fileutils'
7
+
8
+ include Satorix::Shared::Console
9
+
10
+ extend self
11
+
12
+
13
+ def go
14
+ log_bench('Generating rubygems.org configuration_file...') { generate_rubygems_configuration_file }
15
+ log_bench('Preparing gem build directory...') { prepare_gem_build_directory }
16
+ log_bench('Building gem...') { build_gem }
17
+ built_gems.each { |gem| log_bench("Publishing #{ File.basename gem }...") { publish_gem gem } }
18
+ end
19
+
20
+
21
+ private
22
+
23
+
24
+ def build_gem
25
+ Dir.chdir(Satorix.app_dir) do
26
+ run_command(%w[bundle exec rake build])
27
+ end
28
+ end
29
+
30
+
31
+ def built_gems
32
+ Dir.glob(File.join(gem_build_directory, '*.gem')).select { |e| File.file? e }
33
+ end
34
+
35
+
36
+ def gem_build_directory
37
+ File.join(Satorix.app_dir, 'pkg')
38
+ end
39
+
40
+
41
+ def generate_rubygems_configuration_file
42
+ path = File.join(Dir.home, '.gem')
43
+ FileUtils.mkdir_p(path) unless File.exist?(path)
44
+
45
+ file = File.join(path, 'credentials')
46
+ File.open(file, 'w') { |f| f.write rubygems_configuration_file_contents }
47
+ FileUtils.chmod 0600, file
48
+ end
49
+
50
+
51
+ def prepare_gem_build_directory
52
+ run_command(['rm', '-rf', gem_build_directory])
53
+ FileUtils.mkdir_p gem_build_directory
54
+ end
55
+
56
+
57
+ def publish_gem(gem)
58
+ run_command(['gem', 'push', gem, '--config-file', File.join(Dir.home, '.gem', 'credentials')])
59
+ rescue RuntimeError
60
+ # To prevent the display of an ugly stacktrace.
61
+ abort "\nGem was not published!"
62
+ end
63
+
64
+
65
+ def rubygems_api_key
66
+ ENV['SATORIX_CI_RUBYGEMS_API_KEY']
67
+ end
68
+
69
+
70
+ def rubygems_configuration_file_contents
71
+ "---\n:rubygems_api_key: #{ rubygems_api_key }"
72
+ end
73
+
74
+ end
75
+ end
76
+ end
77
+ end
data/satorix/custom.rb ADDED
@@ -0,0 +1,21 @@
1
+ module Satorix
2
+ module Custom
3
+
4
+
5
+ require_relative 'CI/deploy/rubygems.rb'
6
+
7
+
8
+ extend self
9
+
10
+
11
+ def available_jobs
12
+ {
13
+ deploy: {
14
+ deploy_to_rubygems: Satorix::CI::Deploy::Rubygems
15
+ }
16
+ }
17
+ end
18
+
19
+
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe "status alive page" do
4
+ it "displays iedb$ok when the database is available" do
5
+ visit "/status/alive"
6
+ page.should have_content( 'iedb$ok' )
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ ENV['RAILS_ENV'] = "test"
2
+ # Set our rails root to the dummy installation
3
+ ENV["RAILS_ROOT"] = File.dirname(__FILE__) + "/../dummy"
4
+
5
+ # Load the rails application
6
+ require File.expand_path("#{ ENV['RAILS_ROOT'] }/config/application.rb", __FILE__)
7
+
8
+ require 'rspec/rails'
9
+ require 'capybara/rspec'
10
+ require 'capybara/dsl'
11
+ # Initialize the rails application
12
+ Dummy::Application.initialize!
13
+
14
+ # Run migrations
15
+ # ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose.tap do
16
+ # ActiveRecord::Migration.verbose = false
17
+ # load ENV['RAILS_ROOT']+"/db/schema.rb"
18
+ # end
19
+
20
+ # Requires supporting ruby files with custom matchers and macros, etc,
21
+ # in spec/support/ and its subdirectories.
22
+ Dir[File.join("../", "spec/support/**/*.rb")].each {|f| require f }
23
+
24
+ # Do config
25
+ RSpec.configure do |config|
26
+ # config.use_transactional_fixtures = true
27
+ config.include( Capybara , type: :integration)
28
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ie_status_controller
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Brad Werth
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-12 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: 4.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.0
27
+ description: Implements the standard status controller used by all IE projects. It
28
+ attempts to connect to the active record database and run a query, returns an error
29
+ status if it cannot connect.
30
+ email:
31
+ - bwerth@iexposure.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".gitignore"
37
+ - ".gitlab-ci.yml"
38
+ - ".rspec"
39
+ - ".ruby-version"
40
+ - Gemfile
41
+ - Gemfile.lock
42
+ - README.rdoc
43
+ - Rakefile
44
+ - app/controllers/ie_status_controller/status_controller.rb
45
+ - app/models/ie_status_controller/uptime_verification.rb
46
+ - config/routes.rb
47
+ - db/migrate/20160303054342_create_ie_status_controller_uptime_verifications.rb
48
+ - dummy/app/assets/javascripts/application.js
49
+ - dummy/app/assets/stylesheets/application.css
50
+ - dummy/app/controllers/application_controller.rb
51
+ - dummy/app/helpers/application_helper.rb
52
+ - dummy/app/mailers/.gitkeep
53
+ - dummy/app/models/.gitkeep
54
+ - dummy/app/views/layouts/application.html.erb
55
+ - dummy/config.ru
56
+ - dummy/config/application.rb
57
+ - dummy/config/boot.rb
58
+ - dummy/config/database.yml
59
+ - dummy/config/environment.rb
60
+ - dummy/config/environments/development.rb
61
+ - dummy/config/environments/production.rb
62
+ - dummy/config/environments/test.rb
63
+ - dummy/config/initializers/backtrace_silencers.rb
64
+ - dummy/config/initializers/inflections.rb
65
+ - dummy/config/initializers/mime_types.rb
66
+ - dummy/config/initializers/secret_token.rb
67
+ - dummy/config/initializers/session_store.rb
68
+ - dummy/config/initializers/wrap_parameters.rb
69
+ - dummy/config/locales/en.yml
70
+ - dummy/config/routes.rb
71
+ - dummy/lib/assets/.gitkeep
72
+ - dummy/log/.gitkeep
73
+ - dummy/public/404.html
74
+ - dummy/public/422.html
75
+ - dummy/public/500.html
76
+ - dummy/public/favicon.ico
77
+ - dummy/script/rails
78
+ - ie_status_controller.gemspec
79
+ - lib/ie_status_controller.rb
80
+ - lib/ie_status_controller/engine.rb
81
+ - lib/ie_status_controller/version.rb
82
+ - satorix/CI/deploy/rubygems.rb
83
+ - satorix/custom.rb
84
+ - spec/requests/status_page_spec.rb
85
+ - spec/spec_helper.rb
86
+ homepage: ''
87
+ licenses: []
88
+ metadata:
89
+ allowed_push_host: https://rubygems.org
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.0.3
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Implements the standard status controller used by all IE projects
109
+ test_files: []