guard-ronn 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ require "#{File.dirname(__FILE__)}/formatter"
2
+
3
+ module Guard
4
+ class Ronn
5
+ module Runner
6
+ class << self
7
+ include Formatter
8
+
9
+ def run(paths, options={})
10
+ return false if paths.empty?
11
+ message = options[:message] || "Running: #{paths.join(' ')}"
12
+ UI.info(message, :reset => true)
13
+ success = system(ronn_command(paths, options))
14
+ notify(success)
15
+ end
16
+
17
+ private
18
+
19
+ def ronn_command(paths, options={})
20
+ cmd_parts = []
21
+ cmd_parts << "bundle exec" if bundler? && options[:bundler] != false
22
+ cmd_parts << "ronn"
23
+ cmd_parts << options[:cli] if options[:cli]
24
+ cmd_parts << paths.join(' ')
25
+
26
+ cmd_parts.join(' ')
27
+ end
28
+
29
+ def bundler?
30
+ @bundler ||= File.exist?("#{Dir.pwd}/Gemfile")
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end