Class: Guard::Gradle
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Gradle
- Defined in:
- lib/guard/gradle.rb
Constant Summary collapse
- DEF_CMD =
'./gradlew test'
Instance Method Summary collapse
- #fire_command(command) ⇒ Object
- #notify(summary, image) ⇒ Object
- #run_all ⇒ Object
- #run_on_changes(paths) ⇒ Object
- #start ⇒ Object
Instance Method Details
#fire_command(command) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/guard/gradle.rb', line 22 def fire_command(command) result = system command summary = result ? 'Success' : 'Failure' image = result ? :success : :failed notify(summary, image) end |
#notify(summary, image) ⇒ Object
29 30 31 |
# File 'lib/guard/gradle.rb', line 29 def notify(summary, image) ::Guard::Notifier.notify(summary, title: 'Gradle Test Results', image: image) end |
#run_all ⇒ Object
18 19 20 |
# File 'lib/guard/gradle.rb', line 18 def run_all fire_command DEF_CMD end |
#run_on_changes(paths) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/guard/gradle.rb', line 10 def run_on_changes(paths) if(paths.size == 1) && (Dir.glob("src/test/**/#{paths[0]}*").size > 0) fire_command("#{DEF_CMD} -Dtest.single=#{paths[0]} --daemon") else run_all end end |
#start ⇒ Object
33 34 35 |
# File 'lib/guard/gradle.rb', line 33 def start fire_command DEF_CMD end |