4

I am not well familiar with Ruby world. Java build tools usually use test scope for things like jUnit.

I initialized a new project with command: bundle gem new_gem_from_bundler and the content of Gemfile is

source "https://rubygems.org"

# Specify your gem's dependencies in new_gem_from_bundler.gemspec
gemspec

gem "rake", "~> 12.0"
gem "rspec", "~> 3.0"

Why not:

group :development do
  gem "rspec", "~> 3.9.0"
  gem "rake", "~> 3.0"
end

Also since there is a .gemspec file I would expect rake and rspec to be defined like this:

spec.add_development_dependency 'rake', '~> 12.0'
spec.add_development_dependency 'rspec', '~> 3.0'

Why are they declared as a regular 'gem' dependencies?

Kirill
  • 6,762
  • 4
  • 51
  • 81

1 Answers1

1

Bundler uses template files for creating new gems. You could change the template files Gemfile.tt and newgem.gemspec.tt according to your needs. For example you could use this Gemfile.tt:

source "https://rubygems.org"

# Specify your gem's dependencies in <%= config[:name] %>.gemspec
gemspec

To find where the template files are you could use this shell command:

find $(dirname $(gem which -g bundler)) -name Gemfile.tt
builder-7000
  • 7,131
  • 3
  • 19
  • 43
  • 3
    Good to know. But still not clear why 'rspec' is not declared in a test or development scope. – Kirill May 29 '20 at 07:40