guard-zeus 2.0.0 → 2.0.1.pre.alpha.pre.81
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +4 -4
- data/lib/guard/zeus/runner.rb +63 -30
- data/lib/guard/zeus/templates/Guardfile +34 -8
- data/lib/guard/zeus/version.rb +1 -1
- data/lib/guard/zeus.rb +4 -7
- metadata +21 -31
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Mjg5ODQ2ZGFmZTY2NWViNTJkZmVhNTIzZTdiMWNlMTNiMTA5NjAwMg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODg3ODUwY2Q3YjM2MWRjMjhmNzBhZTRhYjc4OGFjN2M5NDUwZjRlMQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2Y1ZDNmNDY3OTdlNjExMTYxOWY0NTRiZGMwMzk2YzQ0MDdmNzY3YTE4Y2Y2
|
10
|
+
MWNiYjYxYTY0ZWJkODFkZmE3MWZiYzFkZjIzNDkwOTlmZTU0MDMxMjM3N2Nk
|
11
|
+
YjI0ZTAyYWViNDkxNGIyNzZlOGRmN2FjMmI5ZGY0NzQzYzQ0NDM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDBmNTQwZTMxNjgyZDYzMjJhYWE3NGMxNjA3ZjA1NDc5ZmU5NDc1ODY4YjI2
|
14
|
+
NjkwOTM3ZjIwMDdiZGI1NGEwMDFmMjYwNTdlNjA3NDk3MmU0ZThlMWIyNWE3
|
15
|
+
NGQ3OGYwZDdiNGU0ZWNkNTA3MzhmZmIzMGNmNGViMzcyNWJhODU=
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@ Guard::Zeus
|
|
3
3
|
|
4
4
|
Guard::Zeus automatically starts and stops [Zeus](https://github.com/burke/zeus).
|
5
5
|
|
6
|
-
[![Build Status](https://travis-ci.org/
|
7
|
-
[![Code Climate](https://codeclimate.com/github/
|
6
|
+
[![Build Status](https://travis-ci.org/guard/guard-zeus.png?branch=master)](https://travis-ci.org/guard/guard-zeus)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/guard/guard-zeus.png)](https://codeclimate.com/github/guard/guard-zeus)
|
8
8
|
|
9
9
|
Install
|
10
10
|
-------
|
@@ -50,8 +50,8 @@ Available options:
|
|
50
50
|
Development
|
51
51
|
-----------
|
52
52
|
|
53
|
-
* Source hosted at [GitHub](https://github.com/
|
54
|
-
* Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/
|
53
|
+
* Source hosted at [GitHub](https://github.com/guard/guard-zeus)
|
54
|
+
* Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-zeus/issues)
|
55
55
|
|
56
56
|
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
57
57
|
you make.
|
data/lib/guard/zeus/runner.rb
CHANGED
@@ -3,25 +3,43 @@ require 'socket'
|
|
3
3
|
require 'tempfile'
|
4
4
|
require 'digest/md5'
|
5
5
|
|
6
|
+
require 'guard/compat/plugin'
|
7
|
+
|
6
8
|
module Guard
|
7
|
-
class Zeus
|
9
|
+
class Zeus < Plugin
|
8
10
|
class Runner
|
9
11
|
attr_reader :options
|
10
12
|
|
11
13
|
def initialize(options = {})
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def launch_zeus(action)
|
17
|
-
UI.info "#{action}ing Zeus", :reset => true
|
18
|
-
spawn_zeus zeus_serve_command, zeus_serve_options
|
14
|
+
@zeus_pid = nil
|
15
|
+
@options = { run_all: true }.merge(options)
|
16
|
+
Compat::UI.info 'Guard::Zeus Initialized'
|
19
17
|
end
|
20
18
|
|
21
19
|
def kill_zeus
|
22
20
|
stop_zeus
|
23
21
|
end
|
24
22
|
|
23
|
+
def launch_zeus(action)
|
24
|
+
Compat::UI.info "#{action}ing Zeus", reset: true
|
25
|
+
|
26
|
+
# check for a current .zeus.sock
|
27
|
+
if File.exist? sockfile
|
28
|
+
Compat::UI.info 'Guard::Zeus found an existing .zeus.sock'
|
29
|
+
|
30
|
+
# if it's active, use it
|
31
|
+
if can_connect_to_socket?
|
32
|
+
Compat::UI.info 'Guard::Zeus is re-using an existing .zeus.sock'
|
33
|
+
return
|
34
|
+
end
|
35
|
+
|
36
|
+
# just delete it
|
37
|
+
delete_sockfile
|
38
|
+
end
|
39
|
+
|
40
|
+
spawn_zeus zeus_serve_command, zeus_serve_options
|
41
|
+
end
|
42
|
+
|
25
43
|
def run(paths)
|
26
44
|
run_command zeus_push_command(paths), zeus_push_options
|
27
45
|
end
|
@@ -29,22 +47,43 @@ module Guard
|
|
29
47
|
def run_all
|
30
48
|
return unless options[:run_all]
|
31
49
|
if rspec?
|
32
|
-
run(['
|
50
|
+
run(['spec'])
|
33
51
|
elsif test_unit?
|
34
|
-
run(Dir['test/**/*_test.rb']+Dir['test/**/test_*.rb'])
|
52
|
+
run(Dir['test/**/*_test.rb'] + Dir['test/**/test_*.rb'])
|
35
53
|
end
|
36
54
|
end
|
37
55
|
|
38
56
|
private
|
39
57
|
|
40
|
-
def
|
41
|
-
|
58
|
+
def bundler?
|
59
|
+
@bundler ||= options[:bundler] != false && File.exist?("#{Dir.pwd}/Gemfile")
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return a truthy socket, or catch the thrown exception
|
63
|
+
# and return false
|
64
|
+
def can_connect_to_socket?
|
65
|
+
UNIXSocket.open(sockfile)
|
66
|
+
rescue Errno::ECONNREFUSED
|
67
|
+
false
|
68
|
+
end
|
69
|
+
|
70
|
+
def delete_sockfile
|
71
|
+
Compat::UI.info 'Guard::Zeus is deleting an unusable .zeus.sock'
|
72
|
+
File.delete(sockfile)
|
73
|
+
end
|
74
|
+
|
75
|
+
def rspec?
|
76
|
+
@rspec ||= options[:rspec] != false && File.exist?("#{Dir.pwd}/spec")
|
42
77
|
end
|
43
78
|
|
44
79
|
def run_command(cmd, options = '')
|
45
80
|
system "#{cmd} #{options}"
|
46
81
|
end
|
47
82
|
|
83
|
+
def sockfile
|
84
|
+
File.join(Dir.pwd, '.zeus.sock')
|
85
|
+
end
|
86
|
+
|
48
87
|
def spawn_zeus(cmd, options = '')
|
49
88
|
@zeus_pid = fork do
|
50
89
|
exec "#{cmd} #{options}"
|
@@ -62,14 +101,20 @@ module Guard
|
|
62
101
|
end
|
63
102
|
rescue Errno::ECHILD
|
64
103
|
end
|
65
|
-
|
66
|
-
|
104
|
+
|
105
|
+
delete_sockfile if File.exist? sockfile
|
106
|
+
|
107
|
+
Compat::UI.info 'Zeus Stopped', reset: true
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_unit?
|
111
|
+
@test_unit ||= options[:test_unit] != false && File.exist?("#{Dir.pwd}/test/test_helper.rb")
|
67
112
|
end
|
68
113
|
|
69
114
|
def zeus_push_command(paths)
|
70
115
|
cmd_parts = []
|
71
|
-
cmd_parts <<
|
72
|
-
cmd_parts <<
|
116
|
+
cmd_parts << 'bundle exec' if bundler?
|
117
|
+
cmd_parts << 'zeus test'
|
73
118
|
cmd_parts << paths.join(' ')
|
74
119
|
cmd_parts.join(' ')
|
75
120
|
end
|
@@ -80,8 +125,8 @@ module Guard
|
|
80
125
|
|
81
126
|
def zeus_serve_command
|
82
127
|
cmd_parts = []
|
83
|
-
cmd_parts <<
|
84
|
-
cmd_parts <<
|
128
|
+
cmd_parts << 'bundle exec' if bundler?
|
129
|
+
cmd_parts << 'zeus start'
|
85
130
|
cmd_parts.join(' ')
|
86
131
|
end
|
87
132
|
|
@@ -90,18 +135,6 @@ module Guard
|
|
90
135
|
opt_parts << options[:cli] unless options[:cli].nil?
|
91
136
|
opt_parts.join(' ')
|
92
137
|
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
138
|
end
|
106
139
|
end
|
107
140
|
end
|
@@ -1,12 +1,38 @@
|
|
1
1
|
guard 'zeus' do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
rspec = OpenStruct.new
|
5
|
+
rspec.spec_dir = 'spec'
|
6
|
+
rspec.spec = ->(m) { "#{rspec.spec_dir}/#{m}_spec.rb" }
|
7
|
+
rspec.spec_helper = "#{rspec.spec_dir}/spec_helper.rb"
|
8
|
+
|
9
|
+
# matchers
|
10
|
+
rspec.spec_files = /^#{rspec.spec_dir}\/.+_spec\.rb$/
|
11
|
+
|
12
|
+
# Ruby apps
|
13
|
+
ruby = OpenStruct.new
|
14
|
+
ruby.lib_files = /^(lib\/.+)\.rb$/
|
15
|
+
|
16
|
+
watch(rspec.spec_files)
|
17
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
18
|
+
watch(ruby.lib_files) { |m| rspec.spec.call(m[1]) }
|
19
|
+
|
20
|
+
# Rails example
|
21
|
+
rails = OpenStruct.new
|
22
|
+
rails.app_files = /^app\/(.+)\.rb$/
|
23
|
+
rails.views_n_layouts = /^app\/(.+(?:\.erb|\.haml|\.slim))$/
|
24
|
+
rails.controllers = %r{^app/controllers/(.+)_controller\.rb$}
|
25
|
+
|
26
|
+
watch(rails.app_files) { |m| rspec.spec.call(m[1]) }
|
27
|
+
watch(rails.views_n_layouts) { |m| rspec.spec.call(m[1]) }
|
28
|
+
watch(rails.controllers) do |m|
|
29
|
+
[
|
30
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
31
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
32
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
10
36
|
# TestUnit
|
11
37
|
# watch(%r|^test/(.*)_test\.rb$|)
|
12
38
|
# watch(%r|^lib/(.*)([^/]+)\.rb$|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
data/lib/guard/zeus/version.rb
CHANGED
data/lib/guard/zeus.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
|
-
require 'guard'
|
2
|
-
require 'guard/plugin'
|
1
|
+
require 'guard/compat/plugin'
|
3
2
|
|
4
3
|
module Guard
|
5
4
|
class Zeus < Plugin
|
6
|
-
|
7
5
|
autoload :Runner, 'guard/zeus/runner'
|
8
6
|
attr_accessor :runner
|
9
7
|
|
10
|
-
def initialize(options={})
|
8
|
+
def initialize(options = {})
|
11
9
|
super
|
12
10
|
@runner = Runner.new(options)
|
13
11
|
end
|
14
12
|
|
15
13
|
def start
|
16
14
|
runner.kill_zeus
|
17
|
-
runner.launch_zeus(
|
15
|
+
runner.launch_zeus('Start')
|
18
16
|
end
|
19
17
|
|
20
18
|
def reload
|
21
19
|
runner.kill_zeus
|
22
|
-
runner.launch_zeus(
|
20
|
+
runner.launch_zeus('Reload')
|
23
21
|
end
|
24
22
|
|
25
23
|
def run_all
|
@@ -33,6 +31,5 @@ module Guard
|
|
33
31
|
def stop
|
34
32
|
runner.kill_zeus
|
35
33
|
end
|
36
|
-
|
37
34
|
end
|
38
35
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-zeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.1.pre.alpha.pre.81
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- jonathangreenberg
|
@@ -11,12 +10,11 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: guard
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ~>
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,59 +22,52 @@ dependencies:
|
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ~>
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: '2.0'
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
|
-
name:
|
30
|
+
name: guard-compat
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ~>
|
38
34
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
35
|
+
version: '1.1'
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ~>
|
46
41
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
42
|
+
version: '1.1'
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
44
|
+
name: zeus
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - ~>
|
54
48
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
56
|
-
type: :
|
49
|
+
version: '0'
|
50
|
+
type: :runtime
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - ~>
|
62
55
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
56
|
+
version: '0'
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
|
-
name:
|
58
|
+
name: bundler
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
61
|
- - ~>
|
70
62
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
63
|
+
version: '1.0'
|
72
64
|
type: :development
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
68
|
- - ~>
|
78
69
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
70
|
+
version: '1.0'
|
80
71
|
description: Guard::Zeus automatically manage zeus
|
81
72
|
email:
|
82
73
|
- greenberg@entryway.net
|
@@ -86,34 +77,33 @@ executables: []
|
|
86
77
|
extensions: []
|
87
78
|
extra_rdoc_files: []
|
88
79
|
files:
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
89
82
|
- lib/guard/zeus.rb
|
90
|
-
- lib/guard/zeus/templates/Guardfile
|
91
83
|
- lib/guard/zeus/runner.rb
|
84
|
+
- lib/guard/zeus/templates/Guardfile
|
92
85
|
- lib/guard/zeus/version.rb
|
93
|
-
-
|
94
|
-
- README.md
|
95
|
-
homepage: http://github.com/qnm/guard-zeus
|
86
|
+
homepage: https://github.com/guard/guard-zeus
|
96
87
|
licenses: []
|
88
|
+
metadata: {}
|
97
89
|
post_install_message:
|
98
90
|
rdoc_options: []
|
99
91
|
require_paths:
|
100
92
|
- lib
|
101
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
94
|
requirements:
|
104
95
|
- - ! '>='
|
105
96
|
- !ruby/object:Gem::Version
|
106
97
|
version: '0'
|
107
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
99
|
requirements:
|
110
|
-
- - ! '
|
100
|
+
- - ! '>'
|
111
101
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
102
|
+
version: 1.3.1
|
113
103
|
requirements: []
|
114
104
|
rubyforge_project:
|
115
|
-
rubygems_version:
|
105
|
+
rubygems_version: 2.4.5
|
116
106
|
signing_key:
|
117
|
-
specification_version:
|
107
|
+
specification_version: 4
|
118
108
|
summary: Pushes watched files to Zeus
|
119
109
|
test_files: []
|