guard-rack 2.2.1 → 2.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53c0864f391556b9e375ed32de234b7022ca68b7227bad2a2c3ccf5c5ddf9789
4
- data.tar.gz: 40fb4b8846aaff09318f9d7569ac5e9c26ab04be5145ce2ae308aa71fb31f10b
3
+ metadata.gz: 05f2e1504f73881d347763d9021b745c57518ffa604dddf3a918daea30a1b523
4
+ data.tar.gz: cfbe859ebf707a14b93f12c074267acaa7c99de10d7fb14299bb873bb5c4212c
5
5
  SHA512:
6
- metadata.gz: 462a0378b92a5f30293bc83b332713e7383140a44ba38799134e3eaf2ce8251a49176d627fd342b366129c5ceb98bd401d885ef3b937192bcc2dc5ab5a6f928f
7
- data.tar.gz: 1f3fbb06a298748deca9ae015c5c7f02ddf93378010b3aa7438f3f3d0276f958485a07c90bd79072de2141069e84b677b9daf9bd9d8c64a4d910430867bd96c5
6
+ metadata.gz: 5509ae636f9b6db505c56380d398a88d71869b7bb5f0b0f69251a5a8c7308dc412e5f8e63edbd68b0f4518127fe42f6c43b472af563d977f376e39a6c8f1fa1c
7
+ data.tar.gz: 4aca9fede5ca9660cb46334d128f77d14eb9483ec90cfcf872ebc16dff3fb3b7b681fe446af45476bfc20035bf5cc5c603e8fba24fd7b55f68c7218b7cb0223d
@@ -0,0 +1,29 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ lint:
17
+ name: Lint Code and Documentation
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 10
20
+ steps:
21
+ - name: Check Out Code
22
+ uses: actions/checkout@v7
23
+ - name: Set Up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: '4.0'
27
+ bundler-cache: true
28
+ - name: Run Lint
29
+ run: bundle exec rake lint
@@ -0,0 +1,27 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: Optional release version overriding the checked-in version.
8
+ type: string
9
+ required: false
10
+ dry-run:
11
+ description: Check release prerequisites, such as RubyGems Trusted Publishing, without releasing.
12
+ type: boolean
13
+ default: false
14
+
15
+ permissions:
16
+ contents: write
17
+ id-token: write
18
+
19
+ jobs:
20
+ release:
21
+ if: github.repository == 'dblock/guard-rack' && github.ref == 'refs/heads/master'
22
+ uses: dblock/ruby-gem-release/.github/workflows/release.yml@v0.9.0
23
+ with:
24
+ ruby-version: '3.3'
25
+ version: ${{ inputs.version }}
26
+ dry-run: ${{ inputs.dry-run }}
27
+ test: bundle exec rake lint spec
@@ -0,0 +1,37 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ concurrency:
9
+ group: ${{ github.workflow }}-${{ github.ref }}
10
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ test:
17
+ name: Test (Ruby ${{ matrix.entry.ruby }})
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 10
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ entry:
24
+ - { ruby: '2.7' }
25
+ - { ruby: '3.4' }
26
+ - { ruby: '4.0' }
27
+ - { ruby: jruby }
28
+ steps:
29
+ - name: Check Out Code
30
+ uses: actions/checkout@v7
31
+ - name: Set Up Ruby
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.entry.ruby }}
35
+ bundler-cache: true
36
+ - name: Run Tests
37
+ run: bundle exec rake spec
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ pkg/*
5
5
  .rvmrc
6
6
  .redcar
7
7
 
8
+ /vendor/bundle/
data/.rubocop.yml CHANGED
@@ -1,7 +1,26 @@
1
+ plugins:
2
+ - rubocop-md
3
+ - rubocop-prose
4
+ - rubocop-rake
5
+ - rubocop-spellcheck
6
+ - rubocop-yaml
7
+
8
+ inherit_from: ".rubocop_todo.yml"
9
+
1
10
  AllCops:
11
+ NewCops: enable
12
+ TargetRubyVersion: 2.7
13
+ SuggestExtensions: false
14
+ inherit_mode:
15
+ merge:
16
+ - Include
17
+ Include:
18
+ - ".github/**/*.yml"
19
+ - ".rubocop.yml"
2
20
  Exclude:
3
- - vendor/**
4
- - bin/**
21
+ - bin/**/*
22
+ - pkg/**/*
23
+ - vendor/**/*
5
24
 
6
25
  Metrics:
7
26
  Enabled: false
@@ -9,4 +28,68 @@ Metrics:
9
28
  Style/Documentation:
10
29
  Enabled: false
11
30
 
12
- inherit_from: .rubocop_todo.yml
31
+ YAML/Lint/InvalidSyntax:
32
+ Include:
33
+ - "**/*.yml"
34
+ - "**/*.yaml"
35
+
36
+ YAML/Lint/DuplicateKey:
37
+ Include:
38
+ - "**/*.yml"
39
+ - "**/*.yaml"
40
+
41
+ Naming/FileName:
42
+ inherit_mode:
43
+ merge:
44
+ - Exclude
45
+ Exclude:
46
+ - "**/*.md"
47
+ - ".github/workflows/*.yml"
48
+
49
+ Layout/LineLength:
50
+ inherit_mode:
51
+ merge:
52
+ - Exclude
53
+ Exclude:
54
+ - ".github/workflows/*.yml"
55
+
56
+ Markdown/HeadingCapitalization:
57
+ inherit_mode:
58
+ merge:
59
+ - Exclude
60
+ Enabled: true
61
+ Style: title_case
62
+ Exclude:
63
+ - CHANGELOG.md
64
+
65
+ Prose/MaxLength:
66
+ inherit_mode:
67
+ merge:
68
+ - Exclude
69
+ Max: false
70
+ Exclude:
71
+ - CHANGELOG.md
72
+ # The license text is kept verbatim.
73
+ - LICENSE.md
74
+
75
+ Spellcheck:
76
+ DictionaryFiles:
77
+ en:
78
+ - gem:rubocop-spellcheck/data/en/en.dic
79
+ - ".spellcheck.txt"
80
+ Spellcheck/Spelling:
81
+ Exclude: []
82
+
83
+ Markdown/CompactLists:
84
+ inherit_mode:
85
+ merge:
86
+ - Exclude
87
+ Exclude:
88
+ - CHANGELOG.md
89
+
90
+ Markdown/FenceLanguage:
91
+ inherit_mode:
92
+ merge:
93
+ - Exclude
94
+ Exclude:
95
+ - CHANGELOG.md
data/.rubocop_todo.yml CHANGED
@@ -1,23 +1,83 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2019-04-30 10:21:07 -0400 using RuboCop version 0.68.0.
2
+ # `rubocop --auto-gen-config --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp`
3
+ # using RuboCop version 1.92.3.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
9
+ # This cop supports safe autocorrection (--autocorrect).
10
+ Gemspec/RequireMFA:
11
+ Exclude:
12
+ - 'guard-rack.gemspec'
13
+
14
+ Gemspec/RequiredRubyVersion:
15
+ Exclude:
16
+ - 'guard-rack.gemspec'
17
+
18
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
19
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
11
20
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
12
21
  Naming/FileName:
13
22
  Exclude:
14
23
  - 'lib/guard-rack.rb'
15
24
 
16
- # Offense count: 1
17
- # Cop supports --auto-correct.
18
- # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
25
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
26
+ # AllowedMethods: call
27
+ # WaywardPredicates: infinite?, nonzero?
28
+ Naming/PredicateMethod:
29
+ Exclude:
30
+ - 'lib/guard/rack/runner.rb'
31
+
32
+ # This cop supports unsafe autocorrection (--autocorrect-all).
33
+ # Configuration parameters: EnforcedStyle.
34
+ # SupportedStyles: always, always_true, never
35
+ Style/FrozenStringLiteralComment:
36
+ Exclude:
37
+ - 'Gemfile'
38
+ - 'Guardfile'
39
+ - 'Rakefile'
40
+ - 'guard-rack.gemspec'
41
+ - 'lib/guard-rack.rb'
42
+ - 'lib/guard/rack.rb'
43
+ - 'lib/guard/rack/command.rb'
44
+ - 'lib/guard/rack/custom_process.rb'
45
+ - 'lib/guard/rack/runner.rb'
46
+ - 'lib/guard/rack/templates/Guardfile'
47
+ - 'lib/guard/rack/version.rb'
48
+ - 'spec/lib/guard/integration.ru'
49
+ - 'spec/lib/guard/integration_spec.rb'
50
+ - 'spec/lib/guard/process_spec.rb'
51
+ - 'spec/lib/guard/rack/command_spec.rb'
52
+ - 'spec/lib/guard/rack_spec.rb'
53
+ - 'spec/lib/guard/runner_spec.rb'
54
+ - 'spec/spec_helper.rb'
55
+
56
+ # This cop supports unsafe autocorrection (--autocorrect-all).
57
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
19
58
  # SupportedStyles: predicate, comparison
20
59
  Style/NumericPredicate:
21
60
  Exclude:
22
- - 'spec/**/*'
23
61
  - 'lib/guard/rack/custom_process.rb'
62
+ - 'spec/lib/guard/integration_spec.rb'
63
+
64
+ # Configuration parameters: AllowedMethods.
65
+ # AllowedMethods: respond_to_missing?
66
+ Style/OptionalBooleanParameter:
67
+ Exclude:
68
+ - 'lib/guard/rack/custom_process.rb'
69
+ - 'lib/guard/rack/runner.rb'
70
+
71
+ # This cop supports unsafe autocorrection (--autocorrect-all).
72
+ # Configuration parameters: Methods.
73
+ Style/RedundantArgument:
74
+ Exclude:
75
+ - 'lib/guard/rack/runner.rb'
76
+
77
+ # This cop supports safe autocorrection (--autocorrect).
78
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
79
+ # URISchemes: http, https
80
+ # AllowedPatterns: (?-mix:^\#)
81
+ Layout/LineLength:
82
+ Exclude:
83
+ - 'lib/guard/rack.rb'
data/.spellcheck.txt ADDED
@@ -0,0 +1,41 @@
1
+ Bundler
2
+ CHANGELOG
3
+ config
4
+ cristianbica
5
+ daemonize
6
+ dblock
7
+ Doubrovkine
8
+ env
9
+ ffi
10
+ Gemfile
11
+ gemspec
12
+ GuardRackRelease
13
+ html
14
+ jdurand
15
+ jonyeezs
16
+ JRuby
17
+ jwhitcraft
18
+ kgfullerton
19
+ linter
20
+ md
21
+ MERCHANTABILITY
22
+ michaelherold
23
+ namespace
24
+ Nerian
25
+ NONINFRINGEMENT
26
+ pid
27
+ rackup
28
+ Rakefile
29
+ rb
30
+ README
31
+ rspec
32
+ ru
33
+ rubocop
34
+ rubycut
35
+ RubyGems
36
+ spawner
37
+ sublicense
38
+ taskkill
39
+ tombh
40
+ UI
41
+ YAML
data/CHANGELOG.md CHANGED
@@ -1,67 +1,63 @@
1
- 2.2.1 (4/30/2019)
2
- =================
1
+ ### 2.3.0 (2026/11/25)
2
+
3
+ * [#30](https://github.com/dblock/guard-rack/pull/30): Replaced Travis CI with GitHub Actions, tested with Ruby 2.7 through 4.0 and JRuby, fixed compatibility with current Guard, Rack and RuboCop, and fixed `Guard::Rack::CustomProcess::Windows#kill` failing because `English` was not loaded - [@dblock](https://github.com/dblock).
4
+ * [#31](https://github.com/dblock/guard-rack/pull/31): Lint Markdown, YAML, and spelling with rubocop-md, rubocop-prose, rubocop-spellcheck, and rubocop-yaml in a separate Lint workflow, and clean up documentation - [@dblock](https://github.com/dblock).
5
+ * [#32](https://github.com/dblock/guard-rack/pull/32): Run CI pushes only on the default branch, cancel superseded pull request runs, skip duplicate lint in the test matrix, and bound job times - [@dblock](https://github.com/dblock).
6
+ * [#34](https://github.com/dblock/guard-rack/pull/34): Release with ruby-gem-release through a manually dispatched GitHub Actions workflow and RubyGems Trusted Publishing - [@dblock](https://github.com/dblock).
7
+ * [#35](https://github.com/dblock/guard-rack/pull/35): Fixed Rack not restarting after a change that follows a failed start, such as a syntax error in `config.ru` - [@dblock](https://github.com/dblock).
8
+
9
+ ### 2.2.1 (2019/4/30)
3
10
 
4
11
  * [#24](https://github.com/dblock/guard-rack/pull/24): Use absolute module namespace to prevent conflict with Guard::Process - [@cristianbica](https://github.com/cristianbica).
5
12
 
6
- 2.2.0 (4/16/2016)
7
- =================
13
+ ### 2.2.0 (2016/4/16)
8
14
 
9
15
  * [#23](https://github.com/dblock/guard-rack/pull/23): Added Windows support - [@jonyeezs](https://github.com/jonyeezs).
10
16
 
11
- 2.1.1 (03/07/2015)
12
- ============
17
+ ### 2.1.1 (2015/03/07)
13
18
 
14
19
  * Fixed an issue with the command syntax that was preventing the spawner from running - [@michaelherold](https://github.com/michaelherold).
15
20
 
16
- 2.1.0 (03/06/2015)
17
- ============
21
+ ### 2.1.0 (2015/03/06)
18
22
 
19
23
  * [#17](https://github.com/dblock/guard-rack/pull/17): Added ability to specify host - [@jwhitcraft](https://github.com/jwhitcraft).
20
24
  * [#18](https://github.com/dblock/guard-rack/pull/18): Removed explicit dependencies on notification libraries, relying instead on Guard's default behavior - [@michaelherold](https://github.com/michaelherold).
21
25
  * [#19](https://github.com/dblock/guard-rack/pull/19): Added the ability to specify the command for mounting the Rack application - [@michaelherold](https://github.com/michaelherold).
22
26
 
23
- 2.0.0 (11/15/2014)
24
- ==================
27
+ ### 2.0.0 (2014/11/15)
25
28
 
26
29
  * Upgraded to Guard 2.x - [@jdurand](https://github.com/jdurand).
27
30
  * Upgraded RuboCop to 0.27.1 - [@dblock](https://github.com/dblock).
28
31
  * Upgraded RSpec to 3.x - [@dblock](https://github.com/dblock).
29
32
 
30
- 1.4.0 (1/28/2014)
31
- =================
33
+ ### 1.4.0 (2014/1/28)
32
34
 
33
35
  * Ruby 1.8.7 and 1.9.2 are no longer supported - [@dblock](https://github.com/dblock).
34
- * Implemented Rubocop, Ruby linter - [@dblock](https://github.com/dblock).
36
+ * Implemented RuboCop, Ruby linter - [@dblock](https://github.com/dblock).
35
37
  * [#13](https://github.com/dblock/guard-rack/pull/13): Fix: do not lock a specific version of Rack - [@Nerian](https://github.com/Nerian).
36
38
 
37
- 1.3.1 (1/16/2013)
38
- =================
39
+ ### 1.3.1 (2013/1/16)
39
40
 
40
41
  * [#12](https://github.com/dblock/guard-rack/issues/12): Fix: could not load 'guard/rack', added missing `ffi` into Gemfile - [@dblock](https://github.com/dblock).
41
42
 
42
- 1.3 (1/15/2013)
43
- ===============
43
+ ### 1.3 (2013/1/15)
44
44
 
45
45
  * [#11](https://github.com/dblock/guard-rack/pull/11): Use [spoon](https://github.com/headius/spoon) instead of `system()`, removes the need for `.pid` files - [@viking](https://github.com/viking), [@dblock](https://github.com/dblock).
46
46
 
47
- 1.2.2 (12/19/2012)
48
- ==================
47
+ ### 1.2.2 (2012/12/19)
49
48
 
50
49
  * [#10](https://github.com/dblock/guard-rack/pull/10): Added ability to specify rackup config - [@kgfullerton](https://github.com/kgfullerton).
51
50
 
52
- 1.2.1 (6/31/2012)
53
- =================
51
+ ### 1.2.1 (2012/6/31)
54
52
 
55
53
  * [#9](https://github.com/dblock/guard-rack/pull/3): Added ability to specify server - [@rubycut](https://github.com/rubycut).
56
54
 
57
- 1.1 (06/06/2012)
58
- ================
55
+ ### 1.1 (2012/06/06)
59
56
 
60
57
  * Now requires Guard 1.1.
61
58
  * [#3](https://github.com/dblock/guard-rack/pull/3): Changed kill signal from `KILL` to `INT` - [@tombh](https://github.com/tombh).
62
59
  * [#4](https://github.com/dblock/guard-rack/pull/4): Changed deprecated `run_on_change` to `run_on_changes` - [@tombh](https://github.com/tombh).
63
60
 
64
- 1.0 (02/27/2012)
65
- ================
61
+ ### 1.0 (2012/02/27)
66
62
 
67
63
  * Initial public release - [@dblock](https://github.com/dblock).
data/Gemfile CHANGED
@@ -1,16 +1,29 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'ffi'
6
- gem 'guard', '~> 2.3.0'
7
- gem 'spoon'
8
-
9
5
  group :development, :test do
10
- gem 'growl'
11
- gem 'guard-rspec', '~> 4.2.5'
12
- gem 'rb-fchange', require: false
13
- gem 'rb-fsevent', require: false
14
- gem 'rb-inotify', require: false
15
- gem 'rubocop', '0.68.0'
6
+ gem 'fakefs'
7
+ gem 'guard-rspec'
8
+ gem 'mocha'
9
+ gem 'rack'
10
+ gem 'rackup'
11
+ gem 'rake'
12
+ gem 'rspec'
13
+ gem 'webrick'
14
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3')
15
+ gem 'rubocop', '~> 1.92'
16
+ gem 'rubocop-md', '~> 3.0', require: false
17
+ gem 'rubocop-prose', '~> 0.2', require: false
18
+ gem 'rubocop-rake', '~> 0.7', require: false
19
+ gem 'rubocop-spellcheck', '~> 0.2', require: false
20
+ gem 'rubocop-yaml', '~> 0.1.0', require: false
21
+ end
22
+ end
23
+
24
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3')
25
+ group :development do
26
+ gem 'commonmarker', '~> 2.10', require: false
27
+ gem 'ruby-gem-release', '0.9.0', require: false
28
+ end
16
29
  end
data/README.md CHANGED
@@ -1,42 +1,39 @@
1
- Guard::Rack
2
- ===========
1
+ # Guard::Rack
3
2
 
4
- [![Gem Version](http://img.shields.io/gem/v/guard-rack.svg)](http://badge.fury.io/rb/guard-rack)
5
- [![Build Status](http://img.shields.io/travis/dblock/guard-rack.svg)](https://travis-ci.org/dblock/guard-rack)
6
- [![Dependency Status](https://gemnasium.com/dblock/guard-rack.svg)](https://gemnasium.com/dblock/guard-rack)
7
- [![Code Climate](https://codeclimate.com/github/dblock/guard-rack.svg)](https://codeclimate.com/github/dblock/guard-rack)
3
+ [![Gem Version](https://img.shields.io/gem/v/guard-rack.svg)](https://badge.fury.io/rb/guard-rack) [![Test](https://github.com/dblock/guard-rack/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/dblock/guard-rack/actions/workflows/test.yml)
8
4
 
9
- Want to restart your Rack development with *rackup* whilst you work? Now you can!
5
+ Want to restart your Rack development with `rackup` whilst you work? Now you can!
10
6
 
11
- guard 'rack', :port => 9292 do
12
- watch('Gemfile.lock')
13
- watch(%r{^(config|lib|app)/.*})
14
- end
7
+ ```ruby
8
+ guard 'rack', port: 9292 do
9
+ watch('Gemfile.lock')
10
+ watch(%r{^(config|lib|app)/.*})
11
+ end
12
+ ```
15
13
 
16
- Options
17
- -------
14
+ ## Options
18
15
 
19
16
  * `:cmd` is the command to run to mount the Rack application (default `rackup`).
20
- * `:host` is the host ip address to run on (default `0.0.0.0`).
17
+ * `:host` is the host IP address to run on (default `0.0.0.0`).
21
18
  * `:port` is the port number to run on (default `9292`).
22
19
  * `:environment` is the environment to use (default `development`).
23
20
  * `:start_on_start` will start the server when starting Guard (default `true`).
24
21
  * `:force_run` kills any process that's holding open the listen port before attempting to (re)start Rack (default `false`).
25
22
  * `:daemon` runs the server as a daemon, without any output to the terminal that ran `guard` (default `false`).
26
- * `:debugger` runs the server with the debugger enabled (default `false`). Required ruby-debug gem.
23
+ * `:debugger` runs the server with the debugger enabled (default `false`). Requires the `ruby-debug` gem.
27
24
  * `:timeout` waits this number of seconds when restarting the Rack server before reporting there's a problem (default `20`).
28
25
  * `:server` serve using server (one of `webrick`, `mongrel` or `thin`).
29
26
  * `:config` run the specified rackup file (default `config.ru`).
30
27
 
31
- Contributing
32
- ------------
28
+ ## Contributing
33
29
 
34
30
  Fork the project. Make your feature addition or bug fix with tests. Send a pull request. Bonus points for topic branches.
35
31
 
36
- Copyright and License
37
- ---------------------
32
+ * [CHANGELOG](CHANGELOG.md)
33
+ * [RELEASING](RELEASING.md)
38
34
 
39
- MIT License, see [LICENSE](http://github.com/dblock/guard-rack/raw/master/LICENSE.md) for details.
35
+ ## Copyright and License
40
36
 
41
- (c) 2012-2019 [Daniel Doubrovkine](http://github.com/dblock) and [Contributors](https://github.com/dblock/guard-rack/graphs/contributors).
37
+ MIT License, see [LICENSE](LICENSE.md) for details.
42
38
 
39
+ (c) 2012-2019 [Daniel Doubrovkine](https://github.com/dblock) and [Contributors](https://github.com/dblock/guard-rack/graphs/contributors).
data/RELEASING.md CHANGED
@@ -1,71 +1,39 @@
1
- Releasing Guard-Rack
2
- ====================
1
+ # Releasing Guard-Rack
3
2
 
4
- There're no particular rules about when to release guard-rack. Release bug fixes frequenty, features not so frequently and breaking API changes rarely.
3
+ There are no particular rules about when to release guard-rack. Release bug fixes frequently, features not so frequently, and breaking API changes rarely.
5
4
 
6
- ### Release
5
+ Releases use [ruby-gem-release](https://github.com/dblock/ruby-gem-release) 0.9.0 through a manually dispatched [Release workflow](.github/workflows/release.yml). Keep the `ruby-gem-release` gem in [Gemfile](Gemfile) and the reusable workflow in `release.yml` pinned to the same version. The workflow publishes through RubyGems Trusted Publishing, so no RubyGems API key or one-time password is needed. It only runs from `master` in `dblock/guard-rack`. The local Bundler `rake release`, `release:rubygem_push`, and `release:source_control_push` tasks are disabled.
7
6
 
8
- Run tests, check that all tests succeed locally.
7
+ ## One-Time Setup
9
8
 
10
- ```
11
- bundle install
12
- rake
13
- ```
14
-
15
- Check that the current master branch can successfully run [grape-on-rack](https://github.com/dblock/grape-on-rack).
16
-
17
- Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/guard-rack) for all supported platforms.
18
-
19
- Increment the version, modify [lib/guard/rack/version.rb](lib/guard/rack/version.rb).
9
+ Before the first automated release, a maintainer must:
20
10
 
21
- * Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.5.1` to `0.5.2`).
22
- * Increment the second number if the release contains major features or breaking API changes (eg. change `0.5.1` to `0.2.0`).
11
+ 1. Create the GitHub environment `release` in `dblock/guard-rack`, for example with `gh api --method PUT repos/dblock/guard-rack/environments/release`, and restrict its deployment branches to `master`. Add required reviewers to require maintainer approval before publication.
12
+ 2. At the [trusted publishers for guard-rack](https://rubygems.org/gems/guard-rack/trusted_publishers), add a GitHub Actions publisher with repository owner `dblock`, repository `guard-rack`, workflow filename `release.yml`, environment `release`, and the separate workflow repository owner `dblock` and repository `ruby-gem-release`.
13
+ 3. Allow GitHub Actions to push release commits and `v*` tags to `master`. See the upstream [setup and permissions guidance](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/RELEASING.md#one-time-setup).
23
14
 
24
- Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version.
15
+ Verify the setup without publishing with a [dry run](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/actions/release.md#dry-run), which never edits files, builds, pushes, or publishes:
25
16
 
26
- ```
27
- 0.2.0 (2014-01-27)
28
- ==================
17
+ ```sh
18
+ gh workflow run release.yml --repo dblock/guard-rack --ref master -f dry-run=true
29
19
  ```
30
20
 
31
- Remove the line with "Your contribution here.", since there will be no more contributions to this release.
21
+ ## Prepare
32
22
 
33
- Commit your changes.
23
+ Start with a clean, up-to-date `master` and verify that the latest [CI checks](https://github.com/dblock/guard-rack/actions) pass for all supported Ruby versions. Check that the current `master` can successfully run [grape-on-rack](https://github.com/dblock/grape-on-rack). Follow semantic versioning: patch for fixes, minor for backward-compatible features, major for breaking changes. Check `VERSION` in [lib/guard/rack/version.rb](lib/guard/rack/version.rb) and the matching `(Next)` heading in [CHANGELOG.md](CHANGELOG.md), and change both in a pull request if needed, or pass a `version` override when dispatching.
34
24
 
35
- ```
36
- git add CHANGELOG.md lib/guard/rack/version.rb
37
- git commit -m "Preparing for release, 0.2.0."
38
- git push origin master
39
- ```
25
+ The workflow dates the `(Next)` heading using `YYYY/MM/DD` and removes the `* Your contribution here.` placeholder; a section without notes cannot be released.
40
26
 
41
- Release.
27
+ Release automation requires MRI Ruby 3.3 or newer; the release dependency and tasks are skipped on older Ruby versions and JRuby. Release specs in [spec/release](spec/release) run the actual release tasks against a local fixture with the [ruby-gem-release RSpec helpers](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/testing.md), without contacting RubyGems or GitHub.
42
28
 
43
- ```
44
- $ rake release
29
+ ## Publish
45
30
 
46
- guard-rack 0.2.0 built to pkg/guard-rack-0.2.0.gem.
47
- Tagged v0.2.0.
48
- Pushed git commits and tags.
49
- Pushed guard-rack 0.2.0 to rubygems.org.
31
+ ```sh
32
+ gh workflow run release.yml --repo dblock/guard-rack --ref master
50
33
  ```
51
34
 
52
- ### Prepare for the Next Version
35
+ Pass `-f version=x.y.z` to release a different version. Dispatching starts a real release; do not merge into `master` while it runs. The workflow prepares the release commit, runs lint and specs on Ruby 3.3, builds the gem, preserves recovery artifacts, publishes to RubyGems, pushes the release commit and `v` tag, and creates a GitHub Release with the changelog notes and the gem attached. It then increments the patch version, adds a new `(Next)` section, and pushes the next development commit. Verify the published version on [RubyGems](https://rubygems.org/gems/guard-rack), the tag, the [GitHub Release](https://github.com/dblock/guard-rack/releases), and the next development commit.
53
36
 
54
- Add the next release to [CHANGELOG.md](CHANGELOG.md).
37
+ ## Recover a Partial Release
55
38
 
56
- ```
57
- Next Release
58
- ============
59
-
60
- * Your contribution here.
61
- ```
62
-
63
- Increment the minor version, modify [lib/guard/rack/version.rb](lib/guard/rack/version.rb).
64
-
65
- Comit your changes.
66
-
67
- ```
68
- git add CHANGELOG.md lib/guard/rack/version.rb
69
- git commit -m "Preparing for next release, 0.2.1."
70
- git push origin master
71
- ```
39
+ Inspect the failed run, RubyGems, remote commits and tags, and the GitHub Release before retrying. Publication may have succeeded even if a later step failed. Never move a published tag or republish a version with different contents. Use the run's retained recovery artifacts and the upstream [recovery instructions](https://github.com/dblock/ruby-gem-release/blob/v0.9.0/docs/actions/release.md#recovery-artifacts).
data/Rakefile CHANGED
@@ -12,6 +12,18 @@ rescue Bundler::BundlerError => e
12
12
  end
13
13
 
14
14
  require 'rake'
15
+
16
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
17
+ Gem.loaded_specs.key?('ruby-gem-release')
18
+ require_relative 'script/release'
19
+ GuardRackRelease.workflow.install_tasks
20
+
21
+ %w[release release:rubygem_push release:source_control_push].each do |name|
22
+ Rake::Task[name].clear
23
+ desc 'Disabled; releases run through GitHub Actions, see RELEASING.md'
24
+ task(name) { abort "#{name} is disabled; releases run through GitHub Actions, see RELEASING.md" }
25
+ end
26
+ end
15
27
  require 'rspec/core'
16
28
  require 'rspec/core/rake_task'
17
29
 
@@ -19,8 +31,14 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
19
31
  spec.pattern = FileList['spec/**/*_spec.rb']
20
32
  end
21
33
 
22
- require 'rainbow/ext/string' unless String.respond_to?(:color)
23
- require 'rubocop/rake_task'
24
- RuboCop::RakeTask.new(:rubocop)
34
+ lint = RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
35
+ Gem.loaded_specs.key?('rubocop')
36
+ if lint
37
+ require 'rubocop/rake_task'
38
+ RuboCop::RakeTask.new(:rubocop)
39
+
40
+ desc 'Lint Ruby, Markdown, YAML, and spelling'
41
+ task lint: :rubocop
42
+ end
25
43
 
26
- task default: %i[rubocop spec]
44
+ task default: lint ? %i[rubocop spec] : %i[spec]
data/guard-rack.gemspec CHANGED
@@ -17,16 +17,4 @@ Gem::Specification.new do |gem|
17
17
  gem.add_dependency 'ffi'
18
18
  gem.add_dependency 'guard', '~> 2.3'
19
19
  gem.add_dependency 'spoon'
20
-
21
- gem.add_development_dependency 'bundler'
22
- gem.add_development_dependency 'fakefs'
23
- gem.add_development_dependency 'mocha', '~> 1.1'
24
- gem.add_development_dependency 'rake', '< 11'
25
- gem.add_development_dependency 'rspec', '~> 3.0'
26
-
27
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.0')
28
- gem.add_development_dependency 'rack', '< 2'
29
- else
30
- gem.add_development_dependency 'rack', '~> 2'
31
- end
32
20
  end
@@ -1,3 +1,4 @@
1
+ require 'English'
1
2
  require 'timeout'
2
3
 
3
4
  module Guard
@@ -31,8 +31,11 @@ module Guard
31
31
  true
32
32
  end
33
33
 
34
+ # Starts a new process even if stopping the previous one reported an error,
35
+ # for example when rackup had already exited because of a syntax error in config.ru.
34
36
  def restart
35
- stop && start
37
+ stop
38
+ start
36
39
  end
37
40
 
38
41
  private
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RackVersion
3
- VERSION = '2.2.1'.freeze
3
+ VERSION = '2.3.0'.freeze
4
4
  end
5
5
  end
data/script/release.rb ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-gem-release/changelog'
4
+ require 'ruby-gem-release/workflow/ruby_gem'
5
+
6
+ # Builds the ruby-gem-release workflow used by the Rakefile, the Release GitHub Actions workflow, and spec/release.
7
+ module GuardRackRelease
8
+ def self.workflow(**options)
9
+ RubyGemRelease::Workflow::RubyGem.new(
10
+ version: RubyGemRelease::Version::RubyConstant.new(path: 'lib/guard/rack/version.rb', constant: 'VERSION'),
11
+ changelog: RubyGemRelease::Changelog::Intridea.new(placeholder: '* Your contribution here.'),
12
+ **options
13
+ )
14
+ end
15
+ end
@@ -95,7 +95,8 @@ describe Guard::Rack::CustomProcess do
95
95
  describe 'kill' do
96
96
  context 'successful exit status' do
97
97
  before do
98
- $CHILD_STATUS.stubs(:exitstatus).returns 0
98
+ # sets $CHILD_STATUS to a successful exit status
99
+ Kernel.system('true')
99
100
  end
100
101
 
101
102
  it 'should result in 0' do
@@ -111,4 +111,38 @@ describe Guard::RackRunner do
111
111
  end
112
112
  end
113
113
  end
114
+
115
+ describe '#restart' do
116
+ let(:pid) { 123_45 }
117
+ let(:new_pid) { 678_90 }
118
+ let(:process) { Guard::Rack::CustomProcess.stubs(:new) }
119
+
120
+ before do
121
+ Guard::UI.stubs(:info)
122
+ runner.stubs(:spawn).returns(pid, new_pid)
123
+ runner.start
124
+ end
125
+
126
+ context 'rackup exits successfully' do
127
+ before do
128
+ process.returns(stub(kill: 0))
129
+ end
130
+
131
+ it 'starts a new process' do
132
+ expect(runner.restart).to be_truthy
133
+ expect(runner.pid).to eq(new_pid)
134
+ end
135
+ end
136
+
137
+ context 'rackup already exited with an error, for example on a syntax error in config.ru' do
138
+ before do
139
+ process.returns(stub(kill: 1))
140
+ end
141
+
142
+ it 'still starts a new process' do
143
+ expect(runner.restart).to be_truthy
144
+ expect(runner.pid).to eq(new_pid)
145
+ end
146
+ end
147
+ end
114
148
  end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ if RUBY_ENGINE == 'ruby' && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.3') &&
4
+ Gem.loaded_specs.key?('ruby-gem-release')
5
+ require_relative '../../script/release'
6
+ require 'ruby-gem-release/rspec'
7
+
8
+ RSpec.describe GuardRackRelease do
9
+ include RubyGemRelease::RSpec
10
+
11
+ let(:root) { File.expand_path('../..', __dir__) }
12
+ let(:version_path) { 'lib/guard/rack/version.rb' }
13
+ let(:fixture_files) do
14
+ %w[guard-rack.gemspec script/release.rb lib/**/*.rb CHANGELOG.md LICENSE.md README.md RELEASING.md]
15
+ end
16
+ let(:placeholder) { '* Your contribution here.' }
17
+ let(:note) { '* [#1](https://github.com/dblock/guard-rack/pull/1): Added a feature - [@dblock](https://github.com/dblock).' }
18
+
19
+ def changelog(notes)
20
+ [
21
+ '### 1.2.0 (Next)', '', notes, placeholder, '',
22
+ '### 1.1.0 (2026/01/01)', '', '* Previous release.', ''
23
+ ].compact.join("\n")
24
+ end
25
+
26
+ def write_version(project, version)
27
+ source = File.read(File.join(root, version_path))
28
+ project.write(version_path, source.sub(/VERSION = (['"])[^'"]+\1/, "VERSION = '#{version}'"))
29
+ end
30
+
31
+ def with_project(notes)
32
+ with_release_project do |project|
33
+ project.copy_files(path: root, files: fixture_files)
34
+ project.configure_workflow(require: 'script/release', builder: 'GuardRackRelease.workflow')
35
+ project.write('CHANGELOG.md', changelog(notes))
36
+ write_version(project, '1.2.0')
37
+ project.commit!
38
+ yield project
39
+ end
40
+ end
41
+
42
+ it 'builds the standard ruby-gem-release workflow' do
43
+ expect(described_class.workflow).to be_a(RubyGemRelease::Workflow::RubyGem)
44
+ end
45
+
46
+ it 'dates the release and prepares the next patch version' do
47
+ with_project(note) do |project|
48
+ project.release!
49
+
50
+ released = project.remote_file('v1.2.0', 'CHANGELOG.md')
51
+ expect(released).to match(%r{\A### 1\.2\.0 \(\d{4}/\d{2}/\d{2}\)\n\n})
52
+ expect(released).to include(note)
53
+ expect(released).not_to include('(Next)', placeholder)
54
+ expect(project.remote_file('v1.2.0', version_path)).to include("VERSION = '1.2.0'")
55
+
56
+ pending = project.remote_file('master', 'CHANGELOG.md')
57
+ expect(pending).to start_with("### 1.2.1 (Next)\n\n#{placeholder}\n\n### 1.2.0 (")
58
+ expect(project.remote_file('master', version_path)).to include("VERSION = '1.2.1'")
59
+ expect(project.git('status', '--porcelain')).to be_empty
60
+ end
61
+ end
62
+
63
+ it 'rejects placeholder-only notes without changing files or remote refs' do
64
+ with_project(nil) do |project|
65
+ original = project.git('rev-parse', 'origin/master')
66
+ project.run_task('release:workflow:capture')
67
+ expect { project.run_task('release:validate') }.to raise_error(RuntimeError, /no pending changelog notes/)
68
+ expect(project.git('status', '--porcelain')).to be_empty
69
+ expect(project.git('rev-parse', 'origin/master')).to eq(original)
70
+ end
71
+ end
72
+ end
73
+ end
data/spec/spec_helper.rb CHANGED
@@ -7,4 +7,7 @@ require 'mocha/api'
7
7
  RSpec.configure do |c|
8
8
  c.mock_with :mocha
9
9
  c.raise_errors_for_deprecations!
10
+ c.before do
11
+ Guard.init({})
12
+ end
10
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-30 00:00:00.000000000 Z
11
+ date: 2026-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -52,90 +52,6 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
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: fakefs
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
- - !ruby/object:Gem::Dependency
84
- name: mocha
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.1'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.1'
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "<"
102
- - !ruby/object:Gem::Version
103
- version: '11'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "<"
109
- - !ruby/object:Gem::Version
110
- version: '11'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '3.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '3.0'
125
- - !ruby/object:Gem::Dependency
126
- name: rack
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '2'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '2'
139
55
  description: Automatically reloads your Rack based app on file change using Guard.
140
56
  email:
141
57
  - dblock@dblock.org
@@ -143,11 +59,14 @@ executables: []
143
59
  extensions: []
144
60
  extra_rdoc_files: []
145
61
  files:
62
+ - ".github/workflows/lint.yml"
63
+ - ".github/workflows/release.yml"
64
+ - ".github/workflows/test.yml"
146
65
  - ".gitignore"
147
66
  - ".rspec"
148
67
  - ".rubocop.yml"
149
68
  - ".rubocop_todo.yml"
150
- - ".travis.yml"
69
+ - ".spellcheck.txt"
151
70
  - CHANGELOG.md
152
71
  - Gemfile
153
72
  - Guardfile
@@ -163,18 +82,20 @@ files:
163
82
  - lib/guard/rack/runner.rb
164
83
  - lib/guard/rack/templates/Guardfile
165
84
  - lib/guard/rack/version.rb
85
+ - script/release.rb
166
86
  - spec/lib/guard/integration.ru
167
87
  - spec/lib/guard/integration_spec.rb
168
88
  - spec/lib/guard/process_spec.rb
169
89
  - spec/lib/guard/rack/command_spec.rb
170
90
  - spec/lib/guard/rack_spec.rb
171
91
  - spec/lib/guard/runner_spec.rb
92
+ - spec/release/release_spec.rb
172
93
  - spec/spec_helper.rb
173
94
  homepage: https://github.com/dblock/guard-rack
174
95
  licenses:
175
96
  - MIT
176
97
  metadata: {}
177
- post_install_message:
98
+ post_install_message:
178
99
  rdoc_options: []
179
100
  require_paths:
180
101
  - lib
@@ -189,8 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
110
  - !ruby/object:Gem::Version
190
111
  version: '0'
191
112
  requirements: []
192
- rubygems_version: 3.0.3
193
- signing_key:
113
+ rubygems_version: 3.5.22
114
+ signing_key:
194
115
  specification_version: 4
195
116
  summary: Automatically reloads your Rack based app on file change using Guard.
196
117
  test_files: []
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.4.0
5
- - 2.3.3
6
- - 2.5.3
7
- - 2.6.3
8
- - jruby
9
- - ruby-head
10
- - jruby-head
11
-
12
- matrix:
13
- allow_failures:
14
- - rvm: ruby-head
15
- - rvm: jruby-head
16
-
17
- sudo: false