class Commitment::Config

Attributes

brakeman_output_pathname[R]
code_coverage_last_run_pathname[R]
jshint_exclude_pattern[R]
jshint_options[R]
jshint_pattern[R]
percentage_coverage_goal[RW]
project_pathname[R]
rubocop_config[R]
scss_lint_config[R]

Public Class Methods

new() click to toggle source
# File lib/commitment.rb, line 20
def initialize
  @project_pathname = default_project_pathname
  @rubocop_config = project_pathname.join('.hound.yml').to_s
  @brakeman_output_pathname = project_pathname.join('.tmp.brakeman.json')
  @jshint_pattern = 'app/assets/**/*.js'
  @jshint_exclude_pattern = 'app/assets/javascripts/vendor/*.js'
  @jshint_options = JSON.parse(project_pathname.join('.jshintrc').read)
  @scss_lint_config = project_pathname.join('.scss_lint.yml').to_s
  @percentage_coverage_goal = 100
  @code_coverage_last_run_pathname = project_pathname.join('coverage/.last_run.json')
end

Public Instance Methods

code_coverage_last_run_results() click to toggle source
# File lib/commitment.rb, line 32
def code_coverage_last_run_results
  if code_coverage_last_run_pathname.exist?
    JSON.parse(code_coverage_last_run_pathname.read)
  else
    abort("Commitment Failure: Unable to find code coverage information in `#{code_coverage_last_run_pathname.to_s}'")
  end
end

Private Instance Methods

default_project_pathname() click to toggle source
# File lib/commitment.rb, line 44
def default_project_pathname
  if ENV.key?('PROJECT_PATHNAME')
    require 'pathname'
    Pathname.new(ENV['PROJECT_PATHNAME'])
  elsif defined?(Rails)
    Rails.root
  else
    require 'pathname'
    Pathname.new(File.expand_path('../commitment/generators/templates', __FILE__))
  end
end