Permalink
Browse files

add: support for dynamically loading the version info

  • Loading branch information...
1 parent 94f29e7 commit 0502915064e9d7665fec32a47c44fd97f0088900 @peterhoeg peterhoeg committed May 15, 2009
Showing with 44 additions and 20 deletions.
  1. +1 −1 .document
  2. +4 −1 CHANGELOG.rdoc
  3. 0 LICENSE → LICENSE.rdoc
  4. +6 −8 Rakefile
  5. +1 −1 VERSION.yml
  6. +11 −3 bin/railroad
  7. +13 −0 lib/version.rb
  8. +8 −6 railroad.gemspec
View
@@ -1,7 +1,7 @@
README.rdoc
CHANGELOG.rdoc
AUTHORS.rdoc
+LICENSE.rdoc
lib/**/*.rb
bin/*
features/**/*.feature
-LICENSE
View
@@ -1,6 +1,9 @@
= Changes
-== Version 0.5.1 to 0.5.6 (may 15 2009)
+== Version 0.5.7 (May 16 2009)
+- Load the version automatically from VERSION.yml
+
+== Version 0.5.1 to 0.5.6 (May 15 2009)
- Make sure the proper version tag is set everywhere
- Support showing belongs_to relationships when generating models
- Transitioned to using Jeweler for gem management
View
File renamed without changes.
View
@@ -5,10 +5,14 @@ begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "railroad"
+ gem.executables = "railroad"
gem.email = ['peter@hoeg.com', 'p.hoeg@northwind.sg', 'javier@smaldone.com.ar']
gem.homepage = "http://github.com/peterhoeg/RailRoad"
gem.authors = ["Peter Hoeg", "Javier Smaldone"]
gem.summary = "A DOT diagram generator for Ruby on Rail applications"
+ gem.description = gem.summary
+ gem.files = FileList["[A-Z]*", "{autotest,bin,lib,spec}/**/*", ".document"]
+ gem.extra_rdoc_files = FileList["*.rdoc"]
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
@@ -31,16 +35,10 @@ end
task :default => :spec
require 'rake/rdoctask'
+require 'lib/version'
Rake::RDocTask.new do |rdoc|
- if File.exist?('VERSION.yml')
- config = YAML.load(File.read('VERSION.yml'))
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
- else
- version = ""
- end
-
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "railroad #{version}"
+ rdoc.title = "railroad #{RailRoad::VERSION::STRING}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('CHANGELOG*')
rdoc.rdoc_files.include('AUTHORS*')
View
@@ -1,4 +1,4 @@
---
:major: 0
:minor: 5
-:patch: 6
+:patch: 7
View
@@ -14,11 +14,18 @@
# (at your option) any later version.
#
+require File.dirname(__FILE__) + '/../lib/version'
+
APP_NAME = "railroad"
APP_HUMAN_NAME = "RailRoad"
-APP_VERSION = [0,5,6]
+APP_VERSION = [RailRoad::VERSION::MAJOR, RailRoad::VERSION::MINOR, RailRoad::VERSION::PATCH]
COPYRIGHT = "Copyright (C) 2007-2008 Javier Smaldone, 2009 Peter Hoeg"
+if ARGV.first == '--version'
+ puts "#{APP_HUMAN_NAME} v#{RailRoad::VERSION::STRING}"
+ exit(0)
+end
+
require 'options_struct'
require 'models_diagram'
require 'controllers_diagram'
@@ -39,8 +46,9 @@ elsif options.command == 'controllers'
elsif options.command == 'aasm'
diagram = AasmDiagram.new options
else
- STDERR.print "Error: You must supply a command\n" +
- " (try #{APP_NAME} -h)\n\n"
+ STDERR.print "#{APP_HUMAN_NAME} v#{RailRoad::VERSION::STRING}\n" +
+ "Error: You must supply a command\n" +
+ " (try #{APP_NAME} -h)\n\n"
exit 1
end
View
@@ -0,0 +1,13 @@
+module RailRoad
+ module VERSION #:nodoc:
+ if File.exist?('../VERSION.yml')
+ config = YAML.load(File.read('../VERSION.yml'))
+ MAJOR = config[:major]
+ MINOR = config[:minor]
+ PATCH = config[:patch]
+ else
+ MAJOR = MINOR = PATCH = 0
+ end
+ STRING = [MAJOR, MINOR, PATCH].join('.')
+ end
+end
View
@@ -2,24 +2,26 @@
Gem::Specification.new do |s|
s.name = %q{railroad}
- s.version = "0.5.6"
+ s.version = "0.5.7"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Peter Hoeg", "Javier Smaldone"]
- s.date = %q{2009-05-15}
+ s.date = %q{2009-05-16}
s.default_executable = %q{railroad}
+ s.description = %q{A DOT diagram generator for Ruby on Rail applications}
s.email = ["peter@hoeg.com", "p.hoeg@northwind.sg", "javier@smaldone.com.ar"]
s.executables = ["railroad"]
s.extra_rdoc_files = [
- "LICENSE",
+ "AUTHORS.rdoc",
+ "CHANGELOG.rdoc",
+ "LICENSE.rdoc",
"README.rdoc"
]
s.files = [
".document",
- ".gitignore",
"AUTHORS.rdoc",
"CHANGELOG.rdoc",
- "LICENSE",
+ "LICENSE.rdoc",
"README.rdoc",
"Rakefile",
"VERSION.yml",
@@ -30,7 +32,7 @@ Gem::Specification.new do |s|
"lib/diagram_graph.rb",
"lib/models_diagram.rb",
"lib/options_struct.rb",
- "railroad.gemspec",
+ "lib/version.rb",
"spec/app_diagram_spec.rb",
"spec/railroad_spec.rb",
"spec/spec_helper.rb"

0 comments on commit 0502915

Please sign in to comment.