diff --git a/Rakefile b/Rakefile index 4db1a7bb..8ea89b6c 100644 --- a/Rakefile +++ b/Rakefile @@ -9,10 +9,7 @@ task :spec => :test CLEAN.include "**/*.rbc" def source_version - @source_version ||= begin - load './lib/sinatra/version.rb' - Sinatra::VERSION - end + @source_version ||= File.read(File.expand_path("../VERSION", __FILE__)).strip end def prev_feature @@ -147,15 +144,8 @@ if defined?(Gem) "rack-protection" => "./rack-protection" } - # Load the gemspec using the same limitations as github - def spec(gem) - require 'rubygems' unless defined? Gem::Specification - directory = GEMS_AND_ROOT_DIRECTORIES[gem] - eval(File.read("#{directory + "/" + gem}.gemspec")) - end - def package(gem, ext='') - "pkg/#{gem}-#{spec(gem).version}" + ext + "pkg/#{gem}-#{source_version}" + ext end directory 'pkg/' @@ -212,6 +202,13 @@ if defined?(Gem) desc "Commits the version to github repository" task :commit_version do + # TODO: Find a better way later to manage versions between gems + sh <<-SH + sed -i '' "s/.*VERSION.*/ VERSION = '#{source_version}'/" lib/sinatra/version.rb + sed -i '' "s/.*VERSION.*/ VERSION = '#{source_version}'/" sinatra-contrib/lib/sinatra/contrib/version.rb + sed -i '' "s/.*VERSION.*/ VERSION = '#{source_version}'/" rack-protection/lib/rack/protection/version.rb + SH + sh <<-SH git commit --allow-empty -a -m '#{source_version} release' && git tag -s v#{source_version} -m '#{source_version} release' && diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..ed881561 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.0.0.rc2 diff --git a/rack-protection/rack-protection.gemspec b/rack-protection/rack-protection.gemspec index 03592702..74e9d706 100644 --- a/rack-protection/rack-protection.gemspec +++ b/rack-protection/rack-protection.gemspec @@ -1,10 +1,9 @@ -$:.unshift File.expand_path("../../rack-protection/lib", __FILE__) -require "rack/protection/version" +version = File.read(File.expand_path("../../VERSION", __FILE__)).strip Gem::Specification.new do |s| # general infos s.name = "rack-protection" - s.version = Rack::Protection::VERSION + s.version = version s.description = "Protect against typical web attacks, works with all Rack apps, including Rails." s.homepage = "http://github.com/sinatra/sinatra/tree/master/rack-protection" s.summary = s.description diff --git a/sinatra-contrib/lib/sinatra/contrib/version.rb b/sinatra-contrib/lib/sinatra/contrib/version.rb index f898d555..22e7f22e 100644 --- a/sinatra-contrib/lib/sinatra/contrib/version.rb +++ b/sinatra-contrib/lib/sinatra/contrib/version.rb @@ -1,6 +1,6 @@ module Sinatra module Contrib - VERSION = ::Sinatra::VERSION + VERSION = '2.0.0.rc2' end end diff --git a/sinatra-contrib/sinatra-contrib.gemspec b/sinatra-contrib/sinatra-contrib.gemspec index 8ccadc2e..b7aa642f 100644 --- a/sinatra-contrib/sinatra-contrib.gemspec +++ b/sinatra-contrib/sinatra-contrib.gemspec @@ -1,11 +1,10 @@ # -*- encoding: utf-8 -*- -$:.unshift File.expand_path("../../lib", __FILE__) -require "sinatra/version" +version = File.read(File.expand_path("../../VERSION", __FILE__)).strip Gem::Specification.new do |s| s.name = "sinatra-contrib" - s.version = Sinatra::VERSION + s.version = version s.description = "Collection of useful Sinatra extensions" s.homepage = "http://github.com/sinatra/sinatra/tree/master/sinatra-contrib" s.license = "MIT" @@ -22,11 +21,11 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.2.0' - s.add_dependency "sinatra", Sinatra::VERSION + s.add_dependency "sinatra", version s.add_dependency "mustermann", "~> 1.0" s.add_dependency "backports", ">= 2.0" s.add_dependency "tilt", ">= 1.3", "< 3" - s.add_dependency "rack-protection", Sinatra::VERSION + s.add_dependency "rack-protection", version s.add_dependency "multi_json" s.add_development_dependency "rspec", "~> 3.4" diff --git a/sinatra.gemspec b/sinatra.gemspec index 0e2f250a..ccd2e5e5 100644 --- a/sinatra.gemspec +++ b/sinatra.gemspec @@ -1,7 +1,6 @@ -$LOAD_PATH.unshift File.expand_path('../lib', __FILE__) -require 'sinatra/version' +version = File.read(File.expand_path("../VERSION", __FILE__)).strip -Gem::Specification.new 'sinatra', Sinatra::VERSION do |s| +Gem::Specification.new 'sinatra', version do |s| s.description = "Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort." s.summary = "Classy web-development dressed in a DSL" s.authors = ["Blake Mizerany", "Ryan Tomayko", "Simon Rozet", "Konstantin Haase"] @@ -27,6 +26,6 @@ Gem::Specification.new 'sinatra', Sinatra::VERSION do |s| s.add_dependency 'rack', '~> 2.0' s.add_dependency 'tilt', '~> 2.0' - s.add_dependency 'rack-protection', '2.0.0.rc2' + s.add_dependency 'rack-protection', version s.add_dependency 'mustermann', '~> 1.0' end