config_skeleton 0.0.0.1.ENOTAG → 0.0.0.1.ge6b0cac
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +0 -2
- data/.rubocop.yml +116 -1
- data/README.md +1 -1
- data/config_skeleton.gemspec +0 -3
- data/lib/config_skeleton.rb +2 -38
- metadata +4 -47
- data/.github/workflows/ruby.yml +0 -47
- data/.rspec +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 461d7e8fa2104770057e16c2b18688bab82974dd
|
4
|
+
data.tar.gz: 1dd53059bbd9b0e21c802b95f9132f81f40b5078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85df37ce08bb7852f23d3ebe80ae602b64f336eefa66ec68ed11bdcb23df4c522fc8a056ffef6b376efeb291055e16aaf4293a0c89649c7d8d9da47737d7e258
|
7
|
+
data.tar.gz: a955d13e0faa0ad61316f87ae62f30bb64740b5aa592b4339c46b2814f948f47dd739ca109a5e28ab97d508a735959e57385adb6109e02739c2b6c9837fc86e6
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1 +1,116 @@
|
|
1
|
-
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
DisabledByDefault: true
|
4
|
+
Exclude:
|
5
|
+
- 'db/schema.rb'
|
6
|
+
- 'bundle/**/*'
|
7
|
+
- 'vendor/**/*'
|
8
|
+
- 'node_modules/**/*'
|
9
|
+
- 'public/**/*'
|
10
|
+
|
11
|
+
# Prefer &&/|| over and/or.
|
12
|
+
Style/AndOr:
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
# Do not use braces for hash literals when they are the last argument of a
|
16
|
+
# method call.
|
17
|
+
Style/BracesAroundHashParameters:
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
# Align `when` with `case`.
|
21
|
+
Layout/CaseIndentation:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
# Align comments with method definitions.
|
25
|
+
Layout/CommentIndentation:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
# No extra empty lines.
|
29
|
+
Layout/EmptyLines:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
33
|
+
Style/HashSyntax:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
# Two spaces, no tabs (for indentation).
|
37
|
+
Layout/IndentationWidth:
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Layout/SpaceAfterColon:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
Layout/SpaceAfterComma:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
Layout/SpaceAroundKeyword:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Layout/SpaceAroundOperators:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Layout/SpaceBeforeFirstArg:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
# Defining a method with parameters needs parentheses.
|
59
|
+
Style/MethodDefParentheses:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
# Use `foo {}` not `foo{}`.
|
63
|
+
Layout/SpaceBeforeBlockBraces:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
# Use `foo { bar }` not `foo {bar}`.
|
67
|
+
Layout/SpaceInsideBlockBraces:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
71
|
+
Layout/SpaceInsideHashLiteralBraces:
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Layout/SpaceInsideParens:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
# Detect hard tabs, no hard tabs.
|
78
|
+
Layout/Tab:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
# Blank lines should not have any spaces.
|
82
|
+
Layout/TrailingBlankLines:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
# No trailing whitespace.
|
86
|
+
Layout/TrailingWhitespace:
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
Lint/Debugger:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Layout/BlockAlignment:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
# Align `end` with the matching keyword or starting expression except for
|
96
|
+
# assignments, where it should be aligned with the LHS.
|
97
|
+
Layout/EndAlignment:
|
98
|
+
Enabled: true
|
99
|
+
EnforcedStyleAlignWith: variable
|
100
|
+
|
101
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
102
|
+
Lint/RequireParentheses:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Lint/ShadowingOuterLocalVariable:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Layout/MultilineMethodCallIndentation:
|
109
|
+
Enabled: true
|
110
|
+
EnforcedStyle: indented
|
111
|
+
|
112
|
+
Layout/AlignHash:
|
113
|
+
Enabled: true
|
114
|
+
|
115
|
+
Bundler/OrderedGems:
|
116
|
+
Enabled: false
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ conduct](CODE_OF_CONDUCT.md).
|
|
41
41
|
Unless otherwise stated, everything in this repo is covered by the following
|
42
42
|
copyright notice:
|
43
43
|
|
44
|
-
Copyright (C)
|
44
|
+
Copyright (C) 2018 Civilized Discourse Construction Kit, Inc.
|
45
45
|
|
46
46
|
This program is free software: you can redistribute it and/or modify it
|
47
47
|
under the terms of the GNU General Public License version 3, as
|
data/config_skeleton.gemspec
CHANGED
@@ -34,7 +34,4 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_development_dependency 'redcarpet'
|
35
35
|
s.add_development_dependency 'rubocop'
|
36
36
|
s.add_development_dependency 'yard'
|
37
|
-
s.add_development_dependency 'rspec'
|
38
|
-
s.add_development_dependency 'pry'
|
39
|
-
s.add_development_dependency 'pry-byebug'
|
40
37
|
end
|
data/lib/config_skeleton.rb
CHANGED
@@ -142,18 +142,6 @@ class ConfigSkeleton < ServiceSkeleton
|
|
142
142
|
# If you get this, someone didn't read the documentation.
|
143
143
|
class NotImplementedError < Error; end
|
144
144
|
|
145
|
-
# It is useful for consumers to manually request a config regen. An instance
|
146
|
-
# of this class is made via the regen_notifier method.
|
147
|
-
class ConfigRegenNotifier
|
148
|
-
def initialize(io_write)
|
149
|
-
@io_write = io_write
|
150
|
-
end
|
151
|
-
|
152
|
-
def trigger_regen
|
153
|
-
@io_write << "."
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
145
|
# Declare a file watch on all instances of the config generator.
|
158
146
|
#
|
159
147
|
# When you're looking to watch a file whose path is well-known and never-changing, you
|
@@ -200,18 +188,6 @@ class ConfigSkeleton < ServiceSkeleton
|
|
200
188
|
end
|
201
189
|
|
202
190
|
initialize_config_skeleton_metrics
|
203
|
-
@trigger_regen_r, @trigger_regen_w = IO.pipe
|
204
|
-
end
|
205
|
-
|
206
|
-
# Expose the write pipe which can be written to to trigger a config
|
207
|
-
# regeneration with a forced reload; a similar mechanism is used for
|
208
|
-
# shutdown but in that case writes are managed internally.
|
209
|
-
#
|
210
|
-
# Usage: config.regen_notifier.trigger_regen
|
211
|
-
#
|
212
|
-
# @return [ConfigRegenNotifier]
|
213
|
-
def regen_notifier
|
214
|
-
@regen_notifier ||= ConfigRegenNotifier.new(@trigger_regen_w)
|
215
191
|
end
|
216
192
|
|
217
193
|
# Set the config generator running.
|
@@ -233,11 +209,7 @@ class ConfigSkeleton < ServiceSkeleton
|
|
233
209
|
@terminate_r, @terminate_w = IO.pipe
|
234
210
|
|
235
211
|
loop do
|
236
|
-
if ios = IO.select(
|
237
|
-
[notifier.to_io, @terminate_r, @trigger_regen_r],
|
238
|
-
[], [],
|
239
|
-
sleep_duration.tap { |d| logger.debug(logloc) { "Sleeping for #{d} seconds" } }
|
240
|
-
)
|
212
|
+
if ios = IO.select([notifier.to_io, @terminate_r], [], [], sleep_duration.tap { |d| logger.debug(logloc) { "Sleeping for #{d} seconds" } })
|
241
213
|
if ios.first.include?(notifier.to_io)
|
242
214
|
logger.debug(logloc) { "inotify triggered" }
|
243
215
|
notifier.process
|
@@ -245,14 +217,6 @@ class ConfigSkeleton < ServiceSkeleton
|
|
245
217
|
elsif ios.first.include?(@terminate_r)
|
246
218
|
logger.debug(logloc) { "triggered by termination pipe" }
|
247
219
|
break
|
248
|
-
elsif ios.first.include?(@trigger_regen_r)
|
249
|
-
# we want to wait until everything in the backlog is read
|
250
|
-
# before proceeding so we don't run out of buffer memory
|
251
|
-
# for the pipe
|
252
|
-
while @trigger_regen_r.read_nonblock(20, nil, exception: false) != :wait_readable; end
|
253
|
-
|
254
|
-
logger.debug(logloc) { "triggered by regen pipe" }
|
255
|
-
regenerate_config(force_reload: true)
|
256
220
|
else
|
257
221
|
logger.error(logloc) { "Mysterious return from select: #{ios.inspect}" }
|
258
222
|
end
|
@@ -296,7 +260,7 @@ class ConfigSkeleton < ServiceSkeleton
|
|
296
260
|
def watch(*files)
|
297
261
|
files.each do |f|
|
298
262
|
if File.directory?(f)
|
299
|
-
notifier.watch(f, :recursive, :create, :modify, :delete, :move) { |ev| logger.info("#{logloc} watcher") { "detected #{ev.flags.join(", ")} on #{ev.watcher.path}/#{ev.
|
263
|
+
notifier.watch(f, :recursive, :create, :modify, :delete, :move) { |ev| logger.info("#{logloc} watcher") { "detected #{ev.flags.join(", ")} on #{ev.watcher.path}/#{ev.file}; regenerating config" } }
|
300
264
|
else
|
301
265
|
notifier.watch(f, :close_write) { |ev| logger.info("#{logloc} watcher") { "detected #{ev.flags.join(", ")} on #{ev.watcher.path}; regenerating config" } }
|
302
266
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: config_skeleton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.1.
|
4
|
+
version: 0.0.0.1.ge6b0cac
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -164,48 +164,6 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rspec
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: pry
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: pry-byebug
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0'
|
209
167
|
description:
|
210
168
|
email:
|
211
169
|
- matt.palmer@discourse.org
|
@@ -213,9 +171,7 @@ executables: []
|
|
213
171
|
extensions: []
|
214
172
|
extra_rdoc_files: []
|
215
173
|
files:
|
216
|
-
- ".github/workflows/ruby.yml"
|
217
174
|
- ".gitignore"
|
218
|
-
- ".rspec"
|
219
175
|
- ".rubocop.yml"
|
220
176
|
- ".yardopts"
|
221
177
|
- CODE_OF_CONDUCT.md
|
@@ -242,7 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
198
|
- !ruby/object:Gem::Version
|
243
199
|
version: 1.3.1
|
244
200
|
requirements: []
|
245
|
-
|
201
|
+
rubyforge_project:
|
202
|
+
rubygems_version: 2.5.2.1
|
246
203
|
signing_key:
|
247
204
|
specification_version: 4
|
248
205
|
summary: Dynamically generate configs and reload servers
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches:
|
13
|
-
- master
|
14
|
-
tags:
|
15
|
-
- v*
|
16
|
-
pull_request:
|
17
|
-
branches:
|
18
|
-
- master
|
19
|
-
|
20
|
-
jobs:
|
21
|
-
build:
|
22
|
-
runs-on: ubuntu-latest
|
23
|
-
|
24
|
-
steps:
|
25
|
-
- uses: actions/checkout@v2
|
26
|
-
|
27
|
-
- name: Set up Ruby
|
28
|
-
uses: ruby/setup-ruby@v1
|
29
|
-
with:
|
30
|
-
ruby-version: 2.6
|
31
|
-
- name: Install dependencies
|
32
|
-
run: bundle install
|
33
|
-
- name: Run specs
|
34
|
-
run: bundle exec rspec
|
35
|
-
|
36
|
-
publish:
|
37
|
-
if: contains(github.ref, 'refs/tags/v')
|
38
|
-
needs: build
|
39
|
-
runs-on: ubuntu-latest
|
40
|
-
|
41
|
-
steps:
|
42
|
-
- uses: actions/checkout@v2
|
43
|
-
|
44
|
-
- name: Release Gem
|
45
|
-
uses: CvX/publish-rubygems-action@master
|
46
|
-
env:
|
47
|
-
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--require spec_helper
|