guard-maven 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/guard/maven.rb +27 -15
- data/lib/guard/maven/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4797d8d8ad91d52a0274da265985d6c7be5b512c
|
4
|
+
data.tar.gz: 434897f11b6a2d0a6684accb816b6b81df0f209b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 054f3b8f2e2deb80ea71d280a0aecf7952f2b139c0a7e27242fb74eb2ca14488b547a5255b909a1d3681e687d80bd67192df6f13a551c26824653767d8b0fadc
|
7
|
+
data.tar.gz: f12ff74a478bb63108a5dd8b8fa27cba759c907845a6a9a3e9d8feffee8c20532f7b01ab06181725c4e66213f927b3f86a06c3c4f31943f74f53fd81686aeaf4
|
data/lib/guard/maven.rb
CHANGED
@@ -5,7 +5,8 @@ module Guard
|
|
5
5
|
class Maven < Guard
|
6
6
|
|
7
7
|
# Initializes a Guard plugin.
|
8
|
-
# Don't do any work here, especially as Guard plugins get initialized even
|
8
|
+
# Don't do any work here, especially as Guard plugins get initialized even
|
9
|
+
# if they are not in an active group!
|
9
10
|
#
|
10
11
|
# @param [Array<Guard::Watcher>] watchers the Guard plugin file watchers
|
11
12
|
# @param [Hash] options the custom Guard plugin options
|
@@ -17,7 +18,8 @@ module Guard
|
|
17
18
|
@options = options
|
18
19
|
end
|
19
20
|
|
20
|
-
# Called once when Guard starts. Please override initialize method to init
|
21
|
+
# Called once when Guard starts. Please override initialize method to init
|
22
|
+
# stuff.
|
21
23
|
#
|
22
24
|
# @raise [:task_has_failed] when start has failed
|
23
25
|
# @return [Object] the task result
|
@@ -27,13 +29,14 @@ module Guard
|
|
27
29
|
end
|
28
30
|
|
29
31
|
# Called when just `enter` is pressed
|
30
|
-
# This method should be principally used for long action like running all
|
32
|
+
# This method should be principally used for long action like running all
|
33
|
+
# specs/tests/...
|
31
34
|
#
|
32
35
|
# @raise [:task_has_failed] when run_all has failed
|
33
36
|
# @return [Object] the task result
|
34
37
|
#
|
35
38
|
def run_all
|
36
|
-
|
39
|
+
run_maven
|
37
40
|
end
|
38
41
|
|
39
42
|
# Default behaviour on file(s) changes that the Guard plugin watches.
|
@@ -42,11 +45,12 @@ module Guard
|
|
42
45
|
# @return [Object] the task result
|
43
46
|
#
|
44
47
|
def run_on_changes(paths)
|
45
|
-
# for now run all
|
46
48
|
if paths.include? 'all'
|
47
49
|
run_all
|
50
|
+
elsif paths.include? 'compile'
|
51
|
+
run_maven :compile => true
|
48
52
|
else
|
49
|
-
|
53
|
+
run_maven :classes => paths
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
@@ -110,23 +114,31 @@ module Guard
|
|
110
114
|
data
|
111
115
|
end
|
112
116
|
|
113
|
-
def
|
114
|
-
|
117
|
+
def run_maven(options={})
|
118
|
+
puts # start with a newline to get past prompt.
|
115
119
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
+
cmds = ['mvn']
|
121
|
+
|
122
|
+
if options[:compile]
|
123
|
+
cmds << 'compile'
|
124
|
+
puts 'Compiling...'
|
120
125
|
else
|
121
|
-
|
126
|
+
cmds += ['test', '-DfailIfNoTests=false']
|
127
|
+
if options[:classes]
|
128
|
+
cmds << "-Dtest=#{options[:classes].join(',')}"
|
129
|
+
options[:name] ||= options[:classes].join("\n")
|
130
|
+
puts "Preparing tests for #{options[:classes].join(', ')}..."
|
131
|
+
else
|
132
|
+
puts "Preparing all tests..."
|
133
|
+
end
|
122
134
|
end
|
123
135
|
|
124
136
|
cmds << @options[:args] if @options[:args]
|
125
137
|
cmd = cmds.join ' '
|
126
138
|
puts cmd
|
127
139
|
|
128
|
-
#
|
129
|
-
#
|
140
|
+
# Use popen so that we can capture the test output as well as display it
|
141
|
+
# in terminal
|
130
142
|
output = []
|
131
143
|
str = []
|
132
144
|
IO.popen(cmd).each_char do |char|
|
data/lib/guard/maven/version.rb
CHANGED