Skip to content

Commit

Permalink
Use a separate version file.
Browse files Browse the repository at this point in the history
We sadly have to use GeminaboxVersion as opposed to Geminabox::VERSION as otherwise we would have to load sinatra just to get a version number.
  • Loading branch information
tomlea committed Mar 9, 2012
1 parent 00f6fce commit 6129329
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions geminabox.gemspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
$:.push File.expand_path('../lib', __FILE__)
require 'geminabox'
require File.expand_path('../lib/geminabox/version', __FILE__)

Gem::Specification.new do |s|
s.name = 'geminabox'
s.version = Geminabox::VERSION
s.version = GeminaboxVersion
s.summary = 'Really simple rubygem hosting'
s.description = 'A sinatra based gem hosting app, with client side gem push style functionality.'
s.author = 'Tom Lea'
Expand Down
4 changes: 2 additions & 2 deletions lib/geminabox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
require 'rubygems/builder'
require 'rubygems/indexer'
require 'hostess'
require 'geminabox/version'

class Geminabox < Sinatra::Base
VERSION = '0.6.0'
enable :static, :methodoverride

set :public_folder, File.join(File.dirname(__FILE__), *%w[.. public])
Expand All @@ -33,7 +33,7 @@ def fixup_bundler_rubygems!
autoload :GemVersionCollection, "geminabox/gem_version_collection"

before do
headers 'X-Powered-By' => "geminabox #{VERSION}"
headers 'X-Powered-By' => "geminabox #{GeminaboxVersion}"
end

get '/' do
Expand Down
1 change: 1 addition & 0 deletions lib/geminabox/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GeminaboxVersion = '0.6.0'
2 changes: 1 addition & 1 deletion test/requests/x_powered_by_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def app
%w[ / /gems ].each do |path|
define_method "test: adds X-Powered-By when requesting '#{path}'" do
get path
assert_equal "geminabox #{Geminabox::VERSION}", last_response.headers['X-Powered-By']
assert_equal "geminabox #{GeminaboxVersion}", last_response.headers['X-Powered-By']
end
end
end

2 comments on commit 6129329

@exviva
Copy link
Contributor

@exviva exviva commented on 6129329 Mar 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 was thinking about the same thing!

@tomlea
Copy link
Member Author

@tomlea tomlea commented on 6129329 Mar 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Endlessly annoyed by past me's decision to put the app in ::Geminabox directly, as opposed to having it as just a namespace. I don't wan't to break people's config.rus though. This it about the 3rd time it's bitten me in the ass.

Please sign in to comment.