Referring to version numbers in a gem

@yossef

As a developer/project-manager it's more desirable to keep all the
project's metadata in a single source, and up at the toplevel of the
project.

The constant is added only b/c that's become the expected norm, and Ruby
lacks any standard protocol for accessing library metadata.

What I do more specifically is more advanced. All my projects has a
standard metadata file that I interface to the code.

Wow. That really should have been obvious to me. Thank you.

···

On Sat, Nov 12, 2011 at 06:32:51AM +0900, Jeremy Bopp wrote:

...
  s.version = MyLibrary::VERSION
...

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

This is what namespaces are for. If a library's constants are
colliding with the environment's, one or the other is managing
namespace poorly.

http://ruby-doc.org/docs/ProgrammingRuby/html/tut_modules.html

···

On Fri, Nov 11, 2011 at 8:20 PM, Chad Perrin <code@apotheon.net> wrote:

I'm using the Gem::Version thing for now in part because I've seen
cases where for some reason a VERSION constant conflicts with
something else in the Ruby environment. I haven't seen it in quite a
while, but I don't want to have to deal with that kind of issue.

According to my stats, I've got 526 releases that all use this pattern and I've never once had a problem with using the VERSION constant. "could prove problematic" sounds like urban legend to me more than a real issue.

···

On Nov 11, 2011, at 20:20 , Chad Perrin wrote:

Using a constant could prove problematic. As I said in an earlier
response:

   I'm using the Gem::Version thing for now in part because I've seen
   cases where for some reason a VERSION constant conflicts with
   something else in the Ruby environment. I haven't seen it in quite a
   while, but I don't want to have to deal with that kind of issue.

@yossef

As a developer/project-manager it's more desirable to keep all the project's
metadata in a single source, and up at the toplevel of the project.

The constant is added only b/c that's become the expected norm, and Ruby
lacks any standard protocol for accessing library metadata.

What I do more specifically is more advanced. All my projects has a standard
metadata file that I interface to the code.

···

Da: Intransition [mailto:transfire@gmail.com]
Inviato: domenica 13 novembre 2011 04:01
A: ruby-talk ML; ruby-talk-google@googlegroups.com
Cc: ruby-talk ML; ruby-talk@ruby-lang.org
Oggetto: Re: referring to version numbers in a gem

--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Conto Arancio al 4,20%. Soldi sempre disponibili, zero spese, aprilo in due minuti!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11920&d=29-12

I wish I could remember where I originally read about that solution so
that I could give proper attribution, but I'm glad you found it helpful.

-Jeremy

···

On 11/11/2011 15:39, Chad Perrin wrote:

On Sat, Nov 12, 2011 at 06:32:51AM +0900, Jeremy Bopp wrote:

...
  s.version = MyLibrary::VERSION
...

Wow. That really should have been obvious to me. Thank you.

So do Rails, ActiveRecord, Rack, NokoGiri, Cucumber, among others.
<ruby - Which format should the version constant of my project have - Stack Overflow;

Steve Klabnick recommends the same. He also recommends putting that
library's VERSION constant into a version.rb.
<http://timelessrepo.com/making-ruby-gems&gt;

Which likewise is the approach Rails uses.

<The Rails Initialization Process — Ruby on Rails Guides;

···

On Sat, Nov 12, 2011 at 12:25 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Nov 11, 2011, at 20:20 , Chad Perrin wrote:

Using a constant could prove problematic. As I said in an earlier
response:

I'm using the Gem::Version thing for now in part because I've seen
cases where for some reason a VERSION constant conflicts with
something else in the Ruby environment. I haven't seen it in quite a
while, but I don't want to have to deal with that kind of issue.

According to my stats, I've got 526 releases that all use this pattern and I've never once had a problem with using the VERSION constant. "could prove problematic" sounds like urban legend to me more than a real issue.

--
Carina

"Urban legend" is not something that actually happened to me and that I
saw someone else comment about on this list a few days later. "Urban
legend" is something that one can only say "I have a friend who has a
friend who said he heard about this." Unfortunately, it was quite a
while ago, and I don't recall the specifics of the situation. I'll try
to track down the event.

···

On Sat, Nov 12, 2011 at 05:25:21PM +0900, Ryan Davis wrote:

According to my stats, I've got 526 releases that all use this pattern
and I've never once had a problem with using the VERSION constant.
"could prove problematic" sounds like urban legend to me more than a
real issue.

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]