guard-pumadev 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.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +5 -0
- data/guard-pow.gemspec +25 -0
- data/lib/guard/pumadev.rb +32 -0
- data/lib/guard/pumadev/manager.rb +27 -0
- data/lib/guard/pumadev/templates/Guardfile +10 -0
- data/lib/guard/pumadev/version.rb +5 -0
- data/spec/lib/guard/pumadev/manager_spec.rb +49 -0
- data/spec/lib/guard/pumadev_spec.rb +54 -0
- data/spec/spec_helper.rb +8 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1caf6c2d5545eabebc386ae0c670ab480563e48c
|
4
|
+
data.tar.gz: 5406de280417ce8d5db5600fdde163ec50898a30
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 990f74c9c18f57e05df987bd5fb8b61be9ccfd066935350e9b8e7a7ef07f6cff27fd7d2009c0c860d100d7176ebeeef6188cb51a676e6d3d073e002040f1b7a7
|
7
|
+
data.tar.gz: f4764f540b8e752f2749cd6caf89c2759ed39f95cdbbbe82392a2dceb4ab74fbb849658bbca9ce166e74e63a71d105e6251785a33c67c45ec0400afcaad4de30
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2017 Tyler Horan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Guard::Pumadev
|
2
|
+
|
3
|
+
Pumadev guard allows to automatically & intelligently restart your applications (just by touching and removing tmp/restart.txt)
|
4
|
+
|
5
|
+
* Tested on Ruby 1.9.3, 2.0.0, rbx & jruby
|
6
|
+
|
7
|
+
Install
|
8
|
+
-------
|
9
|
+
|
10
|
+
Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
|
11
|
+
|
12
|
+
Install the gem:
|
13
|
+
|
14
|
+
``` bash
|
15
|
+
gem install guard-pumadev
|
16
|
+
```
|
17
|
+
|
18
|
+
Add it to your Gemfile (inside development group):
|
19
|
+
|
20
|
+
``` ruby
|
21
|
+
gem 'guard-pumadev', require: false
|
22
|
+
```
|
23
|
+
|
24
|
+
Add guard definition to your Guardfile by running this command:
|
25
|
+
|
26
|
+
``` bash
|
27
|
+
guard init pumadev
|
28
|
+
```
|
29
|
+
|
30
|
+
Usage
|
31
|
+
-----
|
32
|
+
|
33
|
+
Please read [Guard usage doc](https://github.com/guard/guard#readme)
|
34
|
+
|
35
|
+
Guardfile
|
36
|
+
---------
|
37
|
+
|
38
|
+
Pow guard can be really be adapated to all kind of projects.
|
39
|
+
Please read [Guard doc](https://github.com/guard/guard#readme) for more info about Guardfile DSL.
|
40
|
+
|
41
|
+
### Rails app
|
42
|
+
|
43
|
+
``` ruby
|
44
|
+
guard 'pumadev' do
|
45
|
+
watch('.rvmrc')
|
46
|
+
watch('Gemfile')
|
47
|
+
watch('Gemfile.lock')
|
48
|
+
watch('config/application.rb')
|
49
|
+
watch('config/environment.rb')
|
50
|
+
watch(%r{^config/environments/.*\.rb$})
|
51
|
+
watch(%r{^config/initializers/.*\.rb$})
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
### List of available options:
|
56
|
+
|
57
|
+
``` ruby
|
58
|
+
restart_on_start: true # Restart Pow on Guard start, default: false
|
59
|
+
restart_on_reload: false # Restart Pow on Guard reload, default: true
|
60
|
+
```
|
61
|
+
|
62
|
+
Development
|
63
|
+
-----------
|
64
|
+
|
65
|
+
* Source hosted at [GitHub](https://github.com/guard/guard-rspec)
|
66
|
+
* Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-rspec/issues)
|
67
|
+
|
68
|
+
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
69
|
+
you make.
|
70
|
+
|
71
|
+
Author
|
72
|
+
------
|
73
|
+
|
74
|
+
[Tyler Horan](https://github.com/tylerhoran)
|
data/Rakefile
ADDED
data/guard-pow.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
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-pumadev"
|
8
|
+
s.version = Guard::PowVersion::VERSION
|
9
|
+
s.author = "Tyler Horan"
|
10
|
+
s.email = "tyler@tylerhoran.com"
|
11
|
+
s.summary = 'Guard plugin for PumaDev'
|
12
|
+
s.description = 'Guard::PumaDev automatically manage PumaDev applications restart'
|
13
|
+
s.homepage = 'https://rubygems.org/gems/guard-pumadev'
|
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_dependency('guard-compat', '~> 1.0')
|
22
|
+
s.add_development_dependency 'bundler', '>= 1.3.5'
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
s.add_development_dependency 'rspec'
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/compat/plugin'
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
class Pumadev < Plugin
|
6
|
+
require 'guard/pumadev/manager'
|
7
|
+
|
8
|
+
attr_accessor :manager
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
super
|
12
|
+
@options = {
|
13
|
+
restart_on_start: false,
|
14
|
+
restart_on_reload: true
|
15
|
+
}.merge(options)
|
16
|
+
@manager = Manager.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def start
|
20
|
+
manager.restart if options[:restart_on_start]
|
21
|
+
end
|
22
|
+
|
23
|
+
def reload
|
24
|
+
manager.restart if options[:restart_on_reload]
|
25
|
+
end
|
26
|
+
|
27
|
+
def run_on_changes(paths)
|
28
|
+
manager.restart
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Guard
|
4
|
+
class Pumadev
|
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
|
+
FileUtils.rm('tmp/restart.txt')
|
18
|
+
end
|
19
|
+
|
20
|
+
def _notify(message)
|
21
|
+
UI.info(message)
|
22
|
+
Notifier.notify(message, title: "Pow", image: :success)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
guard 'pumadev' do
|
2
|
+
watch('.rvmrc')
|
3
|
+
watch('.ruby-version')
|
4
|
+
watch('Gemfile')
|
5
|
+
watch('Gemfile.lock')
|
6
|
+
watch('config/application.rb')
|
7
|
+
watch('config/environment.rb')
|
8
|
+
watch(%r{^config/environments/.*\.rb$})
|
9
|
+
watch(%r{^config/initializers/.*\.rb$})
|
10
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
describe Guard::Pumadev::Manager do
|
5
|
+
let(:manager) { Guard::Pumadev::Manager.new }
|
6
|
+
|
7
|
+
before {
|
8
|
+
Guard::UI.stub(:info)
|
9
|
+
Guard::Notifier.stub(:notify)
|
10
|
+
}
|
11
|
+
|
12
|
+
describe "#restart_pumadev" do
|
13
|
+
|
14
|
+
context "without tmp dir" do
|
15
|
+
before { FileUtils.rm_rf('tmp') }
|
16
|
+
|
17
|
+
it "creates and removes tmp/restart.txt" do
|
18
|
+
manager.restart
|
19
|
+
expect(File.file?("tmp/restart.txt")).to be_falsey
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with tmp dir" do
|
24
|
+
before {
|
25
|
+
FileUtils.mkdir 'tmp' unless File.directory?("tmp")
|
26
|
+
FileUtils.rm_rf('tmp/restart.txt')
|
27
|
+
}
|
28
|
+
|
29
|
+
it "creates tmp/restart.txt" do
|
30
|
+
manager.restart
|
31
|
+
expect(File.file?("tmp/restart.txt")).to be_falsey
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with tmp dir" do
|
36
|
+
before {
|
37
|
+
FileUtils.mkdir 'tmp' unless File.directory?("tmp")
|
38
|
+
FileUtils.touch('tmp/restart.txt')
|
39
|
+
sleep 1
|
40
|
+
}
|
41
|
+
|
42
|
+
it "touches tmp/restart.txt" do
|
43
|
+
manager.restart
|
44
|
+
expect(File.file?("tmp/restart.txt")).to be_falsey
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'guard/compat/test/helper'
|
3
|
+
|
4
|
+
describe Guard::Pumadev do
|
5
|
+
let(:options) { { } }
|
6
|
+
let(:plugin) { Guard::Pumadev.new(options) }
|
7
|
+
|
8
|
+
describe '#initialize' do
|
9
|
+
it 'instanciates manager with option' do
|
10
|
+
expect(Guard::Pumadev::Manager).to receive(:new)
|
11
|
+
plugin
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "start" do
|
16
|
+
it "doesn't restart pow by default" do
|
17
|
+
expect(plugin.manager).to_not receive(:restart)
|
18
|
+
plugin.start
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with restart_on_start option" do
|
22
|
+
let(:options) { { restart_on_start: true } }
|
23
|
+
|
24
|
+
it "restarts pow" do
|
25
|
+
expect(plugin.manager).to receive(:restart)
|
26
|
+
plugin.start
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "reload" do
|
32
|
+
it "restarts pow by default" do
|
33
|
+
expect(plugin.manager).to receive(:restart)
|
34
|
+
plugin.reload
|
35
|
+
end
|
36
|
+
|
37
|
+
context "with restart_on_reload option set to false" do
|
38
|
+
let(:options) { { restart_on_reload: false } }
|
39
|
+
|
40
|
+
it "doesn't restart pow" do
|
41
|
+
expect(plugin.manager).to_not receive(:restart)
|
42
|
+
plugin.reload
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "run_on_changes" do
|
48
|
+
it "restarts pow" do
|
49
|
+
expect(plugin.manager).to receive(:restart)
|
50
|
+
plugin.run_on_changes(["xxx"])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-pumadev
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tyler Horan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: guard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: guard-compat
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.5
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Guard::PumaDev automatically manage PumaDev applications restart
|
84
|
+
email: tyler@tylerhoran.com
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- ".gitignore"
|
90
|
+
- ".travis.yml"
|
91
|
+
- Gemfile
|
92
|
+
- Guardfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- guard-pow.gemspec
|
97
|
+
- lib/guard/pumadev.rb
|
98
|
+
- lib/guard/pumadev/manager.rb
|
99
|
+
- lib/guard/pumadev/templates/Guardfile
|
100
|
+
- lib/guard/pumadev/version.rb
|
101
|
+
- spec/lib/guard/pumadev/manager_spec.rb
|
102
|
+
- spec/lib/guard/pumadev_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
homepage: https://rubygems.org/gems/guard-pumadev
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.6.12
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Guard plugin for PumaDev
|
128
|
+
test_files:
|
129
|
+
- spec/lib/guard/pumadev/manager_spec.rb
|
130
|
+
- spec/lib/guard/pumadev_spec.rb
|
131
|
+
- spec/spec_helper.rb
|