Skip to content

Commit

Permalink
add: support for dynamically loading the version info
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoeg committed May 15, 2009
1 parent 94f29e7 commit 0502915
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .document
@@ -1,7 +1,7 @@
README.rdoc
CHANGELOG.rdoc
AUTHORS.rdoc
LICENSE.rdoc
lib/**/*.rb
bin/*
features/**/*.feature
LICENSE
5 changes: 4 additions & 1 deletion CHANGELOG.rdoc
@@ -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
Expand Down
File renamed without changes.
14 changes: 6 additions & 8 deletions Rakefile
Expand Up @@ -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

Expand All @@ -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*')
Expand Down
2 changes: 1 addition & 1 deletion VERSION.yml
@@ -1,4 +1,4 @@
---
:major: 0
:minor: 5
:patch: 6
:patch: 7
14 changes: 11 additions & 3 deletions bin/railroad
Expand Up @@ -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'
Expand All @@ -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

Expand Down
13 changes: 13 additions & 0 deletions lib/version.rb
@@ -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
14 changes: 8 additions & 6 deletions railroad.gemspec
Expand Up @@ -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",
Expand All @@ -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"
Expand Down

0 comments on commit 0502915

Please sign in to comment.