0

Is there an easy way using the gem command to ask "what would your output file be"?

Use case: I am wrapping several commands with a Makefile. With the version already built into my .gemspec (actually into a version.rb that gemspec includes, but same thing...), I don't want to hard-code it also into my Makefile. Since generation of my output file is built into gem build myspec.gemspec, best would be if I could just run something like gem tellmeoutputfile myspec.gemspec.

I did see How do I get the version from a gemspec file? which would work, but wanted to know if it is built into the gem command in any way?

Community
  • 1
  • 1
deitch
  • 14,019
  • 14
  • 68
  • 96

1 Answers1

0

Try: gem help specification

For example gem specification rails version returns:

--- !ruby/object:Gem::Version
version: 5.0.1
Adam Zapaśnik
  • 633
  • 4
  • 9
  • Thanks @DiodonHystrix, looks like a step in the right direction, but how do I get it to work? I tried `gem spec ./docker_registry2.gemspec --all` and got `ERROR: No gem matching './docker_registry2.gemspec (>= 0)' found`. – deitch Mar 26 '17 at 18:14
  • `Usage: gem specification [GEMFILE] [FIELD] [options]` `Arguments: GEMFILE name of gem to show the gemspec for FIELD name of gemspec field to show` Looks like gemfile has to be the name of gem. – Adam Zapaśnik Mar 26 '17 at 18:18
  • Actually, I think `gem spec` gives the reverse of what I want. `gem spec` says, "given a gem file, get the spec." I am saying the opposite: "given a gemspec file, tell me the version, etc. used to construct the gem file." – deitch Mar 27 '17 at 04:11
  • Yea, I guess that is right. Unfortunately, I don't think you can do that with `gem`. – Adam Zapaśnik Mar 27 '17 at 09:00