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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ebb2b1919f9d5c85b7f661f791c7cca63cf4a90
4
- data.tar.gz: 3e0d30a7d932866301805d43ecfa33baa179ef45
3
+ metadata.gz: 4797d8d8ad91d52a0274da265985d6c7be5b512c
4
+ data.tar.gz: 434897f11b6a2d0a6684accb816b6b81df0f209b
5
5
  SHA512:
6
- metadata.gz: 30fed997bad9b56daf73b546321bb71badd2e35054fc0846063fa73f39a4ce25cfe69edf681d442f804759f946c50d1bce44b2d43feb27e37d402711ae4bd385
7
- data.tar.gz: 56663bfe33b86e3c1a33869872b83f8d67f99a4d4ea9be70b15b5a2be3fa9506a9575feefff38bd39e3d044fc0e264cffebfd6a9730a5dec3496e7c3d70c1128
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 if they are not in an active group!
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 stuff.
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 specs/tests/...
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
- run_maven_tests
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
- run_maven_tests :classes => paths
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 run_maven_tests(options={})
114
- cmds = ['mvn', 'test', '-DfailIfNoTests=false']
117
+ def run_maven(options={})
118
+ puts # start with a newline to get past prompt.
115
119
 
116
- if options[:classes]
117
- cmds << "-Dtest=#{options[:classes].join(',')}"
118
- options[:name] ||= options[:classes].join("\n")
119
- puts "Preparing tests for #{options[:classes].join(', ')}..."
120
+ cmds = ['mvn']
121
+
122
+ if options[:compile]
123
+ cmds << 'compile'
124
+ puts 'Compiling...'
120
125
  else
121
- puts "Preparing all tests..."
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
- # User popen so that we can capture the test
129
- # output as well as display it in terminal
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|
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module MavenVersion
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-maven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Baker