Permalink
Browse files

removing rake build tasks

  • Loading branch information...
1 parent 2a686be commit 53428818d848327388be1c81708766b58cb1c092 @georgi georgi committed Nov 15, 2011
Showing with 6 additions and 185 deletions.
  1. +2 −168 Rakefile
  2. +1 −0 VERSION
  3. +0 −1 lib/master_slave_adapter.rb
  4. +3 −16 master_slave_adapter.gemspec
View
170 Rakefile
@@ -1,168 +1,2 @@
-require 'rubygems'
-require 'rake'
-require 'date'
-
-#############################################################################
-#
-# Helper functions
-#
-#############################################################################
-
-def name
- @name ||= Dir['*.gemspec'].first.split('.').first
-end
-
-def version
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
- line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
-end
-
-def date
- Date.today.to_s
-end
-
-def rubyforge_project
- name
-end
-
-def gemspec_file
- "#{name}.gemspec"
-end
-
-def gemspec
- @gemspec ||= eval(IO.read(gemspec_file))
-end
-
-def gem_file
- gemspec.file_name
-end
-
-def replace_header(head, header_name)
- head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
-end
-
-#############################################################################
-#
-# Standard tasks
-#
-#############################################################################
-
-task :default => :test
-
-require 'rake/testtask'
-Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
-end
-
-desc "Generate RCov test coverage and open in your browser"
-task :coverage do
- require 'rcov'
- sh "rm -fr coverage"
- sh "rcov test/test_*.rb"
- sh "open coverage/index.html"
-end
-
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "#{name} #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
-desc "Open an irb session preloaded with this library"
-task :console do
- sh "irb -rubygems -r ./lib/#{name}.rb"
-end
-
-#############################################################################
-#
-# Custom tasks (add your own tasks here)
-#
-#############################################################################
-
-
-
-#############################################################################
-#
-# Packaging tasks
-#
-#############################################################################
-
-desc "Deploys the builded gem to the soundcloud gem repository: gems.soundcloud.com"
-task :release => :build do
- remote_gem_host = 'soundcloud@gems.int.s-cloud.net'
- remote_gem_path = '/srv/www/gems'
- Dir.chdir File.dirname(__FILE__)
- unless `git branch` =~ /^\* master$/
- puts "You must be on the master branch to release!"
- exit!
- end
- if `git fetch --tags && git tag`.split(/\n/).include?(gem_file)
- raise "Version #{gem_file} already deployed"
- end
- sh <<-END
- git commit -a --allow-empty -m 'Release #{gem_file}'
- git tag -a #{gem_file} -m 'Version #{gem_file}'
- git push origin master
- git push origin --tags
- scp pkg/#{gem_file} #{remote_gem_host}:#{remote_gem_path}/gems && \
- ssh #{remote_gem_host} 'gem generate_index -d #{remote_gem_path}'
- END
-end
-
-desc "Build #{gem_file} into the pkg directory"
-task :build => :gemspec do
- sh "mkdir -p pkg"
- sh "gem build #{gemspec_file}"
- sh "mv #{gem_file} pkg"
-end
-
-desc "Generate #{gemspec_file}"
-task :gemspec => :validate do
- # read spec file and split out manifest section
- spec = File.read(gemspec_file)
- head, manifest, tail = spec.split(" # = MANIFEST =\n")
-
- # replace name version and date
- # replace_header(head, :name)
- replace_header(head, :version)
- replace_header(head, :date)
- #comment this out if your rubyforge_project has a different name
- replace_header(head, :rubyforge_project)
-
- # determine file list from git ls-files
- files = `git ls-files`.
- split("\n").
- sort.
- reject { |file| file =~ /^\./ }.
- reject { |file| file =~ /^(rdoc|pkg)/ }.
- map { |file| " #{file}" }.
- join("\n")
-
- # piece file back together and write
- manifest = " s.files = %w[\n#{files}\n ]\n"
- spec = [head, manifest, tail].join(" # = MANIFEST =\n")
- File.open(gemspec_file, 'w') { |io| io.write(spec) }
- puts "Updated #{gemspec_file}"
-end
-
-desc "Validate #{gemspec_file}"
-task :validate do
- libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/active_record" ]
- unless libfiles.empty?
- puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
- exit!
- end
- unless Dir['VERSION*'].empty?
- puts "A `VERSION` file at root level violates Gem best practices."
- exit!
- end
-
- #unless name =~ /\Asc-/
- # puts "Gem name should start with sc-"
- # exit
- #end
-end
+require 'bundler'
+Bundler::GemHelper.install_tasks
View
@@ -0,0 +1 @@
+0.1.7
@@ -87,7 +87,6 @@ def log_info(sql, name, ms)
end
class MasterSlaveAdapter < AbstractAdapter
- VERSION = '0.1.8'
class Clock
include Comparable
@@ -1,10 +1,9 @@
-# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = 'master_slave_adapter_soundcloud'
- s.version = '0.1.8'
- s.date = '2011-11-15'
+ s.version = File.read('VERSION').to_s
+ s.date = '2011-08-24'
s.platform = Gem::Platform::RUBY
s.authors = [ 'Mauricio Linhares', 'Torsten Curdt', 'Kim Altintop', 'Omid Aladini', 'SoundCloud' ]
s.email = %q{kim@soundcloud.com tcurdt@soundcloud.com omid@soundcloud.com}
@@ -21,17 +20,5 @@ Gem::Specification.new do |s|
s.required_rubygems_version = '>= 1.3.7'
s.add_development_dependency 'rspec'
- s.add_dependency 'activerecord', '>= 2.3.9'
- # = MANIFEST =
- s.files = %w[
- Gemfile
- LICENSE
- Rakefile
- Readme.md
- lib/active_record/connection_adapters/master_slave_adapter.rb
- lib/master_slave_adapter.rb
- master_slave_adapter.gemspec
- specs/specs.rb
- ]
- # = MANIFEST =
+ s.add_dependency 'activerecord', '~> 2.3.9'
end

0 comments on commit 5342881

Please sign in to comment.