Permalink
Browse files

Refactor build system

  • Loading branch information...
1 parent b16e5b1 commit 81358854f23039b76a32cf2e5fcbc30b03bc78e3 @sferik sferik committed Apr 29, 2011
View
@@ -2,6 +2,5 @@ rvm:
- 1.8.7
- 1.9.1
- 1.9.2
- - jruby
- rbx
- ree
View
@@ -6,7 +6,3 @@ gemspec :path => 'oa-enterprise'
gemspec :path => 'oa-more'
gemspec :path => 'oa-oauth'
gemspec :path => 'oa-openid'
-
-group :development do
- gem "thrift_client", "0.6.1", :git => "git://github.com/sferik/thrift_client.git", :branch => "bump_version"
-end
View
172 Rakefile
@@ -1,158 +1,48 @@
-OMNIAUTH_GEMS = %w(oa-basic oa-core oa-oauth oa-openid oa-enterprise oa-more)
+$:.unshift File.expand_path('..', __FILE__)
+require 'tasks/all'
-def each_gem(action, &block)
- OMNIAUTH_GEMS.each do |gem|
- puts "#{gem} #{action}"
- Dir.chdir(gem) do
- yield
- end
- end
-end
-
-def version
- File.read("VERSION").strip
-end
-
-def bump_version(position)
- v = version.split('.').map{|s| s.to_i}
- v[position] += 1
- write_version(*v)
-end
-
-def write_version(major, minor, patch)
- v = version.split('.').map{|s| s.to_i}
- v[0] = major unless major.nil?
- v[1] = minor unless minor.nil?
- v[2] = patch unless patch.nil?
- File.open("VERSION", 'w') do |f|
- f.write v.join('.')
- end
- each_gem('is writing version file...') do
- File.open("VERSION", 'w') do |f|
- f.write v.join('.')
- end
- end
- display_version
-end
+desc 'Clean up temporary files'
+task :clean => 'all:clean'
-def display_version
- puts "Version is now #{version}"
-end
+desc 'Build gem files for all projects into the package directory'
+task :build => 'all:build'
-desc "Display the current version"
-task :version do
- display_version
-end
+desc 'Build and install gems for all projects'
+task :install => 'all:install'
-namespace :version do
- desc "Write version with MAJOR, MINOR, and PATCH level env variables."
- task :write do
- write_version(ENV['MAJOR'], ENV['MINOR'], ENV['PATCH'])
- end
-
- namespace :bump do
- desc "Increment the major version"
- task :major do
- bump_version(0)
- end
- desc "Increment the minor version"
- task :minor do
- bump_version(1)
- end
- desc "Increment the patch version"
- task :patch do
- bump_version(2)
- end
- end
-end
+desc 'Write version with MAJOR, MINOR, PATCH, and PRE environment variables'
+task 'version:write' => 'all:version:write'
-desc "Run specs for all of the gems"
-task :spec do
- error_gems = []
- each_gem('specs are running...') do |gem|
- unless system('bundle exec rake spec')
- error_gems << gem
- end
- end
+desc 'Display the current version for all projects'
+task :version => 'all:version'
+desc 'Increment the major version for all projects'
+task 'version:bump:major' => 'all:version:bump:major'
+desc 'Increment the minor version for all projects'
+task 'version:bump:minor' => 'all:version:bump:minor'
+desc 'Increment the patch version for all projects'
+task 'version:bump:patch' => 'all:version:bump:patch'
- puts
- if error_gems.any?
- puts "#{error_gems.size} gems with failing specs: #{error_gems.join(', ')}"
- exit(1)
- else
- puts "All gems passed specs."
- end
-end
+desc 'Run specs for all projects'
+task :spec => 'all:spec'
+task :test => :spec
+task :default => :test
-desc "Release all gems to gemcutter and create a tag"
-task :release => ['tag', 'clean', 'build', 'publish']
+desc 'Generate docs for all projects'
+task 'doc:yard' => 'all:doc:yard'
task :tag do
- system("git tag v#{version.join}")
- system('git push origin --tags')
+ sh "git tag -a -m \"Version #{version}\" v#{version}"
+ sh "git push"
+ sh "git push --tags"
end
-task :publish do
- each_gem('is releasing to Rubygems...') do
- system("gem push pkg/#{gem}-#{version.join}.gem")
- end
- system("gem push pkg/omniauth-#{version.join}.gem")
-end
-
-def build_gem
- system('gem build omniauth.gemspec')
- FileUtils.mkdir_p('pkg')
- FileUtils.mv("omniauth-#{version}.gem", 'pkg')
-end
-
-def install_gem
- system("gem install pkg/omniauth-#{version}.gem")
-end
-
-desc "Build gem files for all projects"
-task :build do
- each_gem('is building...') do
- system('rake build')
- end
- build_gem
-end
-
-desc "Install gems for all projects"
-task :install do
- each_gem('is installing...') do
- system('rake install')
- end
- build_gem
- install_gem
-end
-
-desc "Clean pkg and other stuff"
-task :clean do
- OMNIAUTH_GEMS.each do |gem|
- Dir.chdir(gem) do
- %w(tmp pkg coverage dist).each do |directory|
- FileUtils.rm_rf directory
- end
- end
- %w(tmp pkg coverage dist).each do |directory|
- FileUtils.rm_rf directory
- end
- end
- Dir["**/*.gem"].each do |gem|
- FileUtils.rm_rf gem
- end
-end
-
-task :default => :spec
-task :test => :spec
+desc 'Build, tag, and push gems for all projects to Rubygems'
+task :release => [:build, :tag, :push]
namespace :doc do
require 'yard'
YARD::Rake::YardocTask.new do |task|
- task.files = OMNIAUTH_GEMS.map{|gem| ["#{gem}/lib/**/*.rb"]} + ['README.markdown', 'LICENSE']
- task.options = [
- '--markup', 'markdown',
- '--markup-provider', 'maruku',
- ]
+ task.files = PROJECTS.map{|project| "#{root}/#{project}/lib/**/*.rb"} + ['README.markdown', 'LICENSE']
end
end
+
View
@@ -1 +0,0 @@
-0.2.4
View
@@ -0,0 +1,19 @@
+module OmniAuth
+ module Version
+ unless defined?(::OmniAuth::Version::MAJOR)
+ MAJOR = 0
+ end
+ unless defined?(::OmniAuth::Version::MINOR)
+ MINOR = 2
+ end
+ unless defined?(::OmniAuth::Version::PATCH)
+ PATCH = 4
+ end
+ unless defined?(::OmniAuth::Version::PRE)
+ PRE = nil
+ end
+ unless defined?(::OmniAuth::Version::STRING)
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
+ end
+ end
+end
View
@@ -1 +0,0 @@
-0.2.4
@@ -0,0 +1,19 @@
+module OmniAuth
+ module Version
+ unless defined?(::OmniAuth::Version::MAJOR)
+ MAJOR = 0
+ end
+ unless defined?(::OmniAuth::Version::MINOR)
+ MINOR = 2
+ end
+ unless defined?(::OmniAuth::Version::PATCH)
+ PATCH = 4
+ end
+ unless defined?(::OmniAuth::Version::PRE)
+ PRE = nil
+ end
+ unless defined?(::OmniAuth::Version::STRING)
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
+ end
+ end
+end
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
-version = File.read("VERSION").strip
+require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
- gem.add_runtime_dependency 'oa-core', version
+ gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
gem.add_runtime_dependency 'rest-client', '~> 1.6.0'
gem.add_development_dependency 'maruku', '~> 0.6'
@@ -14,9 +14,9 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'yard', '~> 0.6'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-basic'
- gem.version = version
- gem.summary = %q{HTTP Basic strategies for OmniAuth.}
+ gem.version = OmniAuth::Version::STRING
gem.description = %q{HTTP Basic strategies for OmniAuth.}
+ gem.summary = gem.description
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
gem.homepage = 'http://github.com/intridea/omniauth'
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
View
@@ -1 +0,0 @@
-0.2.4
@@ -0,0 +1,19 @@
+module OmniAuth
+ module Version
+ unless defined?(::OmniAuth::Version::MAJOR)
+ MAJOR = 0
+ end
+ unless defined?(::OmniAuth::Version::MINOR)
+ MINOR = 2
+ end
+ unless defined?(::OmniAuth::Version::PATCH)
+ PATCH = 4
+ end
+ unless defined?(::OmniAuth::Version::PRE)
+ PRE = nil
+ end
+ unless defined?(::OmniAuth::Version::STRING)
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
+ end
+ end
+end
View
@@ -1,5 +1,5 @@
# -*- encoding: utf-8 -*-
-version = File.read("VERSION").strip
+require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
gem.add_development_dependency 'maruku', '~> 0.6'
@@ -10,9 +10,9 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'yard', '~> 0.6'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-core'
- gem.version = version
- gem.summary = %q{HTTP Basic strategies for OmniAuth.}
- gem.description = %q{HTTP Basic strategies for OmniAuth.}
+ gem.version = OmniAuth::Version::STRING
+ gem.description = %q{Core strategies for OmniAuth.}
+ gem.summary = gem.description
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
gem.homepage = 'http://github.com/intridea/omniauth'
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
View
@@ -1 +0,0 @@
-0.2.4
@@ -0,0 +1,19 @@
+module OmniAuth
+ module Version
+ unless defined?(::OmniAuth::Version::MAJOR)
+ MAJOR = 0
+ end
+ unless defined?(::OmniAuth::Version::MINOR)
+ MINOR = 2
+ end
+ unless defined?(::OmniAuth::Version::PATCH)
+ PATCH = 4
+ end
+ unless defined?(::OmniAuth::Version::PRE)
+ PRE = nil
+ end
+ unless defined?(::OmniAuth::Version::STRING)
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
+ end
+ end
+end
@@ -1,12 +1,12 @@
# -*- encoding: utf-8 -*-
-version = File.read("VERSION").strip
+require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
gem.add_runtime_dependency 'addressable', '2.2.4'
gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
gem.add_runtime_dependency 'nokogiri', '~> 1.4.2'
gem.add_runtime_dependency 'net-ldap', '~> 0.2.2'
- gem.add_runtime_dependency 'oa-core', version
+ gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
gem.add_runtime_dependency 'pyu-ruby-sasl', '~> 0.0.3.1'
gem.add_runtime_dependency 'rubyntlm', '~> 0.1.1'
gem.add_development_dependency 'maruku', '~> 0.6'
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'yard', '~> 0.6'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-enterprise'
- gem.version = version
- gem.summary = %q{Enterprise strategies for OmniAuth.}
+ gem.version = OmniAuth::Version::STRING
gem.description = %q{Enterprise strategies for OmniAuth.}
+ gem.summary = gem.description
gem.email = ['james.a.rosen@gmail.com', 'ping@intridea.com', 'michael@intridea.com', 'sferik@gmail.com']
gem.homepage = 'http://github.com/intridea/omniauth'
gem.authors = ['James A. Rosen', 'Ping Yu', 'Michael Bleigh', 'Erik Michaels-Ober']
View
@@ -1 +0,0 @@
-0.2.4
@@ -0,0 +1,19 @@
+module OmniAuth
+ module Version
+ unless defined?(::OmniAuth::Version::MAJOR)
+ MAJOR = 0
+ end
+ unless defined?(::OmniAuth::Version::MINOR)
+ MINOR = 2
+ end
+ unless defined?(::OmniAuth::Version::PATCH)
+ PATCH = 4
+ end
+ unless defined?(::OmniAuth::Version::PRE)
+ PRE = nil
+ end
+ unless defined?(::OmniAuth::Version::STRING)
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 8135885

Please sign in to comment.