Sha256: 21aa4eabfefab004c66da5bf1cb54506f62a5783423af3ae20b31968c4afded6
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
require 'guard' require 'guard/guard' module Guard # Defines the guard, which is automatically seen by Guard class Cane < Guard DEFAULTS = { run_all_on_start: true } SUCCESS = ["Passed", { title: "Passed", image: :success }] FAILED = ["Failed", { title: "Failed", image: :failed }] attr_reader :last_result, :options def initialize(watchers = [], options = {}) super @options = DEFAULTS.merge(options) end def start UI.info "Guard::Cane is running" run_all if options[:run_all_on_start] end def run_all cane end def run_on_changes(paths) cane paths end def cane(paths = []) command = build_command(paths) UI.info "Running Cane: #{command}" result = system command if result Notifier.notify(*SUCCESS) if last_result == false else Notifier.notify(*FAILED) end @last_result = result result end def build_command(paths) command = [] command << (options[:command] || "cane") if paths.any? joined_paths = paths.join(',') command << "--all '{#{joined_paths}}'" end command << options[:cli] command.compact.join(" ") end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
guard-cane-0.1.2 | lib/guard/cane.rb |
guard-cane-0.1.1 | lib/guard/cane.rb |
guard-cane-0.1.0 | lib/guard/cane.rb |
guard-cane-0.1.0.pre | lib/guard/cane.rb |