guard-pow 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +10 -0
- data/Gemfile +14 -0
- data/Guardfile +5 -0
- data/{LICENSE → LICENSE.txt} +4 -2
- data/README.md +6 -7
- data/Rakefile +5 -0
- data/guard-pow.gemspec +24 -0
- data/lib/guard/pow.rb +13 -17
- data/lib/guard/pow/manager.rb +26 -0
- data/lib/guard/pow/templates/Guardfile +1 -0
- data/lib/guard/pow/version.rb +2 -2
- data/spec/lib/guard/pow/manager_spec.rb +46 -0
- data/spec/lib/guard/pow_spec.rb +53 -0
- data/spec/spec_helper.rb +8 -0
- metadata +48 -49
- data/lib/guard/pow/runner.rb +0 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f4c7f62969f6c3fdf439ab5b80ca472ef775314e
|
4
|
+
data.tar.gz: f70e5f559f4e71c9d40ba3917c4aa55dbbfc9636
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 623e96bd9db3a804fafefa9bdfdec925d0c338affd471eb2cda0b577f1a5b3e1b7ce86ca5ea9190ba22c6c48957c67b44f89fe2776c10331c3eaf5b989190bc7
|
7
|
+
data.tar.gz: a38bc606b1c85fe569eed2f2905787d15109eac7c212bd183006d5684c10c1f4d70c911eada0eff18f989407bb5ceb940e5738922a00a5aadb9055627c6ece30
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/{LICENSE → LICENSE.txt}
RENAMED
@@ -1,4 +1,6 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2013 Thibaud Guillaume-Gentil
|
2
|
+
|
3
|
+
MIT License
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
6
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
Guard::Pow [![
|
2
|
-
=============
|
1
|
+
# Guard::Pow [![Gem Version](https://badge.fury.io/rb/guard-pow.png)](http://badge.fury.io/rb/guard-pow) [![Build Status](https://travis-ci.org/guard/guard-pow.png?branch=master)](http://travis-ci.org/guard/guard-pow) [![Dependency Status](https://gemnasium.com/guard/guard-pow.png)](https://gemnasium.com/guard/guard-pow) [![Code Climate](https://codeclimate.com/github/guard/guard-pow.png)](https://codeclimate.com/github/guard/guard-pow)
|
3
2
|
|
4
3
|
Pow guard allows to automatically & intelligently restart your applications (just by touching tmp/restart.txt)
|
5
4
|
|
6
|
-
* Tested on Ruby 1.
|
5
|
+
* Tested on Ruby 1.9.3, 2.0.0, rbx & jruby
|
7
6
|
|
8
7
|
Install
|
9
8
|
-------
|
@@ -33,7 +32,7 @@ Guardfile
|
|
33
32
|
---------
|
34
33
|
|
35
34
|
Pow guard can be really be adapated to all kind of projects.
|
36
|
-
Please read [Guard doc](
|
35
|
+
Please read [Guard doc](https://github.com/guard/guard#readme) for more info about Guardfile DSL.
|
37
36
|
|
38
37
|
### Rails app
|
39
38
|
|
@@ -54,8 +53,8 @@ end
|
|
54
53
|
### List of available options:
|
55
54
|
|
56
55
|
``` ruby
|
57
|
-
:
|
58
|
-
:
|
56
|
+
restart_on_start: true # Restart Pow on Guard start, default: false
|
57
|
+
restart_on_reload: false # Restart Pow on Guard reload, default: true
|
59
58
|
```
|
60
59
|
|
61
60
|
Development
|
@@ -70,4 +69,4 @@ you make.
|
|
70
69
|
Author
|
71
70
|
------
|
72
71
|
|
73
|
-
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
|
72
|
+
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
|
data/Rakefile
ADDED
data/guard-pow.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'guard/pow/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "guard-pow"
|
8
|
+
s.version = Guard::PowVersion::VERSION
|
9
|
+
s.author = "Thibaud Guillaume-Gentil"
|
10
|
+
s.email = "thibaud@thibaud.me"
|
11
|
+
s.summary = 'Guard plugin for Pow'
|
12
|
+
s.description = 'Guard::Pow automatically manage Pow applications restart'
|
13
|
+
s.homepage = 'http://rubygems.org/gems/guard-pow'
|
14
|
+
s.license = "MIT"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
s.test_files = s.files.grep(%r{^spec/})
|
18
|
+
s.require_path = 'lib'
|
19
|
+
|
20
|
+
s.add_dependency 'guard', '~> 2.0'
|
21
|
+
s.add_development_dependency 'bundler', '>= 1.3.5'
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'rspec'
|
24
|
+
end
|
data/lib/guard/pow.rb
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
require 'guard'
|
2
|
-
require 'guard/
|
2
|
+
require 'guard/plugin'
|
3
3
|
|
4
4
|
module Guard
|
5
|
-
class Pow <
|
5
|
+
class Pow < Plugin
|
6
|
+
require 'guard/pow/manager'
|
6
7
|
|
7
|
-
|
8
|
-
attr_accessor :runner
|
8
|
+
attr_accessor :manager
|
9
9
|
|
10
|
-
def initialize(
|
10
|
+
def initialize(options = {})
|
11
11
|
super
|
12
12
|
@options = {
|
13
|
-
:
|
14
|
-
:
|
15
|
-
}.
|
16
|
-
@
|
13
|
+
restart_on_start: false,
|
14
|
+
restart_on_reload: true
|
15
|
+
}.merge(options)
|
16
|
+
@manager = Manager.new
|
17
17
|
end
|
18
18
|
|
19
19
|
def start
|
20
|
-
|
20
|
+
manager.restart if options[:restart_on_start]
|
21
21
|
end
|
22
22
|
|
23
23
|
def reload
|
24
|
-
|
24
|
+
manager.restart if options[:restart_on_reload]
|
25
25
|
end
|
26
26
|
|
27
27
|
def run_on_changes(paths)
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def stop
|
32
|
-
true
|
28
|
+
manager.restart
|
33
29
|
end
|
34
30
|
|
35
31
|
end
|
36
|
-
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Guard
|
4
|
+
class Pow
|
5
|
+
class Manager
|
6
|
+
|
7
|
+
def restart
|
8
|
+
_touch_tmp_restart
|
9
|
+
_notify "Pow restarted."
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def _touch_tmp_restart
|
15
|
+
FileUtils.mkdir('tmp') unless File.directory?("tmp")
|
16
|
+
FileUtils.touch('tmp/restart.txt')
|
17
|
+
end
|
18
|
+
|
19
|
+
def _notify(message)
|
20
|
+
UI.info(message)
|
21
|
+
Notifier.notify(message, title: "Pow", image: :success)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/guard/pow/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
describe Guard::Pow::Manager do
|
5
|
+
let(:manager) { Guard::Pow::Manager.new }
|
6
|
+
|
7
|
+
before {
|
8
|
+
Guard::UI.stub(:info)
|
9
|
+
Guard::Notifier.stub(:notify)
|
10
|
+
}
|
11
|
+
|
12
|
+
describe "#restart_pow" do
|
13
|
+
|
14
|
+
context "without tmp dir" do
|
15
|
+
before { FileUtils.rm_rf('tmp') }
|
16
|
+
|
17
|
+
it "creates tmp/restart.txt" do
|
18
|
+
expect { manager.restart }.to change { File.file?("tmp/restart.txt") }.from(false).to(true)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with tmp dir" do
|
23
|
+
before {
|
24
|
+
FileUtils.mkdir 'tmp' unless File.directory?("tmp")
|
25
|
+
FileUtils.rm_rf('tmp/restart.txt')
|
26
|
+
}
|
27
|
+
|
28
|
+
it "creates tmp/restart.txt" do
|
29
|
+
expect { manager.restart }.to change { File.file?("tmp/restart.txt") }.from(false).to(true)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with tmp dir" do
|
34
|
+
before {
|
35
|
+
FileUtils.mkdir 'tmp' unless File.directory?("tmp")
|
36
|
+
FileUtils.touch('tmp/restart.txt')
|
37
|
+
sleep 1
|
38
|
+
}
|
39
|
+
|
40
|
+
it "touches tmp/restart.txt" do
|
41
|
+
expect { manager.restart }.to change { File.mtime("tmp/restart.txt") }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Pow do
|
4
|
+
let(:options) { { } }
|
5
|
+
let(:plugin) { Guard::Pow.new(options) }
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
it 'instanciates manager with option' do
|
9
|
+
expect(Guard::Pow::Manager).to receive(:new)
|
10
|
+
plugin
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "start" do
|
15
|
+
it "doesn't restart pow by default" do
|
16
|
+
expect(plugin.manager).to_not receive(:restart)
|
17
|
+
plugin.start
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with restart_on_start option" do
|
21
|
+
let(:options) { { restart_on_start: true } }
|
22
|
+
|
23
|
+
it "restarts pow" do
|
24
|
+
expect(plugin.manager).to receive(:restart)
|
25
|
+
plugin.start
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "reload" do
|
31
|
+
it "restarts pow by default" do
|
32
|
+
expect(plugin.manager).to receive(:restart)
|
33
|
+
plugin.reload
|
34
|
+
end
|
35
|
+
|
36
|
+
context "with restart_on_reload option set to false" do
|
37
|
+
let(:options) { { restart_on_reload: false } }
|
38
|
+
|
39
|
+
it "doesn't restart pow" do
|
40
|
+
expect(plugin.manager).to_not receive(:restart)
|
41
|
+
plugin.reload
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "run_on_changes" do
|
47
|
+
it "restarts pow" do
|
48
|
+
expect(plugin.manager).to receive(:restart)
|
49
|
+
plugin.run_on_changes(["xxx"])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,118 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-pow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Thibaud Guillaume-Gentil
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: guard
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '2.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '2.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: bundler
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: 1.3.5
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: 1.3.5
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
54
|
+
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
61
|
+
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
68
|
+
version: '0'
|
78
69
|
description: Guard::Pow automatically manage Pow applications restart
|
79
|
-
email:
|
80
|
-
- thibaud@thibaud.me
|
70
|
+
email: thibaud@thibaud.me
|
81
71
|
executables: []
|
82
72
|
extensions: []
|
83
73
|
extra_rdoc_files: []
|
84
74
|
files:
|
85
|
-
-
|
75
|
+
- .gitignore
|
76
|
+
- .travis.yml
|
77
|
+
- Gemfile
|
78
|
+
- Guardfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- guard-pow.gemspec
|
83
|
+
- lib/guard/pow.rb
|
84
|
+
- lib/guard/pow/manager.rb
|
86
85
|
- lib/guard/pow/templates/Guardfile
|
87
86
|
- lib/guard/pow/version.rb
|
88
|
-
- lib/guard/pow.rb
|
89
|
-
-
|
90
|
-
-
|
87
|
+
- spec/lib/guard/pow/manager_spec.rb
|
88
|
+
- spec/lib/guard/pow_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
91
90
|
homepage: http://rubygems.org/gems/guard-pow
|
92
|
-
licenses:
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
93
94
|
post_install_message:
|
94
95
|
rdoc_options: []
|
95
96
|
require_paths:
|
96
97
|
- lib
|
97
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
hash: 105995648322075351
|
106
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
104
|
requirements:
|
109
|
-
- -
|
105
|
+
- - '>='
|
110
106
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
107
|
+
version: '0'
|
112
108
|
requirements: []
|
113
|
-
rubyforge_project:
|
114
|
-
rubygems_version: 1.
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.1.3
|
115
111
|
signing_key:
|
116
|
-
specification_version:
|
117
|
-
summary: Guard
|
118
|
-
test_files:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Guard plugin for Pow
|
114
|
+
test_files:
|
115
|
+
- spec/lib/guard/pow/manager_spec.rb
|
116
|
+
- spec/lib/guard/pow_spec.rb
|
117
|
+
- spec/spec_helper.rb
|
data/lib/guard/pow/runner.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module Guard
|
4
|
-
class Pow
|
5
|
-
class Runner
|
6
|
-
|
7
|
-
def restart_pow
|
8
|
-
FileUtils.mkdir 'tmp' unless File.directory?("tmp")
|
9
|
-
FileUtils.touch 'tmp/restart.txt'
|
10
|
-
UI.info "Pow restarted."
|
11
|
-
Notifier.notify("Pow restarted.", :title => "Pow", :image => :success)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|