guard-play 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/guard-play.gemspec +2 -2
  3. data/lib/guard/play.rb +22 -12
  4. metadata +13 -13
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/guard-play.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "guard-play"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["crazycode"]
12
- s.date = "2012-03-01"
12
+ s.date = "2012-03-02"
13
13
  s.description = "guard helper for play! framework 1.x"
14
14
  s.email = "crazycode@gmail.com"
15
15
  s.extra_rdoc_files = [
data/lib/guard/play.rb CHANGED
@@ -10,12 +10,16 @@ module Guard
10
10
  def initialize(watchers = [], options = {})
11
11
  super
12
12
  @options = {
13
- :app_path => ''
13
+ :app_path => '',
14
+ :http_port => 29000, # NOT USE
15
+ :jpda_port => 28000 # NOT USE
14
16
  }.update(options)
15
17
 
16
18
  @last_failed = false
17
19
  @app_path = @options[:app_path]
18
20
  @notify_title = @app_path.empty? ? "Play!" : "Play! on #{@app_path}"
21
+ @cmd_auto_test_deps = "play auto-test #{@app_path} --deps"
22
+ @cmd_auto_test = "play auto-test #{@app_path}"
19
23
  end
20
24
 
21
25
  # Call once when Guard starts. Please override initialize method to init stuff.
@@ -41,49 +45,55 @@ module Guard
41
45
  # This method should be principally used for long action like running all specs/tests/...
42
46
  # @raise [:task_has_failed] when run_all has failed
43
47
  def run_all
44
- run_auto_test("--deps")
48
+ run_auto_test(@cmd_auto_test_deps)
45
49
  end
46
50
 
47
51
  # Called on file(s) modifications that the Guard watches.
48
52
  # @param [Array<String>] paths the changes files or paths
49
53
  # @raise [:task_has_failed] when run_on_change has failed
50
54
  def run_on_change(paths)
51
- run_auto_test()
55
+ run_auto_test(@cmd_auto_test)
52
56
  end
53
57
 
54
58
  # Called on file(s) deletions that the Guard watches.
55
59
  # @param [Array<String>] paths the deleted files or paths
56
60
  # @raise [:task_has_failed] when run_on_change has failed
57
61
  def run_on_deletion(paths)
58
- run_auto_test()
62
+ run_auto_test(@cmd_auto_test)
59
63
  end
60
64
 
61
65
  private
62
- def run_auto_test(opts = "")
66
+ def run_auto_test(cmd)
63
67
  UI.info "Guard::Play runing - play auto-test #{@app_path} #{opts}"
64
68
 
65
- result = []
66
- IO.popen("play auto-test #{@app_path} #{opts}") { |output|
69
+ failed_result = []
70
+ had_test_pass = false
71
+ IO.popen(cmd) { |output|
67
72
  output.each_line { |line|
68
- if line =~ /(FAILED|errors)/
69
- result << line
73
+ if line =~ /(FAILED|errors|ERROR)/
74
+ failed_result << line
70
75
  UI.error line
71
76
  else
72
77
  puts "#{line}"
78
+ if line =~ /PASSED/
79
+ had_test_pass = true
80
+ end
73
81
  end
74
82
  }
75
83
  }
76
84
 
77
- if result.empty?
85
+ if failed_result.empty?
78
86
  UI.info "Guard::Play ALL Tests Passed."
79
- if @last_failed
87
+ if had_test_pass
88
+ Notifier.notify("NO Test Founded! Maybe build failed!", :title => @notify_title, :image => :failed)
89
+ elsif @last_failed
80
90
  Notifier.notify("All Tests on #{@app_path} are Passed!", :title => @notify_title, :image => :success)
81
91
  end
82
92
  @last_failed = false
83
93
  else
84
94
  @last_failed = true
85
95
  UI.error "Guard::Play Tests Failed!"
86
- Notifier.notify(result.join("\n"), :title => "#{@notify_title} Test Failed!", :image => :failed)
96
+ Notifier.notify(failed_result.join("\n"), :title => "#{@notify_title} Test Failed!", :image => :failed)
87
97
  throw :task_has_failed
88
98
  end
89
99
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-play
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-01 00:00:00.000000000 Z
12
+ date: 2012-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
16
- requirement: &80395470 !ruby/object:Gem::Requirement
16
+ requirement: &22118380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *80395470
24
+ version_requirements: *22118380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &80395150 !ruby/object:Gem::Requirement
27
+ requirement: &22117780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *80395150
35
+ version_requirements: *22117780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &80394680 !ruby/object:Gem::Requirement
38
+ requirement: &22117160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *80394680
46
+ version_requirements: *22117160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &80394190 !ruby/object:Gem::Requirement
49
+ requirement: &22116420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.8.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *80394190
57
+ version_requirements: *22116420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard
60
- requirement: &80393790 !ruby/object:Gem::Requirement
60
+ requirement: &22115740 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *80393790
68
+ version_requirements: *22115740
69
69
  description: guard helper for play! framework 1.x
70
70
  email: crazycode@gmail.com
71
71
  executables: []
@@ -101,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  segments:
103
103
  - 0
104
- hash: -910905971
104
+ hash: 3178746158527964763
105
105
  required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements: