rakefile.rb in mudbug-0.4.6.7 vs rakefile.rb in mudbug-0.4.7.1
- old
+ new
@@ -1,29 +1,40 @@
require 'rubygems/package_task'
+require 'rake/testtask'
+Rake::TestTask.new :test do |t|
+ t.pattern = 'test/*.rb'
+end
+
PROJECT_ROOT = File.dirname(__FILE__)
PROJECT_NAME = File.split(PROJECT_ROOT).last
VERSION_FILE = File.join(PROJECT_ROOT, 'VERSION')
MANIFEST_FILE = File.join(PROJECT_ROOT, 'MANIFEST.txt')
def version
File.read(VERSION_FILE).chomp
end
-def manifest
- File.readlines(MANIFEST_FILE).map { |line| line.chomp }
-end
-
task :version do
puts "#{PROJECT_NAME} #{version}"
end
+task :tag => [:test] do
+ tagname = "v#{version}"
+ sh "git tag -a #{tagname} -m 'auto-tagged #{tagname} by Rake'"
+ sh "git push origin --tags"
+end
+
+def manifest
+ File.readlines(MANIFEST_FILE).map { |line| line.chomp }
+end
+
task :manifest do
puts manifest.join("\n")
end
-task :build do
+task :build => [:test, :bump_build] do
spec = Gem::Specification.new do |s|
# Static assignments
s.name = "mudbug"
s.summary = "This hardy creature consumes JSON / REST APIs"
s.description = "GET, POST, PUT, and DELETE JSON payloads. Easy Accept headers. Fine-grained response handling using Mudbug#resource."
@@ -37,11 +48,11 @@
s.version = version
s.date = Time.now.strftime("%Y-%m-%d")
s.add_runtime_dependency "rest-client", ["~> 1"]
s.add_runtime_dependency "json", ["~> 1"]
- s.add_runtime_dependency "lager", [">= 0"]
+ s.add_runtime_dependency "lager", [">= 0.2"]
s.add_development_dependency "minitest", [">= 0"]
s.add_development_dependency "rake", [">= 0"]
end
# we're definining the task at runtime, rather than requiretime
@@ -83,29 +94,18 @@
sh "git commit -m 'rake bump_#{v}'"
end
}
task :bump => [:bump_patch]
-task :tag do
- tagname = "v#{version}"
- sh "git tag -a #{tagname} -m 'auto-tagged #{tagname} by Rake'"
- sh "git push origin --tags"
-end
-
-task :release => [:bump_build, :tag, :publish]
-task :release_patch => [:bump_patch, :tag, :publish]
-task :release_minor => [:bump_minor, :tag, :publish]
-task :release_major => [:bump_major, :tag, :publish]
-
task :verify_publish_credentials do
creds = '~/.gem/credentials'
fp = File.expand_path(creds)
raise "#{creds} does not exist" unless File.exists?(fp)
raise "can't read #{creds}" unless File.readable?(fp)
end
-task :publish => [:verify_publish_credentials, :build] do
+task :publish => [:verify_publish_credentials] do
fragment = "-#{version}.gem"
pkg_dir = File.join(PROJECT_ROOT, 'pkg')
Dir.chdir(pkg_dir) {
candidates = Dir.glob "*#{fragment}"
case candidates.length
@@ -116,5 +116,18 @@
else
raise "multiple candidates found matching #{fragment}"
end
}
end
+
+task :gitpush do
+ # may prompt
+ sh "git push origin"
+ # this kills the automation
+ # use key-based auth?
+ # consider a timeout?
+end
+
+task :release => [:build, :tag, :publish, :gitpush]
+task :release_patch => [:bump_patch, :release]
+task :release_minor => [:bump_minor, :release]
+task :release_major => [:bump_major, :release]