Skip to content

Commit

Permalink
Remove dependency to cucumber-wire (#1562)
Browse files Browse the repository at this point in the history
* Remove dependency to cucummber-wire

* Add a parameter to pass the registry to AfterConfiguration hooks

* Update cucumber.gemspec

* Fix invokation of AfterConfiguration hook

* Fix firing of after configuration hook

* Remove firing of wire plugin in runtime

* Remove test on the deprecation of wire

* Add a new dedicated chapter in UPGRADING.md

* Add an entry in the changelog

* Remove references to wire in CONTRIBUTING.md

The wire protocol is not a direct dependency anymore, so it is not as
important as before while contributing.

* Remove references to wire in RELEASING.md

It is not a direct dependency anymore.

* Fix typos
  • Loading branch information
aurelien-reeves committed Dec 6, 2021
1 parent 7c2b78e commit 532fcfd
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 152 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo

### Removed

- The built-in Wire protocol
The Wire protocol is still officially supported, but as an optional plugin rather
than a built-in feature. See the
[UPGRADING.md](./UPGRADING.md#upgrading-to-800)
to update your code accordingly.

([1562](https://github.com/cucumber/cucumber-ruby/pull/1562)
[aurelien-reeves](https://github.com/aurelien-reeves))

- Removed former unused `stdin` argument from `Cli::Main`. That may impact your code
if you use cucumber API `Cucumber::Cli::Main`. See [UPGRADING.md](./UPGRADING.md#upgrading-to-800).
([PR#1588](https://github.com/cucumber/cucumber-ruby/pull/1588)
Expand Down
8 changes: 2 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ with a lot of libraries. You will find there what is related to:
step definition
- everyting related to the HTML formatter

`cucumber-ruby` is also composed of:

- [cucumber-ruby-core]: this is the engine that will execute the test cases
computed from a parsed Gherkin document
- [cucumber-ruby-wire]: everything related to the Cucumber's wire protocol
`cucumber-ruby` is also composed of [cucumber-ruby-core]: this is the engine that
will execute the test cases computed from a parsed Gherkin document

Last but not least, there is also a repository for [cucumber-rails], the gem
that brings Cucumber to Rails 5.x and 6.x.
Expand Down Expand Up @@ -236,7 +233,6 @@ You can find additional documentation in the [docs](./docs) directory such as
[cucumber-docs]: https://cucumber.io/docs/cucumber
[cucumber/common]: https://github.com/cucumber/common
[cucumber-ruby-core]: https://github.com/cucumber/cucumber-ruby-core
[cucumber-ruby-wire]: https://github.com/cucumber/cucumber-ruby-wire
[cucumber-rails]: https://github.com/cucumber/cucumber-rails
[cucumber-ruby-issues]: https://github.com/cucumber/cucumber-ruby/search?q=is%3Aissue
[cucumber/common-issues]: https://github.com/cucumber/common/search?q=is%3Aissue
Expand Down
6 changes: 0 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ elsif !ENV['CUCUMBER_USE_RELEASED_GEMS']
gem 'cucumber-core', github: 'cucumber/cucumber-ruby-core', branch: 'main'
end

if ENV['CUCUMBER_RUBY_WIRE']
gem 'cucumber-wire', path: ENV['CUCUMBER_RUBY_WIRE']
elsif !ENV['CUCUMBER_USE_RELEASED_GEMS']
gem 'cucumber-wire', github: 'cucumber/cucumber-ruby-wire', branch: 'main'
end

gem 'cucumber-expressions', path: ENV['CUCUMBER_EXPRESSIONS_RUBY'] if ENV['CUCUMBER_EXPRESSIONS_RUBY']
gem 'cucumber-gherkin', path: ENV['GHERKIN_RUBY'] if ENV['GHERKIN_RUBY']
gem 'cucumber-html-formatter', path: ENV['CUCUMBER_HTML_FORMATTER_RUBY'] if ENV['CUCUMBER_HTML_FORMATTER_RUBY']
Expand Down
10 changes: 2 additions & 8 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ To release `cucumber-ruby`, you'll need:
- make
- docker

# Release process for cucumber-wire

## Prerequisites

To release `cucumber`, you'll need to be a member of the core team

## cucumber-ruby-core and cucumber-ruby-wire
## cucumber-ruby-core

If internal libraries such as `cucumber-gherkin` needs to be updated, you'll
need to update and release `cucumber-ruby-core` first, then `cucumber-ruby-wire`.
need to update and release `cucumber-ruby-core` before releasing `cucumber-ruby`.

## Releasing cucumber-ruby

Expand Down
47 changes: 46 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# Upgrading to 8.0.0

# The wire protocol

The built-in wire protocol has been removed.

The wire protocol is still available by explicitly using the `cucumber-wire` gem.

### Before cucumber 8.0.0

Before cucumber 8.0.0, the wire protocol was automatically installed with cucumber,
and automatically activated when it had detected a `.wire` file.

If you were using cucumber 7.1.0 and did not already migrate your code, you had a
deprecation message.

### With cucumber 8.0.0

If you are not using the wire protocol, you have nothing to do.

If you already have updated your code to remove the deprecation message shown when
using cucumber 7.1.0, you are already up-to-date. Nothing more has to be done.

If you are still using the built-in wire protocol here the step to migrate to cucumber 8.0.0:

- add the gem `cucumber-wire` to your Gemfile alongside the `cucumber` one, and install it:
```ruby
# Gemfile

# ...

gem "cucumber"
gem "cucumber-wire"

# ...

```
```shell
bundle install
```
- add `require 'cucumber/wire'` in your support code. If you do not have support
code yet, create a new one. For example `features/support/wire.rb`.
```ruby
# features/support/wire.rb
require 'cucumber/wire'
```

## `Cucumber::Cli::Main` former `stdin` argument

The second argument of `Cucumber::Cli::Main` - which was formerly named `stdin` -
Expand Down Expand Up @@ -40,7 +85,7 @@ Cucumber::Cli::Main.new(
Usage of built-in wire protocol with `cucumber-ruby` will be deprecated in cucumber
7.1.0, and removed in cucumber 8.0.0.

The wire protocol will still be available by explicitely using the `cucumber-wire`
The wire protocol will still be available by explicitly using the `cucumber-wire`
gem.

### Before cucumber 7.1.0
Expand Down
1 change: 0 additions & 1 deletion cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Gem::Specification.new do |s|
s.add_dependency 'cucumber-gherkin', '~> 22.0', '>= 22.0.0'
s.add_dependency 'cucumber-html-formatter', '~> 17.0', '>= 17.0.0'
s.add_dependency 'cucumber-messages', '~> 17.1', '>= 17.1.1'
s.add_dependency 'cucumber-wire', '~> 6.2', '>= 6.2.0'
s.add_dependency 'diff-lcs', '~> 1.4', '>= 1.4.4'
s.add_dependency 'mime-types', '~> 3.3', '>= 3.3.1'
s.add_dependency 'multi_test', '~> 0.1', '>= 0.1.2'
Expand Down
6 changes: 3 additions & 3 deletions cucumber.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ else
end
%>
default: <%= std_opts %> --tags "not @jruby"
jruby: <%= std_opts %> --tags "not @wire"
jruby_win: <%= std_opts %> --tags "not @wire" CUCUMBER_FORWARD_SLASH_PATHS=true
windows_mri: <%= std_opts %> --tags "not @jruby" --tags "not @wire" --tags "not @needs-many-fonts" --tags "not @todo-windows" CUCUMBER_FORWARD_SLASH_PATHS=true
jruby: <%= std_opts %>
jruby_win: <%= std_opts %> CUCUMBER_FORWARD_SLASH_PATHS=true
windows_mri: <%= std_opts %> --tags "not @jruby" --tags "not @needs-many-fonts" --tags "not @todo-windows" CUCUMBER_FORWARD_SLASH_PATHS=true
wip: --wip <%= wip_opts %> features
none: --format pretty
92 changes: 0 additions & 92 deletions features/lib/support/fake_wire_server.rb

This file was deleted.

14 changes: 0 additions & 14 deletions lib/cucumber/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def configure(new_configuration)
@support_code.configure(@configuration)
end

require 'cucumber/wire/plugin'
def run!
@configuration.notify :envelope, Cucumber::Messages::Envelope.new(
meta: Cucumber::CreateMeta.create_meta('cucumber-ruby', Cucumber::VERSION)
Expand All @@ -75,7 +74,6 @@ def run!
load_step_definitions
fire_after_configuration_hook
fire_install_plugin_hook
install_wire_plugin
fire_before_all_hook unless dry_run?
# TODO: can we remove this state?
self.visitor = report
Expand Down Expand Up @@ -282,18 +280,6 @@ def load_step_definitions
@support_code.load_files!(files)
end

def install_wire_plugin
return if Cucumber::Wire::Plugin.installed?
return unless @configuration.all_files_to_load.any? { |f| f =~ /\.wire$/ }

Cucumber::Wire::Plugin.new(@configuration, registry_wrapper).install
Cucumber.deprecate(
'See https://github.com/cucumber/cucumber-ruby/blob/main/UPGRADING.md#upgrading-to-710 for more info',
' built-in usage of the wire protocol',
'8.0.0'
)
end

def registry_wrapper
Cucumber::Glue::RegistryWrapper.new(@support_code.registry)
end
Expand Down
21 changes: 0 additions & 21 deletions spec/cucumber/runtime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,5 @@ module Cucumber
expect(subject.doc_string('Text')).to eq 'Text'
end
end

describe '#install_wire_plugin' do
it 'informs the user it is deprecated' do
stub_const('Cucumber::Deprecate::STRATEGY', Cucumber::Deprecate::ForUsers)
allow($stdout).to receive(:puts)
allow_any_instance_of(Configuration).to receive(:all_files_to_load).and_return(['file.wire'])

begin
subject.run!
rescue NoMethodError
# this is actually expected
end

expect($stdout).to have_received(:puts).with(
a_string_including([
'WARNING: # built-in usage of the wire protocol is deprecated and will be removed after version 8.0.0.',
'See https://github.com/cucumber/cucumber-ruby/blob/main/UPGRADING.md#upgrading-to-710 for more info.'
].join(' '))
)
end
end
end
end

0 comments on commit 532fcfd

Please sign in to comment.