Module: RoSupport::RoGuard
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ro_support/ro_guard.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #handle(file, &blk) ⇒ Object
- #notify(msg) ⇒ Object
- #paths ⇒ Object
- #run_on_modifications(paths) ⇒ Object
- #start ⇒ Object
Instance Method Details
#handle(file, &blk) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/ro_support/ro_guard.rb', line 38 def handle(file, &blk) #puts "Handling #{paths.flatten}" r = paths.flatten.grep /#{file}$/ unless r.empty? blk.call end end |
#notify(msg) ⇒ Object
33 34 35 36 |
# File 'lib/ro_support/ro_guard.rb', line 33 def notify(msg) puts msg Notifier.notify msg end |
#paths ⇒ Object
27 28 29 30 31 |
# File 'lib/ro_support/ro_guard.rb', line 27 def paths @paths.flatten! if @paths.respond_to?(:flatten!) @paths.uniq! if @paths.respond_to?(:uniq!) @paths ||= [] end |
#run_on_modifications(paths) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/ro_support/ro_guard.rb', line 18 def run_on_modifications(paths) @paths = paths handle('Guardfile') do bash "bundle exec guard" end bash "rake install" end |
#start ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ro_support/ro_guard.rb', line 7 def start commands = Pry::CommandSet.new do block_command "install" do |*args| system "rake install" output.out "nimabi" end end Pry::Commands.import commands end |