Sha256: 856bc05d5241760eff1d89c34a799e0dac432f2c99ced9683e5f618e1a4ce52b

Contents?: true

Size: 1.03 KB

Versions: 23

Compression:

Stored size: 1.03 KB

Contents

require 'roo_on_rails/checks/base'
require 'fileutils'

module RooOnRails
  module Checks
    module Documentation
      class Playbook < Base
        LOCATION = 'PLAYBOOK.md'.freeze

        def intro
          'Looking for an on-call Playbook...'
        end

        def call
          fail! "no playbook at #{LOCATION}." if playbook_missing?
          final_fail! 'playbook still contains FIXME template sections' if playbook_unfinished?
          pass 'playbook found, legion on-call engineers thank you.'
        end

        def fix
          FileUtils.cp(
            File.join(__dir__, 'playbook_template.md'),
            LOCATION
          )
        end

        private

        def playbook_unfinished?
          # The regexp is so that you can still refer to strings saying FIXME in your readme
          # if you need to, by putting the phrase in backticks: `FIXME`
          !File.read(LOCATION).match(/FIXME(?!`)/).nil?
        end

        def playbook_missing?
          !File.exist?(LOCATION)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
roo_on_rails-2.2.2 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-2.2.1 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-2.2.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-2.1.2 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-2.1.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-2.0.0.pre.pre.2 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-2.0.0.pre.pre.1 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.22.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.21.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.20.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.19.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.18.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.17.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.16.2 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.16.1 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.16.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.15.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.14.0 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.13.1 lib/roo_on_rails/checks/documentation/playbook.rb
roo_on_rails-1.13.0 lib/roo_on_rails/checks/documentation/playbook.rb