guard-faktory_worker 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +59 -0
- data/Rakefile +2 -0
- data/guard-faktory_worker.gemspec +35 -0
- data/lib/guard/faktory_worker.rb +106 -0
- data/lib/guard/faktory_worker/templates/Guardfile +3 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d32ebb739a07cbd1c4f165a86b6a1c348c36d565cbe5db4590e4035436964b7e
|
4
|
+
data.tar.gz: 1538370009abe86fbe2c5db51ed7f283028ed82273aa4716711ed9d49b06cee4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc08745e3c7488ef794a31e7261d32688a4c55c5f8520ccb71fccec26596f1275d9ca62d8e4b7815c3c40af6f2cc08eb3f54ea87efb64ba58d279b2562ae2c13
|
7
|
+
data.tar.gz: 4bc8cd841c8365d841591cbfad6ca54640a8f5a3adc9edb8a2bc4616391374489e2cb0761817eff3bb191745c0b13aa8daa6cee663845457b069627484f94279
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at aaron@aaronnamba.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Aaron Namba
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# guard-faktory_worker
|
2
|
+
|
3
|
+
**guard-faktory_worker** runs [faktory_worker](https://github.com/bbatsov/faktory_worker) when you start Guard and restarts it when watched files are added/modified/deleted.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install and configure [Guard](https://github.com/guard/guard) before continuing.
|
8
|
+
|
9
|
+
Add `guard-faktory_worker` to your `Gemfile`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
group :development do
|
13
|
+
gem 'guard-faktory_worker'
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
and then execute:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
$ bundle install
|
21
|
+
```
|
22
|
+
|
23
|
+
or install it yourself as:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
$ gem install guard-faktory_worker
|
27
|
+
```
|
28
|
+
|
29
|
+
Add the default Guard::faktory_worker definition to your `Guardfile` by running:
|
30
|
+
|
31
|
+
```sh
|
32
|
+
$ guard init faktory_worker
|
33
|
+
```
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Please read the [Guard usage documentation](https://github.com/guard/guard#readme).
|
38
|
+
|
39
|
+
## Options
|
40
|
+
|
41
|
+
You can pass some options in `Guardfile` like the following example:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
guard :faktory_worker, cmd: 'bundle exec faktory-worker' do
|
45
|
+
# ...
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/anamba/guard-faktory_worker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/anamba/guard-faktory_worker/blob/master/CODE_OF_CONDUCT.md).
|
52
|
+
|
53
|
+
## License
|
54
|
+
|
55
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
56
|
+
|
57
|
+
## Code of Conduct
|
58
|
+
|
59
|
+
Everyone interacting in the guard-faktory_worker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/anamba/guard-faktory_worker/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
require 'guard/faktory_worker'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "guard-faktory_worker"
|
8
|
+
# spec.version = '0.0.1'
|
9
|
+
spec.version = Guard::FaktoryWorker::VERSION
|
10
|
+
spec.authors = ["Aaron Namba"]
|
11
|
+
spec.email = ["aaron@aaronnamba.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Guard plugin for faktory-worker}
|
14
|
+
|
15
|
+
spec.homepage = "https://github.com/anamba/guard-faktory_worker"
|
16
|
+
spec.license = "MIT"
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
18
|
+
|
19
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/anamba/guard-faktory_worker/CHANGELOG.md"
|
24
|
+
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_dependency 'guard-compat', '~> 1.1'
|
35
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'guard/compat/plugin'
|
2
|
+
|
3
|
+
module Guard
|
4
|
+
class FaktoryWorker < Plugin
|
5
|
+
VERSION = "0.1.0"
|
6
|
+
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
# Initializes a Guard plugin.
|
10
|
+
# Don't do any work here, especially as Guard plugins get initialized even if they are not in an active group!
|
11
|
+
#
|
12
|
+
# @param [Hash] options the custom Guard plugin options
|
13
|
+
# @option options [Array<Guard::Watcher>] watchers the Guard plugin file watchers
|
14
|
+
# @option options [Symbol] group the group this Guard plugin belongs to
|
15
|
+
# @option options [Boolean] any_return allow any object to be returned from a watcher
|
16
|
+
#
|
17
|
+
def initialize(options = {})
|
18
|
+
opts = options.dup
|
19
|
+
|
20
|
+
@cmd = opts.delete(:cmd) || 'bundle exec faktory-worker'
|
21
|
+
|
22
|
+
super(opts) # important to call + avoid passing options Guard doesn't understand
|
23
|
+
end
|
24
|
+
|
25
|
+
# Called once when Guard starts. Please override initialize method to init stuff.
|
26
|
+
#
|
27
|
+
# @raise [:task_has_failed] when start has failed
|
28
|
+
# @return [Object] the task result
|
29
|
+
#
|
30
|
+
def start
|
31
|
+
puts "Starting faktory-worker..."
|
32
|
+
|
33
|
+
# FIXME?
|
34
|
+
begin
|
35
|
+
@pid = spawn(@cmd)
|
36
|
+
sleep 1
|
37
|
+
Process.kill(0, @pid) == 1
|
38
|
+
rescue Errno::ESRCH
|
39
|
+
false
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
44
|
+
#
|
45
|
+
# @raise [:task_has_failed] when stop has failed
|
46
|
+
# @return [Object] the task result
|
47
|
+
#
|
48
|
+
def stop
|
49
|
+
if @pid
|
50
|
+
Process.kill("INT", @pid)
|
51
|
+
Process.wait(@pid)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Called when `reload|r|z + enter` is pressed.
|
56
|
+
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
57
|
+
#
|
58
|
+
# @raise [:task_has_failed] when reload has failed
|
59
|
+
# @return [Object] the task result
|
60
|
+
#
|
61
|
+
def reload
|
62
|
+
stop
|
63
|
+
start
|
64
|
+
end
|
65
|
+
|
66
|
+
# Called when just `enter` is pressed
|
67
|
+
# This method should be principally used for long action like running all specs/tests/...
|
68
|
+
#
|
69
|
+
# @raise [:task_has_failed] when run_all has failed
|
70
|
+
# @return [Object] the task result
|
71
|
+
#
|
72
|
+
def run_all
|
73
|
+
true # don't do anything
|
74
|
+
end
|
75
|
+
|
76
|
+
# Called on file(s) additions that the Guard plugin watches.
|
77
|
+
#
|
78
|
+
# @param [Array<String>] paths the changes files or paths
|
79
|
+
# @raise [:task_has_failed] when run_on_additions has failed
|
80
|
+
# @return [Object] the task result
|
81
|
+
#
|
82
|
+
def run_on_additions(paths)
|
83
|
+
reload
|
84
|
+
end
|
85
|
+
|
86
|
+
# Called on file(s) modifications that the Guard plugin watches.
|
87
|
+
#
|
88
|
+
# @param [Array<String>] paths the changes files or paths
|
89
|
+
# @raise [:task_has_failed] when run_on_modifications has failed
|
90
|
+
# @return [Object] the task result
|
91
|
+
#
|
92
|
+
def run_on_modifications(paths)
|
93
|
+
reload
|
94
|
+
end
|
95
|
+
|
96
|
+
# Called on file(s) removals that the Guard plugin watches.
|
97
|
+
#
|
98
|
+
# @param [Array<String>] paths the changes files or paths
|
99
|
+
# @raise [:task_has_failed] when run_on_removals has failed
|
100
|
+
# @return [Object] the task result
|
101
|
+
#
|
102
|
+
def run_on_removals(paths)
|
103
|
+
reload
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-faktory_worker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aaron Namba
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: guard-compat
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- aaron@aaronnamba.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- CHANGELOG.md
|
36
|
+
- CODE_OF_CONDUCT.md
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- guard-faktory_worker.gemspec
|
42
|
+
- lib/guard/faktory_worker.rb
|
43
|
+
- lib/guard/faktory_worker/templates/Guardfile
|
44
|
+
homepage: https://github.com/anamba/guard-faktory_worker
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata:
|
48
|
+
homepage_uri: https://github.com/anamba/guard-faktory_worker
|
49
|
+
source_code_uri: https://github.com/anamba/guard-faktory_worker
|
50
|
+
changelog_uri: https://github.com/anamba/guard-faktory_worker/CHANGELOG.md
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.3.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Guard plugin for faktory-worker
|
70
|
+
test_files: []
|