Permalink
Browse files

Convert to Bundler gemspec style.

  • Loading branch information...
1 parent 5fddf12 commit ff00c09a9474564f2724ef072a82a2d45fba0cc5 Alexander Staubo committed Feb 7, 2012
Showing with 39 additions and 87 deletions.
  1. +3 −3 Gemfile
  2. +18 −35 Rakefile
  3. +0 −1 VERSION
  4. +15 −48 ar-multidb.gemspec
  5. +3 −0 lib/multidb/version.rb
View
@@ -1,4 +1,4 @@
-source 'http://rubygems.org/'
+source "http://rubygems.org"
-gem 'activesupport', '>= 2.2'
-gem 'activerecord', '>= 2.2'
+# Specify your gem's dependencies in ar-multidb.gemspec
+gemspec
View
@@ -1,38 +1,21 @@
-# encoding: utf-8
+require "bundler/gem_tasks"
-require 'rubygems'
-require 'rake'
-require 'rake/rdoctask'
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = 'ar-multidb'
- gem.summary = gem.description = %Q{Multidb is an ActiveRecord extension for switching between multiple database connections, such as master/slave setups.}
- gem.email = "alex@bengler.no"
- gem.homepage = "http://github.com/alexstaubo/multidb"
- gem.authors = ["Alexander Staubo"]
- gem.has_rdoc = true
- gem.require_paths = ["lib"]
- gem.files = FileList[%W(
- README.markdown
- VERSION
- LICENSE*
- lib/**/*
- )]
- gem.add_dependency 'activesupport', '>= 2.2'
- gem.add_dependency 'activerecord', '>= 2.2'
+desc 'Bump version'
+task :bump do
+ if `git status -uno -s --porcelain | wc -l`.to_i > 0
+ abort "You have uncommitted changed."
+ end
+ text = File.read('lib/multidb/version.rb')
+ if text =~ /VERSION = '(.*)'/
+ old_version = $1
+ version_parts = old_version.split('.')
+ version_parts[-1] = version_parts[-1].to_i + 1
+ new_version = version_parts.join('.')
+ text.gsub!(/VERSION = '(.*)'/, "VERSION = '#{new_version}'")
+ File.open('lib/multidb/version.rb', 'w') { |f| f << text }
+ (system("git add lib/multidb/version.rb") and
+ system("git commit -m 'Bump to #{new_version}.'")) or abort "Failed to commit."
+ else
+ abort "Could not find version number"
end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- $stderr << "Warning: Gem-building tasks are not included as Jeweler (or a dependency) not available. Install it with: `gem install jeweler`.\n"
-end
-
-Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "ruby-hdfs #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
end
View
@@ -1 +0,0 @@
-0.1.4
View
@@ -1,55 +1,22 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "multidb/version"
Gem::Specification.new do |s|
- s.name = %q{ar-multidb}
- s.version = "0.1.4"
+ s.name = "ar-multidb"
+ s.version = Multidb::VERSION
+ s.authors = ["Alexander Staubo"]
+ s.email = ["alex@origo.no"]
+ s.homepage = ""
+ s.summary = s.description = %q{Multidb is an ActiveRecord extension for switching between multiple database connections, such as master/slave setups.}
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Alexander Staubo"]
- s.date = %q{2011-05-20}
- s.description = %q{Multidb is an ActiveRecord extension for switching between multiple database connections, such as master/slave setups.}
- s.email = %q{alex@bengler.no}
- s.extra_rdoc_files = [
- "LICENSE",
- "README.markdown"
- ]
- s.files = [
- "LICENSE",
- "README.markdown",
- "VERSION",
- "lib/ar-multidb.rb",
- "lib/multidb.rb",
- "lib/multidb/balancer.rb",
- "lib/multidb/configuration.rb",
- "lib/multidb/model_extensions.rb"
- ]
- s.homepage = %q{http://github.com/alexstaubo/multidb}
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.5.0}
- s.summary = %q{Multidb is an ActiveRecord extension for switching between multiple database connections, such as master/slave setups.}
+ s.rubyforge_project = "ar-multidb"
- if s.respond_to? :specification_version then
- s.specification_version = 3
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activesupport>, [">= 2.2"])
- s.add_runtime_dependency(%q<activerecord>, [">= 2.2"])
- s.add_runtime_dependency(%q<activesupport>, [">= 2.2"])
- s.add_runtime_dependency(%q<activerecord>, [">= 2.2"])
- else
- s.add_dependency(%q<activesupport>, [">= 2.2"])
- s.add_dependency(%q<activerecord>, [">= 2.2"])
- s.add_dependency(%q<activesupport>, [">= 2.2"])
- s.add_dependency(%q<activerecord>, [">= 2.2"])
- end
- else
- s.add_dependency(%q<activesupport>, [">= 2.2"])
- s.add_dependency(%q<activerecord>, [">= 2.2"])
- s.add_dependency(%q<activesupport>, [">= 2.2"])
- s.add_dependency(%q<activerecord>, [">= 2.2"])
- end
+ s.add_runtime_dependency 'activesupport', '>= 2.3'
+ s.add_runtime_dependency 'activerecord', '>= 2.3'
end
-
View
@@ -0,0 +1,3 @@
+module Multidb
+ VERSION = '0.1.4'
+end

0 comments on commit ff00c09

Please sign in to comment.