rvm-tester 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +64 -4
- data/lib/rvm-tester.rb +21 -2
- metadata +6 -6
data/README.md
CHANGED
@@ -4,10 +4,26 @@ Runs tests across Ruby installations in RVM using concurrent worker processes.
|
|
4
4
|
This library does not sandbox installations, and requires that you have already
|
5
5
|
installed the necessary Ruby installations under RVM.
|
6
6
|
|
7
|
+
This project is heavily inspired by [Travis-CI](http://travis-ci.org), but is meant
|
8
|
+
to provide a more lightweight interface that can be run on your development machine
|
9
|
+
or a dedicated server. Because there is no VM sandboxing, you can also have more
|
10
|
+
control over your test environments, as well as your Ruby versions. Note that rvm-tester
|
11
|
+
is not meant as a replacement to Travis-CI, but rather to be used in parallel with
|
12
|
+
the service for extra coverage in different environments that might not be supported.
|
13
|
+
In other words, this tool is *not* a CI, but it can be used to perform useful local
|
14
|
+
debugging of tests under multiple Ruby environments.
|
15
|
+
|
7
16
|
## Installing
|
8
17
|
|
9
18
|
In addition to installing this library with `gem install rvm-tester`, you will also need
|
10
|
-
to setup
|
19
|
+
to setup RVM with the proper Ruby installations. RVM documentation can help with this,
|
20
|
+
but a simple command to install 1.8.7 would be:
|
21
|
+
|
22
|
+
$ rvm install 1.8.7
|
23
|
+
|
24
|
+
rvm-tester also works with Bundler and Travis-CI meta-data files to setup your
|
25
|
+
tests. See the Integration section below for more information on setting up
|
26
|
+
your environment with these tools.
|
11
27
|
|
12
28
|
## Usage
|
13
29
|
|
@@ -22,6 +38,7 @@ require 'rvm-tester'
|
|
22
38
|
RVM::Tester::TesterTask.new(:suite) do |t|
|
23
39
|
t.rubies = %w(1.8.6 1.8.7 1.9.2 1.9.3) # which versions to test (required!)
|
24
40
|
t.bundle_install = true # updates Gemfile.lock, default is true
|
41
|
+
t.use_travis = true # looks for Rubies in .travis.yml (on by default)
|
25
42
|
t.command = "bundle exec rake test" # runs plain "rake" by default
|
26
43
|
t.env = {"VERBOSE" => "1"} # set any ENV vars
|
27
44
|
t.num_workers = 5 # defaults to 3
|
@@ -29,7 +46,29 @@ RVM::Tester::TesterTask.new(:suite) do |t|
|
|
29
46
|
end
|
30
47
|
```
|
31
48
|
|
32
|
-
And simply run the task with `rake suite`.
|
49
|
+
And simply run the task with `rake suite`. The output will look something
|
50
|
+
like (output with `verbose=false`):
|
51
|
+
|
52
|
+
```plain
|
53
|
+
Installing Bundler and dependencies on 1.8.6,1.8.7,1.9.2,1.9.3...
|
54
|
+
Tests passed in 1.9.3 (1527 examples, 0 failures, 18.92sec)
|
55
|
+
Tests failed in 1.9.2 (1527 examples, 5 failures, 20.29sec)
|
56
|
+
Tests passed in 1.8.6 (1527 examples, 0 failures, 20.26sec)
|
57
|
+
Tests passed in 1.8.7 (1527 examples, 0 failures, 20.72sec)
|
58
|
+
|
59
|
+
Output for 1.9.2 (pid 11241 exit 1, cmd=rvm 1.9.2 do bundle exec rake test):
|
60
|
+
[SOME FAILING TEST OUTPUT HERE]
|
61
|
+
```
|
62
|
+
|
63
|
+
The Rake task also creates a task named "suite:deps" (or the task name + :deps)
|
64
|
+
to perform only the `bundle update` portion of the task. This allows you to
|
65
|
+
disable the automatic `bundle_install` setting, which can significantly
|
66
|
+
speed up the time to run tests, while still enabling you to manually run the
|
67
|
+
updater across all of your Ruby installations with the simple command:
|
68
|
+
|
69
|
+
```sh
|
70
|
+
$ rake suite:deps
|
71
|
+
```
|
33
72
|
|
34
73
|
### Runner Class
|
35
74
|
|
@@ -42,12 +81,33 @@ runner = RVM::Tester::Runner.new(:rubies => %w(rbx 1.9.3), :verbose => true)
|
|
42
81
|
runner.run
|
43
82
|
```
|
44
83
|
|
84
|
+
## Integration
|
85
|
+
|
86
|
+
### Bundler
|
87
|
+
|
88
|
+
If you have a Gemfile and use the "bundle_install" setting in RVM tester (on by
|
89
|
+
default), rvm-tester will also install the gem dependencies for your project before
|
90
|
+
running the tests. If you do not use Bundler, you will have to make sure that each
|
91
|
+
environment has the correct gems installed prior to testing. You can do this with
|
92
|
+
the following command:
|
93
|
+
|
94
|
+
$ rvm all do gem install gem1 gem2 gem3 ...
|
95
|
+
|
96
|
+
Where "gem1 gem2 gem3 ..." are the dependencies needed by your project.
|
97
|
+
|
98
|
+
### Travis-CI
|
99
|
+
|
100
|
+
rvm-tester can automatically detect a `.travis.yml` file in your project and
|
101
|
+
use it to detect Ruby versions and commands to execute. Note that currently,
|
102
|
+
only the "rvm", "script" and "env" fields are used from the configuration file.
|
103
|
+
If you do not want to use the `.travis.yml` file, set `use_travis = false`.
|
104
|
+
|
45
105
|
## Dependencies
|
46
106
|
|
47
|
-
This library depends on [RVM](http://rvm.
|
107
|
+
This library depends on [RVM](http://rvm.io) to control
|
48
108
|
Ruby installations and [mob_spawner](http://github.com/lsegal/mob_spawner) to
|
49
109
|
spawn worker processes.
|
50
110
|
|
51
111
|
## License & Copyright
|
52
112
|
|
53
|
-
|
113
|
+
RVM Tester is licensed under the MIT license, © 2012 Loren Segal
|
data/lib/rvm-tester.rb
CHANGED
@@ -4,7 +4,7 @@ require 'mob_spawner'
|
|
4
4
|
|
5
5
|
module RVM
|
6
6
|
module Tester
|
7
|
-
VERSION = '1.
|
7
|
+
VERSION = '1.1.0'
|
8
8
|
|
9
9
|
class TesterTask < ::Rake::TaskLib
|
10
10
|
def initialize(name = :suite)
|
@@ -12,6 +12,8 @@ module RVM
|
|
12
12
|
yield(runner) if block_given?
|
13
13
|
desc "Runs tests across RVM Rubies: #{runner.rubies.join(",")}"
|
14
14
|
task(name) { exit runner.run }
|
15
|
+
desc "Installs dependencies in Gemfile using Bundler for #{name}"
|
16
|
+
task("#{name}:deps") { runner.use_gemfile }
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
@@ -22,6 +24,7 @@ module RVM
|
|
22
24
|
attr_accessor :command
|
23
25
|
attr_accessor :verbose
|
24
26
|
attr_accessor :bundle_install
|
27
|
+
attr_accessor :use_travis
|
25
28
|
|
26
29
|
def initialize(opts = {})
|
27
30
|
super()
|
@@ -31,7 +34,9 @@ module RVM
|
|
31
34
|
self.rubies = []
|
32
35
|
self.verbose = false
|
33
36
|
self.bundle_install = true
|
37
|
+
self.use_travis = true
|
34
38
|
opts.each {|k,v| meth = "#{k}="; send(meth, v) if respond_to?(meth) }
|
39
|
+
load_travis_opts if use_travis
|
35
40
|
end
|
36
41
|
|
37
42
|
def run
|
@@ -42,7 +47,6 @@ module RVM
|
|
42
47
|
MobSpawner::Command.new(
|
43
48
|
:command => "rvm #{ruby} do #{command}",
|
44
49
|
:env => env, :data => {:ruby => ruby, :time => nil})
|
45
|
-
|
46
50
|
end
|
47
51
|
spawner = MobSpawner.new
|
48
52
|
spawner.commands = commands
|
@@ -100,6 +104,21 @@ module RVM
|
|
100
104
|
puts "Done."
|
101
105
|
end
|
102
106
|
|
107
|
+
def load_travis_opts
|
108
|
+
return unless File.file?(".travis.yml")
|
109
|
+
debug "Loading options from .travis.yml file"
|
110
|
+
require 'yaml'
|
111
|
+
yaml = YAML.load_file(".travis.yml")
|
112
|
+
self.rubies = yaml['rvm'] if yaml['rvm']
|
113
|
+
self.command = yaml['script'] if yaml['script']
|
114
|
+
[yaml['env']].flatten.compact.each do |envvar|
|
115
|
+
envvar.split(/\s+/).each do |subvar|
|
116
|
+
key, value = *subvar.split("=")
|
117
|
+
self.env[key] = value
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
103
122
|
def debug(info)
|
104
123
|
return unless verbose
|
105
124
|
puts(info)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rvm-tester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-10 00:00:00.000000000 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement: &
|
17
|
+
requirement: &70300117114540 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70300117114540
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: mob_spawner
|
28
|
-
requirement: &
|
28
|
+
requirement: &70300117113320 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70300117113320
|
37
37
|
description:
|
38
38
|
email: lsegal@soen.ca
|
39
39
|
executables: []
|