guard-java 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzdmZTEwNzgxN2I1ZmNiZGZmMTQ1NzJhZmYyNjE0ZmJhOGZkNzI0NA==
4
+ MWI5ZGIxNDBkOThlN2RiMjk5MTZiZTMzZmUxNjg5YzZjMjM0ODFlMQ==
5
5
  data.tar.gz: !binary |-
6
- NDEwOWE5MzA4MTM5NjQ1YzVkYTdmMjM0ZTk5MTIxNWE3NTNiZWNlYw==
6
+ NTAxM2JmMjcyM2I5NTRiNzM1M2YwOWQ4NmI3MDIzYmVmMTM1ZWM2YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTRjMDgwOWVmZGE4N2QwMTE2MWY5NjgyNmFiMmI1NGQ1NzY3NzhkODJmZWVh
10
- ZWMxN2I4ZDdlZmVmNjFkYjdiZmZjNjhkZmM5ZjcwZjU4MTQ5NmM2YTExMTQw
11
- NGFlZjY4OGJlMmU2NDVkNGNlZTk2Y2QxNjQ1NjE2YWVmNWEzYTg=
9
+ ZTg5ODBiMWYxMzFjMzg5MTY1MWQ4NDYwMjZkMjliZDAzNzYwZDE3NTY2ZWVm
10
+ MmMxZTJmMDg4Y2U0NTMwN2E3YTcwMWIyYjZkYWE3OWNjYjMyNWNjMTFiM2Qx
11
+ ZDdmZWM4NjkwZGQwMDliNTc2NWY3Yjk5M2RiYzFmNDI3MmMxNzc=
12
12
  data.tar.gz: !binary |-
13
- NWI1YmQxYWE3ZmIyNDE4YWUxZWU3MjQ5OGRlNDE2NjdlMjNiYzQ5OWVhNzlk
14
- MGNmNGI1NTI2YzNlZGVmNmZiMjc5Mzg0ZjRmOWU0ZGQzYjZjMTMzNThlZDVk
15
- ZmFiZTk4Njg2M2I5ZjNhMzNiOTBhNjI0Yjk0Yjc4MjZjODRiMjA=
13
+ M2IwNWRkZWY4ZGU4MDgyNWZiZWRkMjBhMDc2MDllMWE5ZTY0NTFlY2U5MjA1
14
+ MjkwM2M4ZDVhMzI5OWE5ODAxYjE3N2M4NDI2NGUyM2M0NjNmNGQ3NDE3M2E2
15
+ MzhiOTg4OTNiZWZmZDVmMDA3Njc4ZmU1NzQ0MDVjMzlmODBjYmI=
data/README.md CHANGED
@@ -104,7 +104,7 @@ guard :java, :project_name => 'Search SDK',
104
104
  :all_after_pass => false,
105
105
  :focused_cli => 'ant guard-debug',
106
106
  :all_cli => 'ant clean debug',
107
- :classpath => "#{android_sdk_dir}:./bin/classes.jar:./libs/*:/usr/share/java/junit.jar" do
107
+ :classpath => "/bin/classes.jar:./libs/*:/usr/share/java/junit.jar:#{android_sdk_dir}/android-10/*" do
108
108
 
109
109
  ignore(%r{^src/com/infospace/some_project/BuildTimeUpdatedFile.java}) # Build-time code-gen
110
110
 
@@ -119,6 +119,10 @@ guard :java, :project_name => 'Search SDK',
119
119
  end
120
120
  ```
121
121
 
122
+ *note: The android jar path must go after the junit.jar path in the classpath, or you will get an exception about ```no method "main"```
123
+ and method Stub message. Android only stubs out the JUnitCore runner logic, and if the android jar is placed earlier in the path,
124
+ it won't be able to run any tests.*
125
+
122
126
  #### Latency
123
127
  In the case where many files are changing close together (e.g., saving a test file and saving the class under test), you can tell
124
128
  guard to wait a certain number of seconds when it detects a file change before triggering a test cycle using the
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module JavaVersion
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
data/lib/guard/java.rb CHANGED
@@ -5,13 +5,14 @@ module ::Guard
5
5
  def initialize(watchers=[], options={})
6
6
  super
7
7
  @options = {
8
- :all_after_pass => true,
9
- :all_on_start => true,
10
- :test_runner_class => 'org.junit.runner.JUnitCore',
11
- :project_name => 'Java Project',
12
- :focused_cli => nil,
13
- :all_cli => nil,
14
- :classpath => '.'
8
+ :all_after_pass => true,
9
+ :all_on_start => true,
10
+ :focused_after_compile => true,
11
+ :test_runner_class => 'org.junit.runner.JUnitCore',
12
+ :project_name => 'Java Project',
13
+ :focused_cli => nil,
14
+ :all_cli => nil,
15
+ :classpath => '.'
15
16
  }.merge(options)
16
17
  end
17
18
 
@@ -31,19 +32,13 @@ module ::Guard
31
32
  end
32
33
 
33
34
  def run_on_changes(classes)
34
- run_focused_tests(classes)
35
- end
36
-
37
- def stop
38
- end
39
-
40
- def run_focused_tests(classes)
41
35
  project_name = @options[:project_name]
42
36
  klass = classes[0]
43
37
 
44
- notify "Running tests in #{klass}", "#{project_name} file change detected", :pending # notify any interested listeners
45
- result = do_shell(focused_command)
46
- result = run_test_class(klass) unless result == :failed
38
+ result = compile(project_name, klass)
39
+
40
+ result = run_focused_tests(project_name, klass) if result != :failed && @options[:focused_after_compile]
41
+
47
42
  result_description = "#{project_name}: test run for #{klass}"
48
43
 
49
44
  notify result_description, "Build #{result.to_s.capitalize}", result # Notify of success or failure
@@ -54,6 +49,18 @@ module ::Guard
54
49
  nil
55
50
  end
56
51
 
52
+ def stop
53
+ end
54
+
55
+ def compile(project_name, klass)
56
+ notify "Compiling because of #{klass} change", "#{project_name} file change detected", :pending # notify any interested listeners
57
+ do_shell(focused_command)
58
+ end
59
+
60
+ def run_focused_tests(project_name, klass)
61
+ run_test_class(klass)
62
+ end
63
+
57
64
  def focused_command
58
65
  @options[:focused_cli]
59
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-java
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony C. Heupel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-19 00:00:00.000000000 Z
11
+ date: 2013-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard