14

I am not clear on what certain specifications in the .gemspec file are doing. Specifically,

spec.files         = `git ls-files -z`.split("\x0")
spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

Can someone explain how these relate to the functionality of a Ruby Gem and why they are necessary?

sawa
  • 165,429
  • 45
  • 277
  • 381
Aaron
  • 6,466
  • 7
  • 37
  • 75

1 Answers1

13

executables:

Executables included in the gem. For example, the rake gem has rake as an executable. These files must be executable Ruby files.

files:

Files included in the gem. These are the files that will be included in your gem when it is built.

require_paths:

Contains an Array of directories and files which should be added to the $LOAD_PATH on gem activation. By default it is ["lib"].

test_files

Test files included in the gem.

Jakob S
  • 19,575
  • 3
  • 40
  • 38