Skip to content

Commit 067d277

Browse files
committed
Remove conditions from gem declarations in Gemfile
Both gems 'wdm' and 'rb-kqueue' can be installed on any platform. They fail when require 'wdm' or 'rb-kqueue' is called. So the conditions in the Gemfile can be removed and should not be recommended. Having conditions in the Gemfile is generally bad practice, since this leads to changed Gemfile.lock, whenever the bundler is executed on a different platform. Also "bundle package --all-platforms" doesn't work properly, when gems are declared conditionally.
1 parent f186b2f commit 067d277

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

Gemfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,8 @@ else
1111
gemspec development_group: :gem_build_tools
1212
end
1313

14-
require 'rbconfig'
15-
16-
case RbConfig::CONFIG['target_os']
17-
when /mswin|mingw|cygwin/i
18-
gem 'wdm', '>= 0.1.0'
19-
when /bsd|dragonfly/i
20-
gem 'rb-kqueue', '>= 0.2'
21-
end
14+
gem 'rb-kqueue', '>= 0.2'
15+
gem 'wdm', '>= 0.1.0'
2216

2317
group :test do
2418
gem 'coveralls'

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ If you are on Windows, it's recommended to use the [`wdm`](https://github.com/Ma
265265
Please add the following to your Gemfile:
266266

267267
```ruby
268-
gem 'wdm', '>= 0.1.0', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
268+
gem 'wdm', '>= 0.1.0'
269269
```
270270

271271
### On \*BSD
@@ -275,11 +275,7 @@ If you are on \*BSD you can try to use the [`rb-kqueue`](https://github.com/mat8
275275
Please add the following to your Gemfile:
276276

277277
```ruby
278-
require 'rbconfig'
279-
if RbConfig::CONFIG['target_os'] =~ /bsd|dragonfly/i
280-
gem 'rb-kqueue', '>= 0.2'
281-
end
282-
278+
gem 'rb-kqueue', '>= 0.2'
283279
```
284280

285281
### Getting the [polling fallback message](#options)?

lib/listen/adapter/bsd.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ class BSD < Base
2222

2323
BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
2424
Please add the following to your Gemfile to avoid polling for changes:
25-
require 'rbconfig'
26-
if RbConfig::CONFIG['target_os'] =~ /#{OS_REGEXP}/
27-
gem 'rb-kqueue', '>= 0.2'
28-
end
25+
gem 'rb-kqueue', '>= 0.2'
2926
EOS
3027

3128
def self.usable?

lib/listen/adapter/windows.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Windows < Base
99

1010
BUNDLER_DECLARE_GEM = <<-EOS.gsub(/^ {6}/, '')
1111
Please add the following to your Gemfile to avoid polling for changes:
12-
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
12+
gem 'wdm', '>= 0.1.0'
1313
EOS
1414

1515
def self.usable?

0 commit comments

Comments
 (0)