guard-yeti 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +25 -0
- data/Guardfile +6 -0
- data/README.md +37 -0
- data/Rakefile +14 -0
- data/guard-yeti.gemspec +24 -0
- data/lib/guard/yeti/notifier.rb +31 -0
- data/lib/guard/yeti.rb +33 -0
- data/spec/guard_yeti_spec.rb +22 -0
- data/spec/spec_helper.rb +12 -0
- metadata +106 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.DS_Store
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@guard-yeti --create
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
guard-yeti (0.0.1)
|
5
|
+
guard
|
6
|
+
rake
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
guard (0.7.0)
|
12
|
+
thor (~> 0.14.6)
|
13
|
+
guard-minitest (0.4.0)
|
14
|
+
guard (~> 0.4)
|
15
|
+
minitest (2.6.0)
|
16
|
+
rake (0.9.2)
|
17
|
+
thor (0.14.6)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
ruby
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
guard-minitest
|
24
|
+
guard-yeti!
|
25
|
+
minitest
|
data/Guardfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Guard::Yeti
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
Please be sure to have [Guard](https://github.com/guard/guard) and [Yeti](http://yuilibrary.com/projects/yeti/) installed before continue.
|
6
|
+
|
7
|
+
Install the gem:
|
8
|
+
|
9
|
+
$ gem install guard-yeti
|
10
|
+
|
11
|
+
Add it to your Gemfile (inside test group):
|
12
|
+
|
13
|
+
gem 'guard-yeti'
|
14
|
+
|
15
|
+
Add guard definition to your Guardfile with:
|
16
|
+
|
17
|
+
$ guard init yeti
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Please read the [Guard usage documentation](https://github.com/guard/guard#readme).
|
22
|
+
|
23
|
+
## Guardfile
|
24
|
+
|
25
|
+
Please read [Guard doc](https://github.com/guard/guard#readme) for more info about the Guardfile DSL.
|
26
|
+
|
27
|
+
### Rails app
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
guard 'yeti' do
|
31
|
+
watch(%r{^public/javascripts/.*\.js}) { |m| "public/javascripts/test/#{m[1]}_test.html" }
|
32
|
+
watch(%r{^public/javascripts/test/.*\.html})
|
33
|
+
end
|
34
|
+
```
|
35
|
+
## Author
|
36
|
+
|
37
|
+
[Simon Højberg](http://twitter.com/shojberg)
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'bundler/gem_tasks'
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
|
9
|
+
Rake::TestTask.new do |t|
|
10
|
+
t.pattern = "spec/*_spec.rb"
|
11
|
+
t.libs << "spec"
|
12
|
+
end
|
13
|
+
|
14
|
+
task :default => [:test]
|
data/guard-yeti.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "guard-yeti"
|
5
|
+
s.version = "0.0.1"
|
6
|
+
s.authors = ["Simon Højberg", "Christopher Meiklejohn"]
|
7
|
+
s.email = ["r.hackr@gmail.com", "christopher.meiklejohn@gmail.com"]
|
8
|
+
s.homepage = "https://github.com/hojberg/guard-yeti"
|
9
|
+
s.summary = %q{Guard::Yeti automatically run's your YUI tests via Yeti}
|
10
|
+
s.description = %q{Guard watches files. Use guard-yeti to run your YUI unit test via Yeti, when your implementation files change}
|
11
|
+
|
12
|
+
s.rubyforge_project = "guard-yeti"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_dependency "guard"
|
20
|
+
s.add_dependency "rake"
|
21
|
+
|
22
|
+
s.add_development_dependency "minitest"
|
23
|
+
s.add_development_dependency "guard-minitest"
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'guard/notifier'
|
2
|
+
|
3
|
+
module Guard
|
4
|
+
class Yeti
|
5
|
+
class Notifier
|
6
|
+
|
7
|
+
def self.guard_message(test_count, assertion_count, failure_count, error_count, skip_count, duration)
|
8
|
+
message = "#{test_count} examples, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors"
|
9
|
+
if skip_count > 0
|
10
|
+
message << " (#{skip_count} skips)"
|
11
|
+
end
|
12
|
+
message << "\nin %.6f seconds, %.4f tests/s, %.4f assertions/s." % [duration, test_count / duration, assertion_count / duration]
|
13
|
+
message
|
14
|
+
end
|
15
|
+
|
16
|
+
# failed | pending (skip) | success
|
17
|
+
def self.guard_image(failure_count, skip_count)
|
18
|
+
icon = if failure_count > 0
|
19
|
+
:failed
|
20
|
+
elsif skip_count > 0
|
21
|
+
:pending
|
22
|
+
else
|
23
|
+
:success
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.notify(result, message)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/guard/yeti.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/guard'
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
class Yeti < Guard
|
6
|
+
|
7
|
+
autoload :Notifier, 'guard/yeti/notifier'
|
8
|
+
|
9
|
+
def initialize(watches = [], options = {})
|
10
|
+
super
|
11
|
+
UI.info "init"
|
12
|
+
@latest_output = "sucks"
|
13
|
+
end
|
14
|
+
|
15
|
+
def start
|
16
|
+
UI.info "Guard::Yeti is running!"
|
17
|
+
end
|
18
|
+
|
19
|
+
def run_on_change(paths)
|
20
|
+
return false if paths.empty?
|
21
|
+
|
22
|
+
UI.info("yeti #{paths[0]} --solo=1", :reset => true)
|
23
|
+
|
24
|
+
output = %x[yeti #{paths[0]} --solo=1]
|
25
|
+
result = $?.success?
|
26
|
+
|
27
|
+
Notifier.notify(result, result ? "Passed" : "Failed")
|
28
|
+
|
29
|
+
[result, output]
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe "guard-yeti" do
|
6
|
+
|
7
|
+
before do
|
8
|
+
# mock of the kernel system call
|
9
|
+
module Kernel
|
10
|
+
def `(cmd)
|
11
|
+
cmd
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "runs yeti on update" do
|
17
|
+
yeti = Guard::Yeti.new
|
18
|
+
yeti.run_on_change(["yui_test_file.html"]).
|
19
|
+
must_equal [true, "yeti yui_test_file.html --solo=1"]
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-yeti
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Simon Højberg
|
9
|
+
- Christopher Meiklejohn
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-10-06 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: guard
|
17
|
+
requirement: &2156145380 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2156145380
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: &2156144940 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2156144940
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: minitest
|
39
|
+
requirement: &2156144520 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2156144520
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: guard-minitest
|
50
|
+
requirement: &2156144100 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2156144100
|
59
|
+
description: Guard watches files. Use guard-yeti to run your YUI unit test via Yeti,
|
60
|
+
when your implementation files change
|
61
|
+
email:
|
62
|
+
- r.hackr@gmail.com
|
63
|
+
- christopher.meiklejohn@gmail.com
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- .gitignore
|
69
|
+
- .rvmrc
|
70
|
+
- Gemfile
|
71
|
+
- Gemfile.lock
|
72
|
+
- Guardfile
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- guard-yeti.gemspec
|
76
|
+
- lib/guard/yeti.rb
|
77
|
+
- lib/guard/yeti/notifier.rb
|
78
|
+
- spec/guard_yeti_spec.rb
|
79
|
+
- spec/spec_helper.rb
|
80
|
+
homepage: https://github.com/hojberg/guard-yeti
|
81
|
+
licenses: []
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project: guard-yeti
|
100
|
+
rubygems_version: 1.8.11
|
101
|
+
signing_key:
|
102
|
+
specification_version: 3
|
103
|
+
summary: Guard::Yeti automatically run's your YUI tests via Yeti
|
104
|
+
test_files:
|
105
|
+
- spec/guard_yeti_spec.rb
|
106
|
+
- spec/spec_helper.rb
|