guard-zeus 0.0.1.pre.alpha.pre.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/LICENSE +19 -0
- data/README.md +81 -0
- data/lib/guard/zeus.rb +40 -0
- data/lib/guard/zeus/runner.rb +107 -0
- data/lib/guard/zeus/templates/Guardfile +16 -0
- data/lib/guard/zeus/version.rb +5 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmFhYmIzMjIyNDk2MDRlZmUyNmYwYjhkMTk2NTIwMmJhMmYxYTRjMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODcxNjg5NTk0Nzg3NWNhYTVmYjgxM2QxZjRlZDM3MWQ0M2MxNzRhZA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGRlYjZlNzcxMjZjZGE1YWNhMDg1ZmJjZGI1ZTRjYmY0NDQzZTM0NTFlNWJi
|
10
|
+
ZmJmNzUxNTY1ZmRlYmU1YmI5NDIwMzhjZjg3Y2Y1NzE4N2Y0ZGViYTI1ZDYy
|
11
|
+
YzhlOWQzZTgzYWIyYzgzYzkzNTQ0ZGYyOWNkYWZiYjllZjI0ZWM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NmRjOTkwYTcxMmM2NjI4N2IxNDgwYmRhOWFkOWEzODJhODAwYjMzZjlhMTli
|
14
|
+
MTA2NjZiNDRiYjNkOTNlMmQ2NDcyOTBjYWNiNWVhN2NkNjUyNTRiM2ZiNDZi
|
15
|
+
OWM1YTQ2MTE4NGRmYWNjOGQxMDhlN2I2OTBmMjIxYjJhNWU4NTQ=
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2011 by Andrew Assarattanakul
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
Guard::Zeus
|
2
|
+
===========
|
3
|
+
|
4
|
+
Guard::Zeus automatically starts and stops [Zeus](https://github.com/burke/zeus).
|
5
|
+
|
6
|
+
[](https://travis-ci.org/qnm/guard-zeus)
|
7
|
+
[](https://codeclimate.com/github/qnm/guard-zeus)
|
8
|
+
|
9
|
+
Install
|
10
|
+
-------
|
11
|
+
|
12
|
+
Please be sure to have [Guard](https://github.com/guard/guard) and [Zeus](https://github.com/burke/zeus) installed before continuing.
|
13
|
+
|
14
|
+
Install the gem:
|
15
|
+
|
16
|
+
$ gem install guard-zeus
|
17
|
+
|
18
|
+
Add it to your Gemfile (inside development group):
|
19
|
+
|
20
|
+
``` ruby
|
21
|
+
gem 'guard-zeus'
|
22
|
+
```
|
23
|
+
|
24
|
+
Add guard definition to your Guardfile by running this command:
|
25
|
+
|
26
|
+
$ guard init zeus
|
27
|
+
|
28
|
+
Usage
|
29
|
+
-----
|
30
|
+
|
31
|
+
Please read [Guard usage doc](https://github.com/guard/guard#readme)
|
32
|
+
|
33
|
+
Guardfile
|
34
|
+
---------
|
35
|
+
|
36
|
+
Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
|
37
|
+
|
38
|
+
### Options
|
39
|
+
|
40
|
+
Available options:
|
41
|
+
|
42
|
+
``` ruby
|
43
|
+
:rspec => false # Don't use RSpec
|
44
|
+
:test_unit => false # Don't use Test::Unit
|
45
|
+
:bundler => false # Don't use "bundle exec"
|
46
|
+
:cli => '--time' # Pass options to zeus. `zeus commands` for more zeus options
|
47
|
+
:run_all => true # Run all tests when hitting enter in guard
|
48
|
+
```
|
49
|
+
|
50
|
+
Development
|
51
|
+
-----------
|
52
|
+
|
53
|
+
* Source hosted at [GitHub](https://github.com/qnm/guard-zeus)
|
54
|
+
* Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/qnm/guard-zeus/issues)
|
55
|
+
|
56
|
+
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
57
|
+
you make.
|
58
|
+
|
59
|
+
Authors
|
60
|
+
------
|
61
|
+
|
62
|
+
Based on the awesome [guard-spin](https://github.com/vizjerai/guard-spin). Original authors include:
|
63
|
+
|
64
|
+
* [Jonathan](https://github.com/jonsgreen)
|
65
|
+
* [Andrew Assarattanakul](https://github.com/vizjerai)
|
66
|
+
|
67
|
+
Ported to use zeus by:
|
68
|
+
|
69
|
+
* [Rob Sharp](https://github.com/qnm)
|
70
|
+
|
71
|
+
Many Thanks To
|
72
|
+
--------------
|
73
|
+
|
74
|
+
* [Jesse Storimer](https://github.com/jstorimer)
|
75
|
+
|
76
|
+
Alternatives
|
77
|
+
------------
|
78
|
+
|
79
|
+
* [guard/rspec](https://github.com/guard/guard-rspec) has recently picked up Zeus support. You may wish to see if this fits your needs.
|
80
|
+
* [aceofsales/guard-zeus-client](https://github.com/aceofsales/guard-zeus-client) is very similar to this version.
|
81
|
+
|
data/lib/guard/zeus.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/guard'
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
class Zeus < Guard
|
6
|
+
|
7
|
+
autoload :Runner, 'guard/zeus/runner'
|
8
|
+
attr_accessor :runner
|
9
|
+
|
10
|
+
def initialize(watchers=[], options={})
|
11
|
+
super
|
12
|
+
@runner = Runner.new(options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def start
|
16
|
+
runner.kill_zeus
|
17
|
+
runner.launch_zeus("Start")
|
18
|
+
end
|
19
|
+
|
20
|
+
def reload
|
21
|
+
runner.kill_zeus
|
22
|
+
runner.launch_zeus("Reload")
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_all
|
26
|
+
runner.run_all
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_on_changes(paths)
|
30
|
+
runner.run(paths)
|
31
|
+
end
|
32
|
+
# for guard 1.0.x and earlier
|
33
|
+
alias :run_on_change :run_on_changes
|
34
|
+
|
35
|
+
def stop
|
36
|
+
runner.kill_zeus
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Needed for socket_file
|
2
|
+
require 'socket'
|
3
|
+
require 'tempfile'
|
4
|
+
require 'digest/md5'
|
5
|
+
|
6
|
+
module Guard
|
7
|
+
class Zeus
|
8
|
+
class Runner
|
9
|
+
attr_reader :options
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@options = {:run_all => true}.merge(options)
|
13
|
+
UI.info "Guard::Zeus Initialized"
|
14
|
+
end
|
15
|
+
|
16
|
+
def launch_zeus(action)
|
17
|
+
UI.info "#{action}ing Zeus", :reset => true
|
18
|
+
spawn_zeus zeus_serve_command, zeus_serve_options
|
19
|
+
end
|
20
|
+
|
21
|
+
def kill_zeus
|
22
|
+
stop_zeus
|
23
|
+
end
|
24
|
+
|
25
|
+
def run(paths)
|
26
|
+
run_command zeus_push_command(paths), zeus_push_options
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_all
|
30
|
+
return unless options[:run_all]
|
31
|
+
if rspec?
|
32
|
+
run(['rspec'])
|
33
|
+
elsif test_unit?
|
34
|
+
run(Dir['test/**/*_test.rb']+Dir['test/**/test_*.rb'])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def sockfile
|
41
|
+
File.join(Dir.pwd, ".zeus.sock")
|
42
|
+
end
|
43
|
+
|
44
|
+
def run_command(cmd, options = '')
|
45
|
+
system "#{cmd} #{options}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def spawn_zeus(cmd, options = '')
|
49
|
+
@zeus_pid = fork do
|
50
|
+
exec "#{cmd} #{options}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def stop_zeus
|
55
|
+
return unless @zeus_pid
|
56
|
+
|
57
|
+
Process.kill(:INT, @zeus_pid)
|
58
|
+
|
59
|
+
begin
|
60
|
+
unless Process.waitpid(@zeus_pid, Process::WNOHANG)
|
61
|
+
Process.kill(:KILL, @zeus_pid)
|
62
|
+
end
|
63
|
+
rescue Errno::ECHILD
|
64
|
+
end
|
65
|
+
File.delete(sockfile) if File.exist? sockfile
|
66
|
+
UI.info "Zeus Stopped", :reset => true
|
67
|
+
end
|
68
|
+
|
69
|
+
def zeus_push_command(paths)
|
70
|
+
cmd_parts = []
|
71
|
+
cmd_parts << "bundle exec" if bundler?
|
72
|
+
cmd_parts << "zeus test"
|
73
|
+
cmd_parts << paths.join(' ')
|
74
|
+
cmd_parts.join(' ')
|
75
|
+
end
|
76
|
+
|
77
|
+
def zeus_push_options
|
78
|
+
''
|
79
|
+
end
|
80
|
+
|
81
|
+
def zeus_serve_command
|
82
|
+
cmd_parts = []
|
83
|
+
cmd_parts << "bundle exec" if bundler?
|
84
|
+
cmd_parts << "zeus start"
|
85
|
+
cmd_parts.join(' ')
|
86
|
+
end
|
87
|
+
|
88
|
+
def zeus_serve_options
|
89
|
+
opt_parts = []
|
90
|
+
opt_parts << options[:cli] unless options[:cli].nil?
|
91
|
+
opt_parts.join(' ')
|
92
|
+
end
|
93
|
+
|
94
|
+
def bundler?
|
95
|
+
@bundler ||= options[:bundler] != false && File.exist?("#{Dir.pwd}/Gemfile")
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_unit?
|
99
|
+
@test_unit ||= options[:test_unit] != false && File.exist?("#{Dir.pwd}/test/test_helper.rb")
|
100
|
+
end
|
101
|
+
|
102
|
+
def rspec?
|
103
|
+
@rspec ||= options[:rspec] != false && File.exist?("#{Dir.pwd}/spec")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
guard 'zeus' do
|
2
|
+
# uses the .rspec file
|
3
|
+
# --colour --fail-fast --format documentation --tag ~slow
|
4
|
+
watch(%r{^spec/.+_spec\.rb$})
|
5
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
6
|
+
watch(%r{^app/(.+)\.haml$}) { |m| "spec/#{m[1]}.haml_spec.rb" }
|
7
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
8
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
|
9
|
+
|
10
|
+
# TestUnit
|
11
|
+
# watch(%r|^test/(.*)_test\.rb$|)
|
12
|
+
# watch(%r|^lib/(.*)([^/]+)\.rb$|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
13
|
+
# watch(%r|^test/test_helper\.rb$|) { "test" }
|
14
|
+
# watch(%r|^app/controllers/(.*)\.rb$|) { |m| "test/functional/#{m[1]}_test.rb" }
|
15
|
+
# watch(%r|^app/models/(.*)\.rb$|) { |m| "test/unit/#{m[1]}_test.rb" }
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-zeus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre.alpha.pre.21
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jonathangreenberg
|
8
|
+
- Andrew Assarattanakul
|
9
|
+
- Rob Sharp
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: guard
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ! '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: zeus
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: bundler
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rspec
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '2.0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '2.0'
|
71
|
+
description: Guard::Zeus automatically manage zeus
|
72
|
+
email:
|
73
|
+
- greenberg@entryway.net
|
74
|
+
- assarata@gmail.com
|
75
|
+
- qnm@fea.st
|
76
|
+
executables: []
|
77
|
+
extensions: []
|
78
|
+
extra_rdoc_files: []
|
79
|
+
files:
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- lib/guard/zeus.rb
|
83
|
+
- lib/guard/zeus/runner.rb
|
84
|
+
- lib/guard/zeus/templates/Guardfile
|
85
|
+
- lib/guard/zeus/version.rb
|
86
|
+
homepage: http://github.com/qnm/guard-zeus
|
87
|
+
licenses: []
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>'
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.3.1
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.2.1
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Pushes watched files to Zeus
|
109
|
+
test_files: []
|