Class: RooOnRails::Checks::Base
- Inherits:
-
Object
- Object
- RooOnRails::Checks::Base
- Includes:
- Helpers
- Defined in:
- lib/roo_on_rails/checks/base.rb
Direct Known Subclasses
Documentation::Playbook, EnvSpecific, EnvironmentIndependent, Git::Origin, GitHub::BranchProtection, GitHub::Token, Heroku::Login, Heroku::Token, Heroku::ToolbeltInstalled, Heroku::ToolbeltWorking, Papertrail::LogDestinationExists, Papertrail::Token, Sidekiq::Settings, Sidekiq::Sidekiq
Class Method Summary collapse
-
.requires(*dependencies) ⇒ Object
Add ‘dependencies` to the list of prerequisites for this check.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
18 19 20 21 22 23 24 |
# File 'lib/roo_on_rails/checks/base.rb', line 18 def initialize( = {}) @options = .dup @fix = @options.delete(:fix) { false } @context = @options.delete(:context) { Hashie::Mash.new } @shell = @options.delete(:shell) { Shell.new } @dry_run = .fetch(:dry_run, false) end |
Class Method Details
.requires(*dependencies) ⇒ Object
Add ‘dependencies` to the list of prerequisites for this check. If none are specified, return the list of dependencies.
13 14 15 16 |
# File 'lib/roo_on_rails/checks/base.rb', line 13 def self.requires(*dependencies) @requires ||= Set.new dependencies.any? ? @requires.merge(dependencies) : @requires end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/roo_on_rails/checks/base.rb', line 26 def run dependency_status = resolve dependencies say intro unless dependency_status final_fail! 'Unmet dependencies.' return end return true if @dry_run begin call rescue Failure return false unless @fix say "\t· attempting to fix", %i[yellow] fix @fix = false say "\t· re-checking", %i[yellow] retry end true rescue FinalFailure false end |