Skip to content

Commit

Permalink
add rakefile with test and release tasks; add version file
Browse files Browse the repository at this point in the history
  • Loading branch information
vjoel committed Feb 15, 2014
1 parent 7afa392 commit 4dc9959
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 2 deletions.
91 changes: 91 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
require 'rake'
require 'rake/testtask'

PRJ = "bud"

def version
@version ||= begin
$LOAD_PATH.unshift 'lib'
require 'bud/version'
warn "Bud::VERSION not a string" unless Bud::VERSION.kind_of? String
Bud::VERSION
end
end

def tag
@tag ||= "v#{version}"
end

desc "Run all tests"
task :test => "test:unit"

TESTS = FileList["test/tc_*.rb"]
SLOW_TESTS = %w{ test/tc_execmodes.rb }

namespace :test do
desc "Run unit tests"
Rake::TestTask.new :unit do |t|
t.libs << "lib"
t.ruby_opts = %w{ -C test }
t.test_files = TESTS.sub('test/', '')
### it would be better to make each tc_*.rb not depend on pwd
end

desc "Run quick unit tests"
Rake::TestTask.new :quick do |t|
t.libs << "lib"
t.ruby_opts = %w{ -C test }
t.test_files = TESTS.exclude(*SLOW_TESTS).sub('test/', '')
end

desc "Run quick non-zk unit tests"
Rake::TestTask.new :quick_no_zk do |t|
t.libs << "lib"
t.ruby_opts = %w{ -C test }
t.test_files = TESTS.
exclude('test/tc_zookeeper.rb').
exclude(*SLOW_TESTS).
sub('test/', '')
end
end

desc "Commit, tag, and push repo; build and push gem"
task :release => "release:is_new_version" do
require 'tempfile'

sh "gem build #{PRJ}.gemspec"

file = Tempfile.new "template"
begin
file.puts "release #{version}"
file.close
sh "git commit --allow-empty -a -v -t #{file.path}"
ensure
file.close unless file.closed?
file.unlink
end

sh "git tag #{tag}"
sh "git push"
sh "git push --tags"

sh "gem push #{tag}.gem"
end

namespace :release do
desc "Diff to latest release"
task :diff do
latest = `git describe --abbrev=0 --tags --match 'v*'`.chomp
sh "git diff #{latest}"
end

desc "Log to latest release"
task :log do
latest = `git describe --abbrev=0 --tags --match 'v*'`.chomp
sh "git log #{latest}.."
end

task :is_new_version do
abort "#{tag} exists; update version!" unless `git tag -l #{tag}`.empty?
end
end
7 changes: 5 additions & 2 deletions bud.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
$LOAD_PATH.unshift 'lib'
require 'bud/version'

Gem::Specification.new do |s|
s.name = "bud"
s.version = "0.9.8"
s.version = Bud::VERSION
s.authors = ["Peter Alvaro", "Neil Conway", "Joseph M. Hellerstein", "William R. Marczak", "Sriram Srinivasan"]
s.email = ["[email protected]"]
s.summary = "A prototype Bloom DSL for distributed programming."
Expand All @@ -11,7 +14,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 1.8.7'
s.rubyforge_project = 'bloom-lang'

s.files = Dir['lib/**/*'] + Dir['bin/*'] + Dir['docs/**/*'] + Dir['examples/**/*'] + %w[README.md LICENSE History.txt]
s.files = Dir['lib/**/*'] + Dir['bin/*'] + Dir['docs/**/*'] + Dir['examples/**/*'] + %w[README.md LICENSE History.txt Rakefile]
s.executables = %w[rebl budplot budvis budtimelines budlabel]
s.default_executable = 'rebl'

Expand Down
3 changes: 3 additions & 0 deletions lib/bud/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Bud
VERSION = "0.9.8"
end

0 comments on commit 4dc9959

Please sign in to comment.