guard-zeus-client 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .rvmrc
19
+ bin/
data/Gemfile CHANGED
@@ -2,3 +2,12 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in ..gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem 'rb-readline'
8
+
9
+ require 'rbconfig'
10
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
11
+ gem 'rb-fsevent', '>= 0.3.2', :require => false
12
+ end
13
+ end
data/Guardfile CHANGED
@@ -0,0 +1,7 @@
1
+
2
+ guard 'rspec' do
3
+ watch(%r{^spec/.+_spec\.rb$})
4
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
7
+
@@ -19,4 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'guard', '>= 1.1'
21
21
  gem.add_dependency 'zeus'
22
+
23
+ gem.add_development_dependency 'rspec', '>= 2.11'
24
+ gem.add_development_dependency 'guard-rspec'
22
25
  end
@@ -34,13 +34,25 @@ module Guard
34
34
  def run_via_shell(paths, options)
35
35
  success = system(zeus_command(paths, options))
36
36
 
37
- if @options[:notification] && !success && zeus_command_exited_with_a_failure?
38
- Notifier.notify("Failed", :title => "Zeus results", :image => :failed, :priority => 2)
39
- end
37
+ notify(success)
40
38
 
41
39
  success
42
40
  end
43
41
 
42
+ def notify(success)
43
+ return unless @options[:notification]
44
+
45
+ message = 'Failed'
46
+ type = :failed
47
+
48
+ if success
49
+ message = 'Succeeded'
50
+ type = :success
51
+ end
52
+
53
+ Notifier.notify(message, type: type, image: type, title: 'ZeusClient Spec Results', priority: 2)
54
+ end
55
+
44
56
  def zeus_arguments(paths, options)
45
57
  arg_parts = []
46
58
  arg_parts << options[:zeus_options]
@@ -63,10 +75,6 @@ module Guard
63
75
  @options[:zeus_subcommand] || 'test'
64
76
  end
65
77
 
66
- def zeus_command_exited_with_a_failure?
67
- $?.exitstatus != 0
68
- end
69
-
70
78
  def test_dirs
71
79
  if File.exists?(ROOT_PATH + "/spec/spec_helper.rb")
72
80
  ['spec']
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module ZeusClientVersion
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Guard::ZeusClient::Runner do
4
+ subject(:runner) { described_class.new }
5
+
6
+ describe 'notifications' do
7
+ context 'when the zeus command fails' do
8
+ before do
9
+ runner.stub(:system).and_return(false)
10
+ end
11
+
12
+ it 'sends a failure notification' do
13
+ ::Guard::Notifier.should_receive(:notify).with(
14
+ 'Failed', :title => 'ZeusClient Spec Results', :type => :failed, :image => :failed, :priority => 2
15
+ )
16
+
17
+ runner.run(['spec'])
18
+ end
19
+ end
20
+
21
+ context 'when the zeus command passes' do
22
+ before do
23
+ runner.stub(:system).and_return(true)
24
+ end
25
+
26
+ it 'sends a success notification' do
27
+ ::Guard::Notifier.should_receive(:notify).with(
28
+ 'Succeeded', :title => 'ZeusClient Spec Results', :type => :success, :image => :success, :priority => 2
29
+ )
30
+
31
+ runner.run(['spec'])
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.require(:default, :development)
4
+
5
+ require 'guard/zeus-client'
6
+
7
+ RSpec.configure do |config|
8
+ config.filter_run :focused => true
9
+ config.alias_example_to :fit, :focused => true
10
+ config.run_all_when_everything_filtered = true
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.color_enabled = true
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-zeus-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '2.11'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2.11'
62
+ - !ruby/object:Gem::Dependency
63
+ name: guard-rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
46
78
  description: Guard::ZeusClient automatically runs a zeus command (test by default)
47
79
  when your files change. Does not run zeus server.
48
80
  email:
@@ -62,6 +94,8 @@ files:
62
94
  - lib/guard/zeus-client/runner.rb
63
95
  - lib/guard/zeus-client/templates/Guardfile
64
96
  - lib/guard/zeus-client/version.rb
97
+ - spec/guard/zeus-client/runner_spec.rb
98
+ - spec/spec_helper.rb
65
99
  homepage: https://github.com/aceofsales/guard-zeus-client
66
100
  licenses: []
67
101
  post_install_message:
@@ -86,5 +120,6 @@ rubygems_version: 1.8.24
86
120
  signing_key:
87
121
  specification_version: 3
88
122
  summary: Guard gem for Zeus
89
- test_files: []
90
- has_rdoc:
123
+ test_files:
124
+ - spec/guard/zeus-client/runner_spec.rb
125
+ - spec/spec_helper.rb