typed_bus 0.0.1 → 0.1.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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +158 -4
  3. data/LICENSE +21 -0
  4. data/README.md +25 -13
  5. data/lib/typed_bus/channel.rb +170 -91
  6. data/lib/typed_bus/configuration.rb +51 -8
  7. data/lib/typed_bus/dead_letter_queue.rb +32 -8
  8. data/lib/typed_bus/delivery.rb +1 -1
  9. data/lib/typed_bus/delivery_tracker.rb +28 -19
  10. data/lib/typed_bus/message_bus.rb +55 -14
  11. data/lib/typed_bus/version.rb +1 -1
  12. data/lib/typed_bus.rb +3 -0
  13. metadata +23 -62
  14. data/.envrc +0 -1
  15. data/.github/workflows/deploy-github-pages.yml +0 -52
  16. data/.github/workflows/deploy-yard-docs.yml +0 -52
  17. data/.irbrc +0 -10
  18. data/COMMITS.md +0 -196
  19. data/Rakefile +0 -12
  20. data/docs/api/channel.md +0 -94
  21. data/docs/api/configuration.md +0 -90
  22. data/docs/api/dead-letter-queue.md +0 -52
  23. data/docs/api/delivery-tracker.md +0 -66
  24. data/docs/api/delivery.md +0 -73
  25. data/docs/api/index.md +0 -45
  26. data/docs/api/message-bus.md +0 -101
  27. data/docs/api/stats.md +0 -50
  28. data/docs/architecture/concurrency-model.md +0 -38
  29. data/docs/architecture/configuration-cascade.md +0 -76
  30. data/docs/architecture/index.md +0 -7
  31. data/docs/architecture/publish-flow.md +0 -67
  32. data/docs/assets/css/custom.css +0 -11
  33. data/docs/assets/images/typed_bus.gif +0 -0
  34. data/docs/assets/images/typed_bus.jpg +0 -0
  35. data/docs/assets/images/typed_bus.mp4 +0 -0
  36. data/docs/concepts.md +0 -47
  37. data/docs/examples/index.md +0 -37
  38. data/docs/getting-started/configuration.md +0 -87
  39. data/docs/getting-started/index.md +0 -7
  40. data/docs/getting-started/installation.md +0 -33
  41. data/docs/getting-started/quick-start.md +0 -51
  42. data/docs/guides/adaptive-throttling.md +0 -76
  43. data/docs/guides/backpressure.md +0 -58
  44. data/docs/guides/dead-letter-queues.md +0 -78
  45. data/docs/guides/delivery-and-ack.md +0 -89
  46. data/docs/guides/error-handling.md +0 -91
  47. data/docs/guides/graceful-shutdown.md +0 -75
  48. data/docs/guides/index.md +0 -13
  49. data/docs/guides/logging.md +0 -93
  50. data/docs/guides/stats-and-monitoring.md +0 -75
  51. data/docs/guides/typed-channels.md +0 -63
  52. data/docs/index.md +0 -56
  53. data/examples/00_config.rb +0 -156
  54. data/examples/01_basic_usage.rb +0 -26
  55. data/examples/02_typed_channels.rb +0 -41
  56. data/examples/03_multiple_subscribers.rb +0 -44
  57. data/examples/04_nack_and_dead_letters.rb +0 -47
  58. data/examples/05_delivery_timeout.rb +0 -44
  59. data/examples/06_backpressure.rb +0 -32
  60. data/examples/07_message_bus.rb +0 -55
  61. data/examples/08_error_handling.rb +0 -82
  62. data/examples/09_stats_and_monitoring.rb +0 -71
  63. data/examples/10_concurrent_pipeline.rb +0 -116
  64. data/examples/11_logging_basic.rb +0 -60
  65. data/examples/12_logging_failures.rb +0 -65
  66. data/examples/13_logging_backpressure.rb +0 -56
  67. data/examples/14_adaptive_throttling.rb +0 -101
  68. data/examples/README.md +0 -27
  69. data/examples/temp.md +0 -95
  70. data/mkdocs.yml +0 -183
@@ -17,11 +17,14 @@ module TypedBus
17
17
  class MessageBus
18
18
  attr_reader :stats, :config
19
19
 
20
- # @param timeout [Numeric, Symbol] delivery ACK deadline (overrides global default)
20
+ # @param timeout [Numeric, nil, Symbol] delivery ACK deadline (overrides global default)
21
21
  # @param max_pending [Integer, nil, Symbol] backpressure limit (overrides global default)
22
- # @param throttle [Float, Symbol] default throttle threshold for all channels (overrides global default)
22
+ # @param throttle [Numeric, nil, Symbol] default throttle threshold for all channels (overrides global default);
23
+ # 0 or nil = off, else strictly between 0 and 1
24
+ # @raise [ArgumentError] if max_pending or throttle is invalid
23
25
  def initialize(timeout: :use_default, max_pending: :use_default, throttle: :use_default)
24
26
  global = TypedBus.configuration
27
+ # Shallow copy is enough: fields are scalars, and the Logger is shared on purpose.
25
28
  @config = global.dup
26
29
  resolved = global.resolve(timeout: timeout, max_pending: max_pending, throttle: throttle)
27
30
  @config.timeout = resolved[:timeout]
@@ -31,7 +34,9 @@ module TypedBus
31
34
  @channels = {}
32
35
  @stats = Stats.new
33
36
  effective_throttle = @config.throttle.to_f
34
- log(:info, "message bus initialized (default_throttle=#{effective_throttle > 0 ? "#{(effective_throttle * 100).round}%" : 'off'})")
37
+ log(:info,
38
+ "message bus initialized " \
39
+ "(default_throttle=#{effective_throttle.positive? ? "#{(effective_throttle * 100).round}%" : 'off'})")
35
40
  end
36
41
 
37
42
  # Register a named channel.
@@ -40,10 +45,12 @@ module TypedBus
40
45
  # config value is used. Pass an explicit value to override for this channel.
41
46
  #
42
47
  # @param name [Symbol]
43
- # @param type [Class, nil] optional type constraint
44
- # @param timeout [Numeric, Symbol] delivery ACK deadline in seconds
48
+ # @param type [Class, Module, nil] optional type constraint
49
+ # @param timeout [Numeric, nil, Symbol] delivery ACK deadline in seconds; nil = never auto-nack
45
50
  # @param max_pending [Integer, nil, Symbol] backpressure limit
46
- # @param throttle [Float, Symbol] capacity ratio where backoff begins (0.0 = disabled)
51
+ # @param throttle [Numeric, nil, Symbol] remaining-capacity ratio where backoff begins;
52
+ # 0 or nil = off, else strictly between 0 and 1
53
+ # @raise [ArgumentError] if type, max_pending, or throttle is invalid
47
54
  # @return [Channel]
48
55
  def add_channel(name, type: nil, timeout: :use_default, max_pending: :use_default, throttle: :use_default)
49
56
  resolved = @config.resolve(timeout: timeout, max_pending: max_pending, throttle: throttle)
@@ -51,8 +58,13 @@ module TypedBus
51
58
  effective_max_pending = resolved[:max_pending]
52
59
  effective_throttle = resolved[:throttle]
53
60
 
54
- log(:info, "adding channel :#{name} (type=#{type || 'any'}, timeout=#{effective_timeout}s, max_pending=#{effective_max_pending || 'unbounded'})")
55
- channel = Channel.new(name, type: type, timeout: effective_timeout, max_pending: effective_max_pending, stats: @stats, throttle: effective_throttle)
61
+ channel = Channel.new(name, type: type, timeout: effective_timeout, max_pending: effective_max_pending,
62
+ stats: @stats, throttle: effective_throttle)
63
+ # Logged only after Channel.new has validated the arguments, so a rejected add logs nothing here.
64
+ log(:info,
65
+ "added channel :#{name} (type=#{type || 'any'}, " \
66
+ "timeout=#{effective_timeout ? "#{effective_timeout}s" : 'none'}, " \
67
+ "max_pending=#{effective_max_pending || 'unbounded'})")
56
68
  @channels[name] = channel
57
69
  channel
58
70
  end
@@ -68,19 +80,23 @@ module TypedBus
68
80
  # Publish a message to a named channel.
69
81
  # @param channel_name [Symbol]
70
82
  # @param message [Object]
83
+ # @return [DeliveryTracker, nil] the tracker, or nil when the channel has
84
+ # no subscribers and the message was dead-lettered
71
85
  def publish(channel_name, message)
72
86
  channel = fetch_channel!(channel_name)
73
- @stats.increment(:"#{channel_name}_published")
87
+ # Count before fan-out: subscribers and DLQ callbacks may read the counter.
88
+ @stats.increment(:"#{channel_name}_published") if accepts?(channel, message)
74
89
  channel.publish(message)
75
90
  end
76
91
 
77
92
  # Subscribe to a named channel.
78
93
  # The block receives a +Delivery+ object.
79
94
  # @param channel_name [Symbol]
95
+ # @raise [ArgumentError] if the channel is unknown or no block is given
80
96
  # @return [Integer] subscriber id
81
- def subscribe(channel_name, &block)
97
+ def subscribe(channel_name, &)
82
98
  channel = fetch_channel!(channel_name)
83
- channel.subscribe(&block)
99
+ channel.subscribe(&)
84
100
  end
85
101
 
86
102
  # Unsubscribe from a named channel.
@@ -123,9 +139,17 @@ module TypedBus
123
139
  end
124
140
 
125
141
  # Close all channels (graceful shutdown).
142
+ # Every channel is closed even if closing one raises (such as from an
143
+ # on_dead_letter callback); the first error is re-raised afterwards.
126
144
  def close_all
127
145
  log(:info, "closing all channels (#{@channels.size} channels)")
128
- @channels.each_value(&:close)
146
+ first_error = nil
147
+ @channels.each_value do |channel|
148
+ channel.close
149
+ rescue StandardError => error
150
+ first_error ||= error
151
+ end
152
+ raise first_error if first_error
129
153
  end
130
154
 
131
155
  # List registered channel names.
@@ -141,7 +165,8 @@ module TypedBus
141
165
  @channels.key?(name)
142
166
  end
143
167
 
144
- # Close all channels, clear DLQs, and reset stats.
168
+ # Clear every channel (pending deliveries, timeout tasks, DLQs) and reset
169
+ # stats. Channels are not closed and stay registered.
145
170
  def clear!
146
171
  log(:info, "clearing all channels and resetting stats")
147
172
  @channels.each_value(&:clear!)
@@ -152,11 +177,27 @@ module TypedBus
152
177
 
153
178
  def fetch_channel!(name)
154
179
  channel = @channels[name]
155
- raise ArgumentError, "Unknown channel: #{name}" unless channel
180
+ raise ArgumentError, unknown_channel_message(name) unless channel
156
181
 
157
182
  channel
158
183
  end
159
184
 
185
+ # Mirrors the up-front checks Channel#publish raises on. A channel that
186
+ # closes while the publisher waits on throttle or backpressure is not caught.
187
+ def accepts?(channel, message)
188
+ type = channel.type
189
+ !channel.closed? && (type.nil? || message.is_a?(type))
190
+ end
191
+
192
+ def unknown_channel_message(name)
193
+ known = if @channels.empty?
194
+ "no channels registered"
195
+ else
196
+ "registered: #{@channels.keys.map(&:inspect).join(", ")}"
197
+ end
198
+ "Unknown channel: #{name.inspect} (#{known})"
199
+ end
200
+
160
201
  def log(level, message)
161
202
  TypedBus.logger&.send(level, "TypedBus::MessageBus #{message}")
162
203
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TypedBus
4
- VERSION = "0.0.1"
4
+ VERSION = "0.1.0"
5
5
  end
data/lib/typed_bus.rb CHANGED
@@ -13,6 +13,9 @@ require_relative "typed_bus/dead_letter_queue"
13
13
  require_relative "typed_bus/channel"
14
14
  require_relative "typed_bus/message_bus"
15
15
 
16
+ # Async pub/sub message bus with typed channels, explicit ACK/NACK delivery,
17
+ # dead letter queues, backpressure and adaptive throttling. Everything runs
18
+ # on fibers inside a single Async reactor.
16
19
  module TypedBus
17
20
  class << self
18
21
  # The global Configuration instance.
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typed_bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
8
- bindir: exe
8
+ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: logger
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
26
40
  description: |
27
41
  A lightweight async message bus built on the async gem with fiber-only concurrency.
28
42
  Provides typed pub/sub channels with explicit acknowledgment, dead letter queues,
@@ -33,64 +47,9 @@ executables: []
33
47
  extensions: []
34
48
  extra_rdoc_files: []
35
49
  files:
36
- - ".envrc"
37
- - ".github/workflows/deploy-github-pages.yml"
38
- - ".github/workflows/deploy-yard-docs.yml"
39
- - ".irbrc"
40
50
  - CHANGELOG.md
41
- - COMMITS.md
51
+ - LICENSE
42
52
  - README.md
43
- - Rakefile
44
- - docs/api/channel.md
45
- - docs/api/configuration.md
46
- - docs/api/dead-letter-queue.md
47
- - docs/api/delivery-tracker.md
48
- - docs/api/delivery.md
49
- - docs/api/index.md
50
- - docs/api/message-bus.md
51
- - docs/api/stats.md
52
- - docs/architecture/concurrency-model.md
53
- - docs/architecture/configuration-cascade.md
54
- - docs/architecture/index.md
55
- - docs/architecture/publish-flow.md
56
- - docs/assets/css/custom.css
57
- - docs/assets/images/typed_bus.gif
58
- - docs/assets/images/typed_bus.jpg
59
- - docs/assets/images/typed_bus.mp4
60
- - docs/concepts.md
61
- - docs/examples/index.md
62
- - docs/getting-started/configuration.md
63
- - docs/getting-started/index.md
64
- - docs/getting-started/installation.md
65
- - docs/getting-started/quick-start.md
66
- - docs/guides/adaptive-throttling.md
67
- - docs/guides/backpressure.md
68
- - docs/guides/dead-letter-queues.md
69
- - docs/guides/delivery-and-ack.md
70
- - docs/guides/error-handling.md
71
- - docs/guides/graceful-shutdown.md
72
- - docs/guides/index.md
73
- - docs/guides/logging.md
74
- - docs/guides/stats-and-monitoring.md
75
- - docs/guides/typed-channels.md
76
- - docs/index.md
77
- - examples/00_config.rb
78
- - examples/01_basic_usage.rb
79
- - examples/02_typed_channels.rb
80
- - examples/03_multiple_subscribers.rb
81
- - examples/04_nack_and_dead_letters.rb
82
- - examples/05_delivery_timeout.rb
83
- - examples/06_backpressure.rb
84
- - examples/07_message_bus.rb
85
- - examples/08_error_handling.rb
86
- - examples/09_stats_and_monitoring.rb
87
- - examples/10_concurrent_pipeline.rb
88
- - examples/11_logging_basic.rb
89
- - examples/12_logging_failures.rb
90
- - examples/13_logging_backpressure.rb
91
- - examples/14_adaptive_throttling.rb
92
- - examples/README.md
93
- - examples/temp.md
94
53
  - lib/typed_bus.rb
95
54
  - lib/typed_bus/channel.rb
96
55
  - lib/typed_bus/configuration.rb
@@ -100,14 +59,16 @@ files:
100
59
  - lib/typed_bus/message_bus.rb
101
60
  - lib/typed_bus/stats.rb
102
61
  - lib/typed_bus/version.rb
103
- - mkdocs.yml
104
62
  homepage: https://github.com/MadBomber/typed_bus
105
63
  licenses:
106
64
  - MIT
107
65
  metadata:
108
66
  homepage_uri: https://github.com/MadBomber/typed_bus
109
- source_code_uri: https://github.com/MadBomber/typed_bus
67
+ source_code_uri: https://github.com/MadBomber/typed_bus/tree/main
110
68
  changelog_uri: https://github.com/MadBomber/typed_bus/blob/main/CHANGELOG.md
69
+ documentation_uri: https://madbomber.github.io/typed_bus
70
+ bug_tracker_uri: https://github.com/MadBomber/typed_bus/issues
71
+ rubygems_mfa_required: 'true'
111
72
  rdoc_options: []
112
73
  require_paths:
113
74
  - lib
@@ -115,14 +76,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
76
  requirements:
116
77
  - - ">="
117
78
  - !ruby/object:Gem::Version
118
- version: 3.2.0
79
+ version: '4.0'
119
80
  required_rubygems_version: !ruby/object:Gem::Requirement
120
81
  requirements:
121
82
  - - ">="
122
83
  - !ruby/object:Gem::Version
123
84
  version: '0'
124
85
  requirements: []
125
- rubygems_version: 4.0.6
86
+ rubygems_version: 4.0.23
126
87
  specification_version: 4
127
88
  summary: Async pub/sub message bus with typed channels, ACK-based delivery, and dead
128
89
  letter queues
data/.envrc DELETED
@@ -1 +0,0 @@
1
- export RR=`pwd`
@@ -1,52 +0,0 @@
1
- name: Deploy HTM Documentation to GitHub Pages
2
- on:
3
- push:
4
- branches:
5
- - main
6
- - develop
7
- paths:
8
- - "docs/**"
9
- - "mkdocs.yml"
10
- - ".github/workflows/deploy-github-pages.yml"
11
- workflow_dispatch:
12
-
13
- permissions:
14
- contents: write
15
- pages: write
16
- id-token: write
17
-
18
- jobs:
19
- deploy:
20
- runs-on: ubuntu-latest
21
- steps:
22
- - name: Checkout code
23
- uses: actions/checkout@v4
24
- with:
25
- fetch-depth: 0
26
-
27
- - name: Setup Python
28
- uses: actions/setup-python@v5
29
- with:
30
- python-version: 3.x
31
-
32
- - name: Install dependencies
33
- run: |
34
- pip install mkdocs
35
- pip install mkdocs-material
36
- pip install mkdocs-macros-plugin
37
- pip install mike
38
-
39
- - name: Configure Git
40
- run: |
41
- git config --local user.email "action@github.com"
42
- git config --local user.name "GitHub Action"
43
-
44
- - name: Deploy to GitHub Pages
45
- run: |
46
- if [ "${{ github.ref }}" = "refs/heads/main" ]; then
47
- echo "Deploying from main branch"
48
- mkdocs gh-deploy --force --clean
49
- else
50
- echo "Deploying from develop branch"
51
- mkdocs gh-deploy --force --clean
52
- fi
@@ -1,52 +0,0 @@
1
- name: Deploy YARD Documentation to GitHub Pages
2
- on:
3
- push:
4
- branches:
5
- - main
6
- - develop
7
- paths:
8
- - "lib/**"
9
- - "docs/assets/**"
10
- - ".yardopts"
11
- - "*.gemspec"
12
- - ".github/workflows/deploy-yard-docs.yml"
13
- workflow_dispatch:
14
-
15
- permissions:
16
- contents: write
17
- pages: write
18
- id-token: write
19
-
20
- jobs:
21
- deploy:
22
- runs-on: ubuntu-latest
23
- steps:
24
- - name: Checkout code
25
- uses: actions/checkout@v4
26
- with:
27
- fetch-depth: 0
28
-
29
- - name: Setup Ruby
30
- uses: ruby/setup-ruby@v1
31
- with:
32
- ruby-version: "3.3"
33
- bundler-cache: true
34
-
35
- - name: Install YARD
36
- run: gem install yard
37
-
38
- - name: Build YARD documentation
39
- run: yard doc
40
-
41
- - name: Configure Git
42
- run: |
43
- git config --local user.email "action@github.com"
44
- git config --local user.name "GitHub Action"
45
-
46
- - name: Deploy to GitHub Pages
47
- uses: peaceiris/actions-gh-pages@v4
48
- with:
49
- github_token: ${{ secrets.GITHUB_TOKEN }}
50
- publish_dir: ./doc
51
- destination_dir: yard
52
- keep_files: true
data/.irbrc DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/setup"
4
- require_relative "./lib/typed_bus"
5
-
6
- TypedBus.logger = Logger.new('irb.log', level: :info)
7
-
8
- def bus
9
- @bus ||= TypedBus::MessageBus.new
10
- end
data/COMMITS.md DELETED
@@ -1,196 +0,0 @@
1
- ---
2
- url: https://www.conventionalcommits.org/en/v1.0.0/
3
- title: Conventional Commits
4
- description: A specification for adding human and machine readable meaning to commit messages
5
- access_date: 2025-07-31T20:51:29.000Z
6
- current_date: 2025-07-31T20:51:29.601Z
7
- ---
8
-
9
- # Conventional Commits
10
-
11
- A specification for adding human and machine readable meaning to commit messages
12
-
13
- Quick Summary Full Specification Contribute
14
-
15
- # Conventional Commits 1.0.0
16
-
17
- ## Summary
18
-
19
- The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
20
-
21
- The commit message should be structured as follows:
22
-
23
- ---
24
-
25
- ```
26
- <type>[optional scope]: <description>
27
-
28
- [optional body]
29
-
30
- [optional footer(s)]
31
-
32
- ```
33
-
34
- ---
35
-
36
- The commit contains the following structural elements, to communicate intent to the consumers of your library:
37
-
38
- 1. **fix:** a commit of the _type_ `fix` patches a bug in your codebase (this correlates with `PATCH` in Semantic Versioning).
39
- 2. **feat:** a commit of the _type_ `feat` introduces a new feature to the codebase (this correlates with `MINOR` in Semantic Versioning).
40
- 3. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with `MAJOR` in Semantic Versioning). A BREAKING CHANGE can be part of commits of any _type_.
41
- 4. _types_ other than `fix:` and `feat:` are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends `build:`, `chore:`,`ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
42
- 5. _footers_ other than `BREAKING CHANGE: <description>` may be provided and follow a convention similar to git trailer format.
43
-
44
- Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE). A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`.
45
-
46
- ## Examples
47
-
48
- ### Commit message with description and breaking change footer
49
-
50
- ```
51
- feat: allow provided config object to extend other configs
52
-
53
- BREAKING CHANGE: `extends` key in config file is now used for extending other config files
54
-
55
- ```
56
-
57
- ### Commit message with `!` to draw attention to breaking change
58
-
59
- ```
60
- feat!: send an email to the customer when a product is shipped
61
-
62
- ```
63
-
64
- ### Commit message with scope and `!` to draw attention to breaking change
65
-
66
- ```
67
- feat(api)!: send an email to the customer when a product is shipped
68
-
69
- ```
70
-
71
- ### Commit message with both `!` and BREAKING CHANGE footer
72
-
73
- ```
74
- chore!: drop support for Node 6
75
-
76
- BREAKING CHANGE: use JavaScript features not available in Node 6.
77
-
78
- ```
79
-
80
- ### Commit message with no body
81
-
82
- ```
83
- docs: correct spelling of CHANGELOG
84
-
85
- ```
86
-
87
- ### Commit message with scope
88
-
89
- ```
90
- feat(lang): add Polish language
91
-
92
- ```
93
-
94
- ### Commit message with multi-paragraph body and multiple footers
95
-
96
- ```
97
- fix: prevent racing of requests
98
-
99
- Introduce a request id and a reference to latest request. Dismiss
100
- incoming responses other than from latest request.
101
-
102
- Remove timeouts which were used to mitigate the racing issue but are
103
- obsolete now.
104
-
105
- Reviewed-by: Z
106
- Refs: #123
107
-
108
- ```
109
-
110
- ## Specification
111
-
112
- The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
113
-
114
- 1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed by the OPTIONAL scope, OPTIONAL `!`, and REQUIRED terminal colon and space.
115
- 2. The type `feat` MUST be used when a commit adds a new feature to your application or library.
116
- 3. The type `fix` MUST be used when a commit represents a bug fix for your application.
117
- 4. A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., `fix(parser):`
118
- 5. A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., _fix: array parsing issue when multiple spaces were contained in string_.
119
- 6. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
120
- 7. A commit body is free-form and MAY consist of any number of newline separated paragraphs.
121
- 8. One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed by either a `:<space>` or `<space>#` separator, followed by a string value (this is inspired by the git trailer convention).
122
- 9. A footer’s token MUST use `-` in place of whitespace characters, e.g., `Acked-by` (this helps differentiate the footer section from a multi-paragraph body). An exception is made for `BREAKING CHANGE`, which MAY also be used as a token.
123
- 10. A footer’s value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer token/separator pair is observed.
124
- 11. Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.
125
- 12. If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g.,_BREAKING CHANGE: environment variables now take precedence over config files_.
126
- 13. If included in the type/scope prefix, breaking changes MUST be indicated by a`!` immediately before the `:`. If `!` is used, `BREAKING CHANGE:` MAY be omitted from the footer section, and the commit description SHALL be used to describe the breaking change.
127
- 14. Types other than `feat` and `fix` MAY be used in your commit messages, e.g., _docs: update ref docs._
128
- 15. The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase.
129
- 16. BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer.
130
-
131
- ## Why Use Conventional Commits
132
-
133
- * Automatically generating CHANGELOGs.
134
- * Automatically determining a semantic version bump (based on the types of commits landed).
135
- * Communicating the nature of changes to teammates, the public, and other stakeholders.
136
- * Triggering build and publish processes.
137
- * Making it easier for people to contribute to your projects, by allowing them to explore a more structured commit history.
138
-
139
- ## FAQ
140
-
141
- ### How should I deal with commit messages in the initial development phase?
142
-
143
- We recommend that you proceed as if you’ve already released the product. Typically _somebody_, even if it’s your fellow software developers, is using your software. They’ll want to know what’s fixed, what breaks etc.
144
-
145
- ### Are the types in the commit title uppercase or lowercase?
146
-
147
- Any casing may be used, but it’s best to be consistent.
148
-
149
- ### What do I do if the commit conforms to more than one of the commit types?
150
-
151
- Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs.
152
-
153
- ### Doesn’t this discourage rapid development and fast iteration?
154
-
155
- It discourages moving fast in a disorganized way. It helps you be able to move fast long term across multiple projects with varied contributors.
156
-
157
- ### Might Conventional Commits lead developers to limit the type of commits they make because they’ll be thinking in the types provided?
158
-
159
- Conventional Commits encourages us to make more of certain types of commits such as fixes. Other than that, the flexibility of Conventional Commits allows your team to come up with their own types and change those types over time.
160
-
161
- ### How does this relate to SemVer?
162
-
163
- `fix` type commits should be translated to `PATCH` releases. `feat` type commits should be translated to `MINOR` releases. Commits with `BREAKING CHANGE` in the commits, regardless of type, should be translated to `MAJOR` releases.
164
-
165
- ### How should I version my extensions to the Conventional Commits Specification, e.g. `@jameswomack/conventional-commit-spec`?
166
-
167
- We recommend using SemVer to release your own extensions to this specification (and encourage you to make these extensions!)
168
-
169
- ### What do I do if I accidentally use the wrong commit type?
170
-
171
- #### When you used a type that’s of the spec but not the correct type, e.g. `fix` instead of `feat`
172
-
173
- Prior to merging or releasing the mistake, we recommend using `git rebase -i` to edit the commit history. After release, the cleanup will be different according to what tools and processes you use.
174
-
175
- #### When you used a type _not_ of the spec, e.g. `feet` instead of `feat`
176
-
177
- In a worst case scenario, it’s not the end of the world if a commit lands that does not meet the Conventional Commits specification. It simply means that commit will be missed by tools that are based on the spec.
178
-
179
- ### Do all my contributors need to use the Conventional Commits specification?
180
-
181
- No! If you use a squash based workflow on Git lead maintainers can clean up the commit messages as they’re merged—adding no workload to casual committers. A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge.
182
-
183
- ### How does Conventional Commits handle revert commits?
184
-
185
- Reverting code can be complicated: are you reverting multiple commits? if you revert a feature, should the next release instead be a patch?
186
-
187
- Conventional Commits does not make an explicit effort to define revert behavior. Instead we leave it to tooling authors to use the flexibility of _types_ and _footers_ to develop their logic for handling reverts.
188
-
189
- One recommendation is to use the `revert` type, and a footer that references the commit SHAs that are being reverted:
190
-
191
- ```
192
- revert: let us never again speak of the noodle incident
193
-
194
- Refs: 676104e, a215868
195
-
196
- ```
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "minitest/test_task"
5
-
6
- Minitest::TestTask.create(:test) do |t|
7
- t.libs << "test"
8
- t.test_prelude = 'require "test_helper"'
9
- t.test_globs = ["test/**/*_test.rb"]
10
- end
11
-
12
- task default: :test