Search code examples
rubyrubygemsjekyll

Runtime dependencies versus development dependencies in Jekyll


The following dependencies must be added to a gemspec file to provision a jekyll project:

json -v '2.3.0'
nokogiri -v '1.10.9'
nokogumbo -v '2.0.2'
jaro_winkler -v '1.5.4'

Which of these dependencies should be classified as runtime dependencies? Which should be classified as development dependencies?

How should one determine whether a given dependency is a runtime dependency or a development dependency?

The specific lines in the gemspec file will look like:

  s.add_runtime_dependency 'aaaaa-aa-aaaa', '~> x.x'  
  s.add_development_dependency 'bbbb-bbbbb', '~> y.y'  

The entire gemspec file will look something like:

Gem::Specification.new do |s|
  s.name          = ''
  s.version       = ''
  s.license       = ''
  s.authors       = ['', '']
  s.email         = ['']
  s.homepage      = ''
  s.summary       = ''
  s.files         = `'
  end

  s.platform = Gem::Platform::RUBY
  s.add_runtime_dependency 'aaaaa-aa-aaaa', '~> x.x'
  s.add_development_dependency 'bbbb-bbbbb', '~> y.y'
end  

This is running on an Amazon EC2 instance running Amazon Linux 2.


Solution

  • Since the question is about a Jekyll theme (packaged as a gem), we can pretty safely say that the main application here is a Jekyll app that depends on this gem. There are no hard rules about this, but it seems reasonable to say that the Jekyll app environment is the "runtime" as far as the gem is concerned. So anything that the gem depends on during the course of using it within a Jekyll app is a runtime dependency. At the very least, a Jekyll theme would depend on some particular version of Jekyll itself, and probably some other things.

    Here's a concise way to put it. If jekyll build fails without these gems you mentioned, then they are runtime dependencies.

    The development dependencies are for extra gems that you want only while you are developing the gem, for example rspec, or rubocop.