ref: refs/heads/master
commit de0be9000857002aa6182bdec5a717e7fa0d1f18
Author: Josef Reidinger
Date: Thu Oct 1 15:35:40 2009 +0200
add new task for safety push
---
webservice-tasks/lib/tasks/build_test.rake | 29 ++++++++++++++++++++++++++++
webservice-tasks/lib/tasks/git_push.rake | 8 +++++++
webservice-tasks/lib/tasks/push.rake | 6 +++++
3 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/webservice-tasks/lib/tasks/build_test.rake b/webservice-tasks/lib/tasks/build_test.rake
new file mode 100644
index 0000000..14d6831
--- /dev/null
+++ b/webservice-tasks/lib/tasks/build_test.rake
@@ -0,0 +1,29 @@
+require 'rake'
+
+
+
+desc "Test builded package if it can build locally"
+task :'build_test' do
+ raise "No package/ directory found" if not File.exist?('package') and File.directory?('package')
+ package_name = ""
+ Dir.glob("package/*.spec").each do |file|
+ package_name = file.gsub( /package\/(.*).spec/, '\1')
+ end
+ puts "package is #{package_name}"
+ raise "cannot determine package name" if package_name.empty?
+ puts "checking out osc package to build"
+ `osc checkout 'YaST:Web' #{package_name}`
+ `rm -rf package/www`
+ `cp package/* 'YaST:Web/#{package_name}'`
+ Dir.chdir File.join(Dir.pwd, "YaST:Web", package_name)
+ puts "start building package"
+ puts `osc build`
+ if $?.exitstatus != 0
+ raise "Failed to build"
+ end
+ puts "package builded, cleaning"
+ Dir.chdir File.join(Dir.pwd, '..', '..')
+ `rm -rf 'YaST:WeB'`
+end
+
+
diff --git a/webservice-tasks/lib/tasks/git_push.rake b/webservice-tasks/lib/tasks/git_push.rake
new file mode 100644
index 0000000..83ea825
--- /dev/null
+++ b/webservice-tasks/lib/tasks/git_push.rake
@@ -0,0 +1,8 @@
+require 'rake'
+
+desc "Push to git repository. Don't use directly, use push instead!"
+task :git_push do
+ out = `git push`
+ puts '* GIT push OK'
+end
+
diff --git a/webservice-tasks/lib/tasks/push.rake b/webservice-tasks/lib/tasks/push.rake
new file mode 100644
index 0000000..d4feb0b
--- /dev/null
+++ b/webservice-tasks/lib/tasks/push.rake
@@ -0,0 +1,6 @@
+require 'rake'
+
+desc 'Push commits to git and checks if it doesn\'t break anything'
+# just call the checks and then build the package
+task :push => [:check_syntax, :test, :restdoc, :"package-local", :build_test, :git_push]
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org