guard-zeus 2.0.0.pre.alpha.pre.79 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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/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)
6
+ [![Build Status](https://travis-ci.org/qnm/guard-zeus.png?branch=master)](https://travis-ci.org/qnm/guard-zeus)
7
+ [![Code Climate](https://codeclimate.com/github/qnm/guard-zeus.png)](https://codeclimate.com/github/qnm/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/guard/guard-zeus)
54
- * Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-zeus/issues)
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
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.rb CHANGED
@@ -1,23 +1,25 @@
1
- require 'guard/compat/plugin'
1
+ require 'guard'
2
+ require 'guard/plugin'
2
3
 
3
4
  module Guard
4
5
  class Zeus < Plugin
6
+
5
7
  autoload :Runner, 'guard/zeus/runner'
6
8
  attr_accessor :runner
7
9
 
8
- def initialize(options = {})
10
+ def initialize(options={})
9
11
  super
10
12
  @runner = Runner.new(options)
11
13
  end
12
14
 
13
15
  def start
14
16
  runner.kill_zeus
15
- runner.launch_zeus('Start')
17
+ runner.launch_zeus("Start")
16
18
  end
17
19
 
18
20
  def reload
19
21
  runner.kill_zeus
20
- runner.launch_zeus('Reload')
22
+ runner.launch_zeus("Reload")
21
23
  end
22
24
 
23
25
  def run_all
@@ -31,5 +33,6 @@ module Guard
31
33
  def stop
32
34
  runner.kill_zeus
33
35
  end
36
+
34
37
  end
35
38
  end
@@ -3,43 +3,25 @@ require 'socket'
3
3
  require 'tempfile'
4
4
  require 'digest/md5'
5
5
 
6
- require 'guard/compat/plugin'
7
-
8
6
  module Guard
9
- class Zeus < Plugin
7
+ class Zeus
10
8
  class Runner
11
9
  attr_reader :options
12
10
 
13
11
  def initialize(options = {})
14
- @zeus_pid = nil
15
- @options = { run_all: true }.merge(options)
16
- Compat::UI.info 'Guard::Zeus Initialized'
17
- end
18
-
19
- def kill_zeus
20
- stop_zeus
12
+ @options = {:run_all => true}.merge(options)
13
+ UI.info "Guard::Zeus Initialized"
21
14
  end
22
15
 
23
16
  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
-
17
+ UI.info "#{action}ing Zeus", :reset => true
40
18
  spawn_zeus zeus_serve_command, zeus_serve_options
41
19
  end
42
20
 
21
+ def kill_zeus
22
+ stop_zeus
23
+ end
24
+
43
25
  def run(paths)
44
26
  run_command zeus_push_command(paths), zeus_push_options
45
27
  end
@@ -47,43 +29,22 @@ module Guard
47
29
  def run_all
48
30
  return unless options[:run_all]
49
31
  if rspec?
50
- run(['spec'])
32
+ run(['rspec'])
51
33
  elsif test_unit?
52
- run(Dir['test/**/*_test.rb'] + Dir['test/**/test_*.rb'])
34
+ run(Dir['test/**/*_test.rb']+Dir['test/**/test_*.rb'])
53
35
  end
54
36
  end
55
37
 
56
38
  private
57
39
 
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")
40
+ def sockfile
41
+ File.join(Dir.pwd, ".zeus.sock")
77
42
  end
78
43
 
79
44
  def run_command(cmd, options = '')
80
45
  system "#{cmd} #{options}"
81
46
  end
82
47
 
83
- def sockfile
84
- File.join(Dir.pwd, '.zeus.sock')
85
- end
86
-
87
48
  def spawn_zeus(cmd, options = '')
88
49
  @zeus_pid = fork do
89
50
  exec "#{cmd} #{options}"
@@ -101,20 +62,14 @@ module Guard
101
62
  end
102
63
  rescue Errno::ECHILD
103
64
  end
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")
65
+ File.delete(sockfile) if File.exist? sockfile
66
+ UI.info "Zeus Stopped", :reset => true
112
67
  end
113
68
 
114
69
  def zeus_push_command(paths)
115
70
  cmd_parts = []
116
- cmd_parts << 'bundle exec' if bundler?
117
- cmd_parts << 'zeus test'
71
+ cmd_parts << "bundle exec" if bundler?
72
+ cmd_parts << "zeus test"
118
73
  cmd_parts << paths.join(' ')
119
74
  cmd_parts.join(' ')
120
75
  end
@@ -125,8 +80,8 @@ module Guard
125
80
 
126
81
  def zeus_serve_command
127
82
  cmd_parts = []
128
- cmd_parts << 'bundle exec' if bundler?
129
- cmd_parts << 'zeus start'
83
+ cmd_parts << "bundle exec" if bundler?
84
+ cmd_parts << "zeus start"
130
85
  cmd_parts.join(' ')
131
86
  end
132
87
 
@@ -135,6 +90,18 @@ module Guard
135
90
  opt_parts << options[:cli] unless options[:cli].nil?
136
91
  opt_parts.join(' ')
137
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
138
105
  end
139
106
  end
140
107
  end
@@ -1,38 +1,12 @@
1
1
  guard 'zeus' do
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
-
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
+
36
10
  # TestUnit
37
11
  # watch(%r|^test/(.*)_test\.rb$|)
38
12
  # watch(%r|^lib/(.*)([^/]+)\.rb$|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module ZeusVersion
3
- VERSION = '2.0.0'
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-zeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.pre.79
4
+ version: 2.0.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - jonathangreenberg
@@ -10,11 +11,12 @@ authors:
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2015-01-13 00:00:00.000000000 Z
14
+ date: 2014-01-29 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: guard
17
18
  requirement: !ruby/object:Gem::Requirement
19
+ none: false
18
20
  requirements:
19
21
  - - ~>
20
22
  - !ruby/object:Gem::Version
@@ -22,52 +24,59 @@ dependencies:
22
24
  type: :runtime
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
25
28
  requirements:
26
29
  - - ~>
27
30
  - !ruby/object:Gem::Version
28
31
  version: '2.0'
29
32
  - !ruby/object:Gem::Dependency
30
- name: guard-compat
33
+ name: zeus
31
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
32
36
  requirements:
33
37
  - - ~>
34
38
  - !ruby/object:Gem::Version
35
- version: '1.1'
39
+ version: '0'
36
40
  type: :runtime
37
41
  prerelease: false
38
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
39
44
  requirements:
40
45
  - - ~>
41
46
  - !ruby/object:Gem::Version
42
- version: '1.1'
47
+ version: '0'
43
48
  - !ruby/object:Gem::Dependency
44
- name: zeus
49
+ name: bundler
45
50
  requirement: !ruby/object:Gem::Requirement
51
+ none: false
46
52
  requirements:
47
53
  - - ~>
48
54
  - !ruby/object:Gem::Version
49
- version: '0'
50
- type: :runtime
55
+ version: '1.0'
56
+ type: :development
51
57
  prerelease: false
52
58
  version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
53
60
  requirements:
54
61
  - - ~>
55
62
  - !ruby/object:Gem::Version
56
- version: '0'
63
+ version: '1.0'
57
64
  - !ruby/object:Gem::Dependency
58
- name: bundler
65
+ name: rspec
59
66
  requirement: !ruby/object:Gem::Requirement
67
+ none: false
60
68
  requirements:
61
69
  - - ~>
62
70
  - !ruby/object:Gem::Version
63
- version: '1.0'
71
+ version: '2.14'
64
72
  type: :development
65
73
  prerelease: false
66
74
  version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
67
76
  requirements:
68
77
  - - ~>
69
78
  - !ruby/object:Gem::Version
70
- version: '1.0'
79
+ version: '2.14'
71
80
  description: Guard::Zeus automatically manage zeus
72
81
  email:
73
82
  - greenberg@entryway.net
@@ -77,33 +86,34 @@ executables: []
77
86
  extensions: []
78
87
  extra_rdoc_files: []
79
88
  files:
80
- - LICENSE
81
- - README.md
82
89
  - lib/guard/zeus.rb
83
- - lib/guard/zeus/runner.rb
84
90
  - lib/guard/zeus/templates/Guardfile
91
+ - lib/guard/zeus/runner.rb
85
92
  - lib/guard/zeus/version.rb
86
- homepage: https://github.com/guard/guard-zeus
93
+ - LICENSE
94
+ - README.md
95
+ homepage: http://github.com/qnm/guard-zeus
87
96
  licenses: []
88
- metadata: {}
89
97
  post_install_message:
90
98
  rdoc_options: []
91
99
  require_paths:
92
100
  - lib
93
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
94
103
  requirements:
95
104
  - - ! '>='
96
105
  - !ruby/object:Gem::Version
97
106
  version: '0'
98
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
99
109
  requirements:
100
- - - ! '>'
110
+ - - ! '>='
101
111
  - !ruby/object:Gem::Version
102
- version: 1.3.1
112
+ version: '0'
103
113
  requirements: []
104
114
  rubyforge_project:
105
- rubygems_version: 2.4.5
115
+ rubygems_version: 1.8.25
106
116
  signing_key:
107
- specification_version: 4
117
+ specification_version: 3
108
118
  summary: Pushes watched files to Zeus
109
119
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MGZkNWJiNDcyODM0MGE1M2Q1MjQ0MTNmMDU0NzEyYTI0OTU0YzU2YQ==
5
- data.tar.gz: !binary |-
6
- ZjQ0MjgxZjRhNzNiYzBlYWU4MzQ2ODZhN2UyNGI0ODQ2NWY0MDNhNw==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- NTI4OTdmNzY1ZTQ4NjhjZjkyMzRlYjIxMjBhZDI1NjBhMDAyNTNmMmM3YWRl
10
- MGUxZmJkM2E3M2Y4YzIyNjY3MDUyZTIyMDc3MGMxNDM0OTNjYTMwMGIxY2I2
11
- ODI1MjU2NmU4OGFmMDliYjEzYzZhMWQ3ODA2MWU5YzgwZmMyNDM=
12
- data.tar.gz: !binary |-
13
- NzI1OWQ1MTUyMDJkYzU4YWEzOGZmMzhmNDY4YzU4ZjVlZmZmOGQ4Y2FiZjdm
14
- OGI1NjA4N2M2MGQxMGU1YzBmMjJiYjBlZmJmZWY1OWY3OWE0YzU4YTMxOGYy
15
- YjE5ZTVmNTJhMTFkZTcwYTQ4MzIwNzA3ODNjM2I3YjQxNjViZTk=