class Guard::Standardrb

Public Class Methods

new(opts = {}) click to toggle source
Calls superclass method
# File lib/guard/standardrb.rb, line 6
def initialize(opts = {})
  super

  @options = {
    fix: false,
    all_on_start: false,
    progress: false
  }.merge(opts)
end

Public Instance Methods

inspect_with_standardrb(paths = []) click to toggle source
# File lib/guard/standardrb.rb, line 40
def inspect_with_standardrb(paths = [])
  args = ["bundle", "exec", "standardrb"]
  args << "--fix" if @options[:fix]
  args << ["--format", "progress"] if @options[:progress]

  args.flatten!
  args += paths

  system(*args)
end
run_all() click to toggle source
# File lib/guard/standardrb.rb, line 24
def run_all
  inspect_with_standardrb
end
run_on_additions(paths) click to toggle source
# File lib/guard/standardrb.rb, line 28
def run_on_additions(paths)
  Guard::UI.info "StandardRb a file was added"
  inspect_with_standardrb(paths)
end
run_on_modifications(paths) click to toggle source
# File lib/guard/standardrb.rb, line 33
def run_on_modifications(paths)
  Guard::UI.info "StandardRb a file was modified"
  inspect_with_standardrb(paths)

  $stdout.puts paths if paths
end
start() click to toggle source
# File lib/guard/standardrb.rb, line 16
def start
  Guard::UI.info "Inspecting Ruby code style with standardrb"
  Guard::UI.info "fix = #{@options[:fix]}," +
  " all_on_start = #{@options[:all_on_start]}," +
  " progress = #{@options[:progress]}"
  run_all if @options[:all_on_start]
end