[Git][noosfero/noosfero][master] 4 commits: drop test:rcov task
Antonio Terceiro
gitlab at mg.gitlab.com
Tue Nov 10 19:42:22 BRST 2015
Antonio Terceiro pushed to branch master at Noosfero / noosfero
Commits:
0a886b64 by Antonio Terceiro at 2015-11-10T19:41:11Z
drop test:rcov task
rcov has been deprecated for a while
- - - - -
90a9d312 by Antonio Terceiro at 2015-11-10T19:41:11Z
Move ci run to script/ci
I wasn't able yet to figure out why the rake task was not behaving as
expected. I suspect it has to do with the order stuff is being loaded
being changed with Rails 4, but I am not sure yet. This works.
- - - - -
39a64217 by Antonio Terceiro at 2015-11-10T19:41:11Z
Remove bogus duplicated code
- - - - -
c1bebd4c by Antonio Terceiro at 2015-11-10T19:41:11Z
Move grape_routes task to its own file
- - - - -
6 changed files:
- Rakefile
- + lib/tasks/grape_routes.rb
- + lib/tasks/selenium
- lib/tasks/test.rake
- − lib/tasks/test_rcov.rake
- + script/ci
Changes:
=====================================
Rakefile
=====================================
--- a/Rakefile
+++ b/Rakefile
@@ -21,32 +21,3 @@ end
plugins_tasks = Dir.glob("config/plugins/*/{tasks,lib/tasks,rails/tasks}/**/*.rake").sort +
Dir.glob("config/plugins/*/vendor/plugins/*/{tasks,lib/tasks,rails/tasks}/**/*.rake").sort
plugins_tasks.each{ |ext| load ext }
-
-
-desc "Print out grape routes"
-task :grape_routes => :environment do
- #require 'api/api.rb'
- Noosfero::API::API.routes.each do |route|
- puts route
- method = route.route_method
- path = route.route_path
- puts " #{method} #{path}"
- end
-end
-
-# plugins' tasks
-plugins_tasks = Dir.glob("config/plugins/*/{tasks,lib/tasks,rails/tasks}/**/*.rake").sort +
- Dir.glob("config/plugins/*/vendor/plugins/*/{tasks,lib/tasks,rails/tasks}/**/*.rake").sort
-plugins_tasks.each{ |ext| load ext }
-
-
-desc "Print out grape routes"
-task :grape_routes => :environment do
- #require 'api/api.rb'
- Noosfero::API::API.routes.each do |route|
- puts route
- method = route.route_method
- path = route.route_path
- puts " #{method} #{path}"
- end
-end
=====================================
lib/tasks/grape_routes.rb
=====================================
--- /dev/null
+++ b/lib/tasks/grape_routes.rb
@@ -0,0 +1,10 @@
+desc "Print out grape routes"
+task :grape_routes => :environment do
+ #require 'api/api.rb'
+ Noosfero::API::API.routes.each do |route|
+ puts route
+ method = route.route_method
+ path = route.route_path
+ puts " #{method} #{path}"
+ end
+end
=====================================
lib/tasks/selenium
=====================================
--- /dev/null
+++ b/lib/tasks/selenium
@@ -0,0 +1,4 @@
+desc 'Runs Seleniun acceptance tests'
+task :selenium do
+ sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}"
+end
=====================================
lib/tasks/test.rake
=====================================
--- a/lib/tasks/test.rake
+++ b/lib/tasks/test.rake
@@ -1,39 +1 @@
-desc 'Runs Seleniun acceptance tests'
-task :selenium do
- sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}"
-end
-
-TestTasks = %w(test:units test:functionals test:integration)
-CucumberTasks = %w(cucumber selenium)
-NoosferoTasks = %w(test:noosfero_plugins)
-AllTasks = TestTasks + CucumberTasks + NoosferoTasks
-
-task 'ci:full' do
- data = []
- failed = []
- AllTasks.each do |task|
- t0 = Time.now.to_i
- begin
- ENV['RAILS_ENV'] = 'test'
- Rake::Task[task].invoke
- status = 'PASS'
- rescue => e
- failed << task
- status = 'FAIL'
- end
- t1 = Time.now.to_i
- duration = t1 - t0
- data << { :name => task, :status => status, :duration => Time.at(duration).utc.strftime("%H:%M:%S") }
- end
-
- puts
- printf "%-30s %-6s %s\n", 'Task', 'Status', 'Duration'
- printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
- data.each do |entry|
- printf "%-30s %-6s %s\n", entry[:name], entry[:status], entry[:duration]
- end
-
- puts
- abort "Errors running #{failed.join(', ')}!" if failed.any?
-end
=====================================
lib/tasks/test_rcov.rake deleted
=====================================
--- a/lib/tasks/test_rcov.rake
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2007, Keegan Quinn
-# Copyright (C) 2007, Colivre <http://www.colivre.coop.br>
-#
-# See http://keegan.sniz.net/articles/2007/05/27/showin-love-for-rails_rcov
-# for original source (a patch for rails_rcov).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-namespace :test do
- desc "Run all tests with Rcov to measure coverage"
- task :rcov do |t|
- require 'rbconfig'
-
- tests = Dir.glob(Rails.root.join('test', '*', '*_test.rb'))
- outdir = Rails.root.join('coverage')
- test_loader = File.join(Config::CONFIG['rubylibdir'], 'rake', 'rake_test_loader.rb')
-
- system("rcov", '-o', outdir, '-T', '-x', 'rubygems/*,rcov*', '--rails', '-Ilib:test', test_loader, *tests)
- end
-end
=====================================
script/ci
=====================================
--- /dev/null
+++ b/script/ci
@@ -0,0 +1,43 @@
+#!/usr/bin/env ruby
+
+tasks = %w[
+ test:units
+ test:functionals
+ test:integration
+ cucumber
+ selenium
+ test:noosfero_plugins
+]
+
+data = []
+failed = []
+tasks.each do |task|
+
+ puts task
+ puts task.gsub(/./, '-')
+ puts
+
+ t0 = Time.now.to_i
+ if system('rake', task)
+ status = 'PASS'
+ else
+ failed << task
+ status = 'FAIL'
+ end
+ t1 = Time.now.to_i
+ duration = t1 - t0
+ data << { :name => task, :status => status, :duration => Time.at(duration).utc.strftime("%H:%M:%S") }
+end
+
+puts
+puts
+printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
+printf "%-30s %-6s %s\n", 'Task', 'Status', 'Duration'
+printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
+data.each do |entry|
+ printf "%-30s %-6s %s\n", entry[:name], entry[:status], entry[:duration]
+end
+printf "%-30s %-6s %s\n", '-' * 30, '-' * 6, '--------'
+
+puts
+abort "Errors running #{failed.join(', ')}!" if failed.any?
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/8c6988805ef1474bfd7dcd8f92524f9eaf971eb8...c1bebd4c4670ce1d5eae712eaba0153774cb37c8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151110/0c33a5e4/attachment-0001.html>
More information about the Noosfero-dev
mailing list