qor_test 0.0.3 → 0.0.4
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 +69 -12
- data/bin/qor_test.rb +5 -1
- data/lib/qor_test/cli.rb +6 -8
- data/lib/qor_test/configuration.rb +5 -3
- data/lib/qor_test/version.rb +1 -1
- data/lib/qor_test.rb +0 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,30 +1,83 @@
|
|
1
1
|
# QorTest
|
2
2
|
|
3
|
+
QorTest is the tool to test your library against different versions of gem dependencies and rubies (through rbenv or rvm)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install qor_test
|
8
|
+
|
3
9
|
## Usage
|
4
10
|
|
5
|
-
|
11
|
+
First write a configuration file like below:
|
12
|
+
|
13
|
+
# config/qor/test.rb
|
14
|
+
env '2.0' do
|
15
|
+
ruby '2.0'
|
16
|
+
gem 'rails', [3.1, 3.2]
|
17
|
+
end
|
18
|
+
|
19
|
+
env '1.9.3' do
|
20
|
+
ruby '1.9.3'
|
21
|
+
gem 'rails', [3.1, 3.2]
|
22
|
+
end
|
23
|
+
|
24
|
+
env '1.8.7' do
|
25
|
+
ruby '1.8.7'
|
26
|
+
gem 'factory_girl_rails', '1.3.0'
|
27
|
+
gem 'rails', [3.1, 3.2]
|
28
|
+
end
|
29
|
+
|
30
|
+
Then QorTest will generate 6 test cases according to it.
|
6
31
|
|
7
|
-
|
32
|
+
1, run tests with rails 3.1 and ruby 2.0
|
33
|
+
2, run tests with rails 3.2 and ruby 2.0
|
34
|
+
3, run tests with rails 3.1 and ruby 1.9
|
35
|
+
4, run tests with rails 3.2 and ruby 1.9
|
36
|
+
5, run tests with rails 3.1 and ruby 1.8
|
37
|
+
6, run tests with rails 3.2 and ruby 1.8
|
8
38
|
|
9
|
-
|
10
|
-
gem 'nokogiri', :git => "git://github.com/tenderlove/nokogiri.git"
|
11
|
-
gem 'RedCloth', ">= 4.1.0", "< 4.2.0"
|
39
|
+
Then run all above 6 cases in your project root by running
|
12
40
|
|
13
|
-
|
41
|
+
qor_test
|
42
|
+
|
43
|
+
Or only run those two cases in the '2.0' env by running
|
44
|
+
|
45
|
+
qor_test -e '2.0'
|
46
|
+
|
47
|
+
All dependencies definitions outside env definition will be shared in all envs, so you could also simplify above configuration like below, it's the same!
|
48
|
+
|
49
|
+
# config/qor/test.rb
|
50
|
+
gem 'rails', [3.1, 3.2]
|
51
|
+
|
52
|
+
env '2.0' do
|
53
|
+
ruby '2.0'
|
54
|
+
end
|
55
|
+
|
56
|
+
env '1.9.3' do
|
14
57
|
ruby '1.9.3'
|
15
|
-
gem 'rails', ['3.1', '3.2', '4.0.0.beta']
|
16
58
|
end
|
17
59
|
|
18
60
|
env '1.8.7' do
|
19
61
|
ruby '1.8.7'
|
20
|
-
gem
|
62
|
+
gem 'factory_girl_rails', '1.3.0'
|
21
63
|
end
|
22
64
|
|
23
|
-
|
65
|
+
And you could write more advanced configuration:
|
66
|
+
|
67
|
+
# config/qor/test.rb
|
68
|
+
ruby '2.0'
|
69
|
+
ruby '1.9.3'
|
70
|
+
ruby '1.8.7'
|
71
|
+
|
72
|
+
gem 'paperclip', ['2.4.2', '3.3.0', {:git => "git@github.com:thoughtbot/paperclip.git", :branch => "master"}]
|
73
|
+
gem 'rails', [3.1, 3.2]
|
74
|
+
gem 'devise', [2.2.0, 2.1.0, 2.0.0]
|
24
75
|
|
25
|
-
|
26
|
-
|
27
|
-
|
76
|
+
With it, QorTest will generate 54 test cases! (3 rubies x 3 paperclip x 2 rails x 3 devise), so it is dead easy to discover hidden compatibility issues!
|
77
|
+
|
78
|
+
Running `qor_test` will use `rake spec` to run tests in each case for projects using rspec and `rake test` for others. but you could specify the test command by overwrite the environment variable 'COMMAND', e.g:
|
79
|
+
|
80
|
+
COMMAND='ruby test/xxxx.rb' qor_test
|
28
81
|
|
29
82
|
## Contributing
|
30
83
|
|
@@ -33,3 +86,7 @@
|
|
33
86
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
34
87
|
4. Push to the branch (`git push origin my-new-feature`)
|
35
88
|
5. Create new Pull Request
|
89
|
+
|
90
|
+
## Author ##
|
91
|
+
**Jinzhu**
|
92
|
+
* <http://github.com/jinzhu>
|
data/bin/qor_test.rb
CHANGED
@@ -48,9 +48,13 @@ envs = options[:env] ? [options[:env]] : Qor::Test::Configuration.envs
|
|
48
48
|
envs = [nil] if envs.size == 0
|
49
49
|
|
50
50
|
$case_num = 0
|
51
|
+
|
51
52
|
scripts = envs.map do |env|
|
52
|
-
Qor::Test::CLI.new(options.merge(:env => env))
|
53
|
+
cli = Qor::Test::CLI.new(options.merge(:env => env))
|
54
|
+
cli.run
|
55
|
+
cli.scripts
|
53
56
|
end
|
57
|
+
|
54
58
|
scripts.unshift "total_cases_num=#{$case_num}"
|
55
59
|
|
56
60
|
open(ENV['QOR_TEST_SCRIPT_FILE'] || 'qor_test.sh', 'a') do |f|
|
data/lib/qor_test/cli.rb
CHANGED
@@ -26,19 +26,17 @@ module Qor
|
|
26
26
|
def run
|
27
27
|
rubies.map do |version|
|
28
28
|
scripts << Qor::Test::Rubies.switch_ruby_version(version)
|
29
|
-
gemfiles.map
|
30
|
-
$case_num += 1
|
31
|
-
scripts << "echo -n '\n\e[01;31m[ENV #{gemfile.group_name}] \e[0m'"
|
32
|
-
scripts << "echo -n '\e[31mRunning case #{$case_num} with ruby '$(ruby -v)', '$[$total_cases_num-#{$case_num}]' cases left\e[0m\n'"
|
33
|
-
run_with_gemfile(file)
|
34
|
-
end
|
29
|
+
gemfiles.map { |file| run_with_gemfile(file) }
|
35
30
|
end
|
36
|
-
self
|
37
31
|
rescue Qor::Dsl::ConfigurationNotFound
|
38
32
|
puts "ConfigurationNotFound, please run `qor_test --init` in project's root to get a sample configuration"
|
39
33
|
end
|
40
34
|
|
41
35
|
def run_with_gemfile(file)
|
36
|
+
$case_num += 1
|
37
|
+
scripts << "echo -n '\n\e[01;31m[ENV #{gemfile.group_name}] \e[0m'"
|
38
|
+
scripts << "echo -n '\e[31mRunning case #{$case_num} with ruby '$(ruby -v)', '$[$total_cases_num-#{$case_num}]' cases left\e[0m\n'"
|
39
|
+
|
42
40
|
lock_file = "#{file}.lock"
|
43
41
|
temp_file = "QorTest_" + File.basename(file)
|
44
42
|
temp_lock = "#{temp_file}.lock"
|
@@ -51,7 +49,7 @@ module Qor
|
|
51
49
|
scripts << "echo '>> BUNDLE_GEMFILE=#{file}'"
|
52
50
|
scripts << "export BUNDLE_GEMFILE=#{temp_file}"
|
53
51
|
|
54
|
-
# Test commands
|
52
|
+
# Test commands
|
55
53
|
[
|
56
54
|
"bundle install --quiet",
|
57
55
|
"#{options[:command]}".sub(/^(bundle\s+exec\s+)?/, 'bundle exec ')
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'qor_dsl'
|
1
2
|
require 'digest/md5'
|
2
3
|
|
3
4
|
module Qor
|
@@ -18,7 +19,7 @@ module Qor
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def self.config_path
|
21
|
-
"config/qor/test.rb"
|
22
|
+
[ENV['QOR_TEST_CONFIG'], "config/qor/test.rb"].detect {|x| File.exist?(x.to_s)}
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.gemfile_path
|
@@ -50,8 +51,9 @@ module Qor
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def self.ruby_versions(options)
|
53
|
-
|
54
|
-
|
54
|
+
[root_from_config, root_from_gemfile] do |x|
|
55
|
+
x.deep_find('ruby', &find_block(options))
|
56
|
+
end.flatten.compact.map(&:value)
|
55
57
|
end
|
56
58
|
|
57
59
|
def self.envs(options={})
|
data/lib/qor_test/version.rb
CHANGED
data/lib/qor_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qor_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: qor_dsl
|