rubytest-rake 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.index +55 -0
- data/.yardopts +10 -0
- data/HISTORY.md +10 -0
- data/LICENSE.txt +33 -0
- data/README.md +67 -0
- data/lib/rubytest-rake.rb +118 -0
- data/lib/rubytest/rake.rb +1 -0
- data/test/helper.rb +0 -0
- data/test/test_basic.rb +13 -0
- metadata +110 -0
data/.index
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
revision: 2013
|
3
|
+
type: ruby
|
4
|
+
sources:
|
5
|
+
- var
|
6
|
+
authors:
|
7
|
+
- name: trans
|
8
|
+
email: transfire@gmail.com
|
9
|
+
organizations: []
|
10
|
+
requirements:
|
11
|
+
- name: rake
|
12
|
+
- groups:
|
13
|
+
- build
|
14
|
+
development: true
|
15
|
+
name: fire
|
16
|
+
- groups:
|
17
|
+
- build
|
18
|
+
development: true
|
19
|
+
name: detroit
|
20
|
+
conflicts: []
|
21
|
+
alternatives: []
|
22
|
+
resources:
|
23
|
+
- type: home
|
24
|
+
uri: http://rubyworks.github.com/rubytest-rake
|
25
|
+
label: Homepage
|
26
|
+
- type: code
|
27
|
+
uri: http://github.com/rubyworks/rubytest-rake
|
28
|
+
label: Source Code
|
29
|
+
- type: bugs
|
30
|
+
uri: http://github.com/rubyworks/rubytest-rake/issues
|
31
|
+
label: Issue Tracker
|
32
|
+
- type: mail
|
33
|
+
uri: http://groups.google.com/group/rubyworks-mailinglist
|
34
|
+
label: Mailing List
|
35
|
+
repositories:
|
36
|
+
- name: upstream
|
37
|
+
scm: git
|
38
|
+
uri: git@github.com:rubyworks/rubytest-rake.git
|
39
|
+
categories: []
|
40
|
+
copyrights:
|
41
|
+
- holder: RubyWorks
|
42
|
+
year: '2011'
|
43
|
+
license: BSD-2-Clause
|
44
|
+
customs: []
|
45
|
+
paths:
|
46
|
+
lib:
|
47
|
+
- lib
|
48
|
+
created: '2011-07-23'
|
49
|
+
summary: Rake Plugin for Ruby Test
|
50
|
+
title: Rake for Ruby Test
|
51
|
+
version: 0.1.0
|
52
|
+
name: rubytest-rake
|
53
|
+
description: Rake plugin for Ruby Test. Ruby Test is a universal test harness for
|
54
|
+
Ruby.
|
55
|
+
date: '2013-02-18'
|
data/.yardopts
ADDED
data/HISTORY.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# COPYRIGHT NOTICES
|
2
|
+
|
3
|
+
## Ruby Test
|
4
|
+
|
5
|
+
**Project** | Ruby Test
|
6
|
+
--------------|------------------------------------------
|
7
|
+
**Website** | http://rubyworks.github.com/ruby-test
|
8
|
+
**License** | BSD-2-Clause
|
9
|
+
**Copyright** | (c) 2011 Rubyworks
|
10
|
+
|
11
|
+
Copyright 2011 Rubyworks. All rights reserved.
|
12
|
+
|
13
|
+
Redistribution and use in source and binary forms, with or without
|
14
|
+
modification, are permitted provided that the following conditions are met:
|
15
|
+
|
16
|
+
1. Redistributions of source code must retain the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer.
|
18
|
+
|
19
|
+
2. Redistributions in binary form must reproduce the above copyright
|
20
|
+
notice, this list of conditions and the following disclaimer in the
|
21
|
+
documentation and/or other materials provided with the distribution.
|
22
|
+
|
23
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
+
COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
28
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
30
|
+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
31
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
32
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Rake for Ruby Test
|
2
|
+
|
3
|
+
[Homepage](http://rubyworks.github.com/rubytest-rake) /
|
4
|
+
[User Guide](http://wiki.github.com/rubyworks/rubytest-rake) /
|
5
|
+
[Development](http://github.com/rubyworks/rubytest-rake) /
|
6
|
+
[Issues](http://github.com/rubyworks/rubytest-rake/issues)
|
7
|
+
|
8
|
+
[![Build Status](https://secure.travis-ci.org/rubyworks/rubytest-rake.png)](http://travis-ci.org/rubyworks/rubytest-rake)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/rubytest-rake.png)](http://badge.fury.io/rb/rubytest-rake)
|
10
|
+
|
11
|
+
|
12
|
+
This gem provides a plug-in for running Ruby Test based test framework
|
13
|
+
tests via Rake.
|
14
|
+
|
15
|
+
Note that this implmentation does not shell-out, so tests are run from the
|
16
|
+
same process as Rake. While it probably makes no difference, if you need a
|
17
|
+
more prestine test environment in which Rake is not present, then use
|
18
|
+
a different approach to running tests, such as writing a custom runner
|
19
|
+
and shelling out to it.
|
20
|
+
|
21
|
+
|
22
|
+
## Installation
|
23
|
+
|
24
|
+
#### RubyGems
|
25
|
+
|
26
|
+
$ gem install rubytest-rake
|
27
|
+
|
28
|
+
#### Bundler
|
29
|
+
|
30
|
+
Using Bundler add to your Gemfile:
|
31
|
+
|
32
|
+
gem 'rubytest'
|
33
|
+
gem 'rubytest-rake'
|
34
|
+
|
35
|
+
Then on the command line:
|
36
|
+
|
37
|
+
$ bundle install
|
38
|
+
|
39
|
+
|
40
|
+
## Instruction
|
41
|
+
|
42
|
+
In your Rakefile add:
|
43
|
+
|
44
|
+
require 'rubytest-rake'
|
45
|
+
|
46
|
+
Test::Rake::TestTask.new do |run|
|
47
|
+
run.load_path 'lib'
|
48
|
+
run.test_files << 'test/test_*.rb'
|
49
|
+
end
|
50
|
+
|
51
|
+
The Rake task constructor supports the same interface as `Test.configure`.
|
52
|
+
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
If you use Rake and Ruby Test, please consider helping to make the Rake
|
57
|
+
plugin better!
|
58
|
+
|
59
|
+
|
60
|
+
## Copyrights
|
61
|
+
|
62
|
+
(BSD-2-Clause)
|
63
|
+
|
64
|
+
Copyright (c) 2012 Rubyworks
|
65
|
+
|
66
|
+
See LICENSE.txt for details.
|
67
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'rubytest'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
module Test
|
5
|
+
|
6
|
+
##
|
7
|
+
# Rake subspace.
|
8
|
+
#
|
9
|
+
module Rake
|
10
|
+
|
11
|
+
##
|
12
|
+
# Define a test rake task.
|
13
|
+
#
|
14
|
+
# The `TEST` environment variable can be used to select tests
|
15
|
+
# when using this task. Note, this is just a more convenient
|
16
|
+
# way than using `RUBYTEST_FILES`.
|
17
|
+
#
|
18
|
+
class TestTask < ::Rake::TaskLib
|
19
|
+
|
20
|
+
# Glob patterns are used by default to select test scripts.
|
21
|
+
DEFAULT_TESTS = [
|
22
|
+
'test/**/case_*.rb',
|
23
|
+
'test/**/*_case.rb',
|
24
|
+
'test/**/test_*.rb',
|
25
|
+
'test/**/*_test.rb'
|
26
|
+
]
|
27
|
+
|
28
|
+
# Test run configuration.
|
29
|
+
#
|
30
|
+
# @return [Config]
|
31
|
+
attr :config
|
32
|
+
|
33
|
+
# Initialize new Rake::TestTask instance.
|
34
|
+
#
|
35
|
+
def initialize(name='test', desc='run tests', &block)
|
36
|
+
@name = name || 'test'
|
37
|
+
@desc = desc
|
38
|
+
|
39
|
+
@config = Test::Config.new
|
40
|
+
|
41
|
+
@config.files << default_tests if @config.files.empty?
|
42
|
+
@config.loadpath << 'lib' if @config.loadpath.empty?
|
43
|
+
|
44
|
+
block.call(@config)
|
45
|
+
|
46
|
+
define_task
|
47
|
+
end
|
48
|
+
|
49
|
+
# Define rake task for testing.
|
50
|
+
#
|
51
|
+
# @return nothing
|
52
|
+
def define_task
|
53
|
+
desc @desc
|
54
|
+
task @name do
|
55
|
+
config.mode == 'shell' ? run_shell : run
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Run tests, via fork is possible, otherwise straight out.
|
60
|
+
#
|
61
|
+
# @return nothing
|
62
|
+
def run
|
63
|
+
if Process.respond_to?(:fork)
|
64
|
+
fork {
|
65
|
+
runner = Test::Runner.new(config)
|
66
|
+
success = runner.run
|
67
|
+
exit -1 unless success
|
68
|
+
}
|
69
|
+
Process.wait
|
70
|
+
else
|
71
|
+
runner = Test::Runner.new(config)
|
72
|
+
success = runner.run
|
73
|
+
exit -1 unless success
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Run test via shell. (Not Currently Used)
|
78
|
+
#
|
79
|
+
# Note, the problem with this approach is that before and after
|
80
|
+
# procedures cannot be passed along. In it's current form it
|
81
|
+
# also requires that `rubytest-cli` be installed.
|
82
|
+
#
|
83
|
+
# @return nothing
|
84
|
+
def shell_run
|
85
|
+
success = ruby('rubytest', *config.to_shellwords)
|
86
|
+
exit -1 unless success
|
87
|
+
end
|
88
|
+
|
89
|
+
## Resolve test globs.
|
90
|
+
##
|
91
|
+
## @todo Implementation probably can be simplified.
|
92
|
+
## @return [Array<String>] List of test files.
|
93
|
+
#def test_files
|
94
|
+
# files = tests
|
95
|
+
# files = files.map{ |f| Dir[f] }.flatten
|
96
|
+
# files = files.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }
|
97
|
+
# files = files.flatten.uniq
|
98
|
+
# files = files.map{ |f| File.expand_path(f) }
|
99
|
+
# files
|
100
|
+
#end
|
101
|
+
|
102
|
+
# Default test globs. For extra convenience will look for list in
|
103
|
+
# `ENV['TEST']` first.
|
104
|
+
#
|
105
|
+
# @return [Array<String>]
|
106
|
+
def default_tests
|
107
|
+
if ENV['TEST']
|
108
|
+
ENV['TEST'].split(/[:;]/)
|
109
|
+
else
|
110
|
+
DEFAULT_TESTS
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative '../rubytest-rake'
|
data/test/helper.rb
ADDED
File without changes
|
data/test/test_basic.rb
ADDED
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubytest-rake
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- trans
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: fire
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: detroit
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Rake plugin for Ruby Test. Ruby Test is a universal test harness for
|
63
|
+
Ruby.
|
64
|
+
email:
|
65
|
+
- transfire@gmail.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files:
|
69
|
+
- LICENSE.txt
|
70
|
+
- HISTORY.md
|
71
|
+
- README.md
|
72
|
+
files:
|
73
|
+
- .index
|
74
|
+
- .yardopts
|
75
|
+
- lib/rubytest-rake.rb
|
76
|
+
- lib/rubytest/rake.rb
|
77
|
+
- test/helper.rb
|
78
|
+
- test/test_basic.rb
|
79
|
+
- LICENSE.txt
|
80
|
+
- HISTORY.md
|
81
|
+
- README.md
|
82
|
+
homepage: http://rubyworks.github.com/rubytest-rake
|
83
|
+
licenses:
|
84
|
+
- BSD-2-Clause
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.8.24
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: Rake Plugin for Ruby Test
|
107
|
+
test_files:
|
108
|
+
- test/helper.rb
|
109
|
+
- test/test_basic.rb
|
110
|
+
has_rdoc:
|