infinity_test 1.0.2 → 2.0.0.rc1
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.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +31 -0
- data/.gitignore +3 -0
- data/.rspec +2 -2
- data/AI_INTEGRATION_IDEAS.md +203 -0
- data/Gemfile +3 -15
- data/History.markdown +82 -0
- data/INFINITY_TEST +48 -0
- data/LICENSE.txt +2 -2
- data/README.md +627 -0
- data/Rakefile +1 -65
- data/TODO.markdown +26 -9
- data/bin/infinity_test +1 -4
- data/images/fuuu/pending.png +0 -0
- data/images/fuuu/success.png +0 -0
- data/infinity_test.gemspec +41 -191
- data/lib/infinity_test/core/auto_discover.rb +67 -0
- data/lib/infinity_test/core/base.rb +369 -0
- data/lib/infinity_test/core/callback.rb +59 -0
- data/lib/infinity_test/core/changed_file.rb +13 -0
- data/lib/infinity_test/core/command_builder.rb +48 -0
- data/lib/infinity_test/core/command_runner.rb +62 -0
- data/lib/infinity_test/core/configuration_merge.rb +37 -0
- data/lib/infinity_test/core/continuous_test_server.rb +106 -0
- data/lib/infinity_test/core/load_configuration.rb +48 -0
- data/lib/infinity_test/core/notifier.rb +59 -0
- data/lib/infinity_test/core/options.rb +134 -0
- data/lib/infinity_test/core/runner.rb +18 -0
- data/lib/infinity_test/core/version.rb +5 -0
- data/lib/infinity_test/framework/base.rb +57 -0
- data/lib/infinity_test/framework/padrino.rb +33 -0
- data/lib/infinity_test/framework/rails.rb +35 -0
- data/lib/infinity_test/framework/rubygems.rb +29 -0
- data/lib/infinity_test/framework/shared_example.rb +47 -0
- data/lib/infinity_test/observer/base.rb +40 -0
- data/lib/infinity_test/observer/filewatcher.rb +72 -0
- data/lib/infinity_test/observer/listen.rb +74 -0
- data/lib/infinity_test/observer/shared_example.rb +35 -0
- data/lib/infinity_test/old_dsl/configuration.rb +26 -0
- data/lib/infinity_test/strategy/base.rb +34 -0
- data/lib/infinity_test/strategy/rbenv.rb +32 -0
- data/lib/infinity_test/strategy/ruby_default.rb +20 -0
- data/lib/infinity_test/strategy/rvm.rb +50 -0
- data/lib/infinity_test/strategy/shared_example.rb +32 -0
- data/lib/infinity_test/test_framework/base.rb +64 -0
- data/lib/infinity_test/test_framework/rspec.rb +48 -0
- data/lib/infinity_test/test_framework/shared_example.rb +56 -0
- data/lib/infinity_test/test_framework/test_unit.rb +57 -0
- data/lib/infinity_test.rb +53 -35
- data/spec/infinity_test/core/auto_discover_spec.rb +149 -0
- data/spec/infinity_test/core/base_spec.rb +240 -0
- data/spec/infinity_test/core/callback_spec.rb +89 -0
- data/spec/infinity_test/core/changed_file_spec.rb +26 -0
- data/spec/infinity_test/core/command_builder_spec.rb +38 -0
- data/spec/infinity_test/core/configuration_merge_spec.rb +124 -0
- data/spec/infinity_test/core/continuous_test_server_spec.rb +116 -0
- data/spec/infinity_test/core/load_configuration_spec.rb +43 -0
- data/spec/infinity_test/core/notifier_spec.rb +151 -0
- data/spec/infinity_test/core/options_spec.rb +168 -0
- data/spec/infinity_test/core/runner_spec.rb +17 -0
- data/spec/infinity_test/framework/base_spec.rb +55 -0
- data/spec/infinity_test/framework/padrino_spec.rb +36 -0
- data/spec/infinity_test/framework/rails_spec.rb +36 -0
- data/spec/infinity_test/framework/rubygems_spec.rb +34 -0
- data/spec/infinity_test/observer/base_spec.rb +78 -0
- data/spec/infinity_test/observer/filewatcher_spec.rb +51 -0
- data/spec/infinity_test/observer/listen_spec.rb +50 -0
- data/spec/infinity_test/{builder_spec.rb → strategy/base_spec.rb} +1 -2
- data/spec/infinity_test/strategy/rbenv_spec.rb +53 -0
- data/spec/infinity_test/strategy/ruby_default_spec.rb +32 -0
- data/spec/infinity_test/strategy/rvm_spec.rb +69 -0
- data/spec/infinity_test/test_framework/rspec_spec.rb +119 -0
- data/spec/infinity_test/test_framework/test_unit_spec.rb +193 -0
- data/spec/spec_helper.rb +34 -119
- metadata +276 -205
- data/.infinity_test +0 -36
- data/.rvmrc +0 -1
- data/Gemfile.lock +0 -62
- data/Readme.markdown +0 -122
- data/Tasks +0 -4
- data/VERSION.yml +0 -5
- data/buzz_images/buzz_lightyear.jpg +0 -0
- data/buzz_images/buzz_lightyear_continencia.gif +0 -0
- data/buzz_images/to_infinity_and_beyond.png +0 -0
- data/features/heuristics.feature +0 -23
- data/features/support/env.rb +0 -2
- data/images/fuuu/sucess.png +0 -0
- data/lib/infinity_test/application.rb +0 -355
- data/lib/infinity_test/application_library/rails.rb +0 -94
- data/lib/infinity_test/application_library/rubygems.rb +0 -43
- data/lib/infinity_test/binary_path.rb +0 -43
- data/lib/infinity_test/builder.rb +0 -67
- data/lib/infinity_test/command.rb +0 -58
- data/lib/infinity_test/configuration.rb +0 -273
- data/lib/infinity_test/continuous_testing.rb +0 -40
- data/lib/infinity_test/dependencies.rb +0 -80
- data/lib/infinity_test/environment.rb +0 -15
- data/lib/infinity_test/heuristics.rb +0 -36
- data/lib/infinity_test/heuristics_helper.rb +0 -9
- data/lib/infinity_test/options.rb +0 -89
- data/lib/infinity_test/runner.rb +0 -38
- data/lib/infinity_test/test_framework.rb +0 -109
- data/lib/infinity_test/test_library/bacon.rb +0 -55
- data/lib/infinity_test/test_library/cucumber.rb +0 -22
- data/lib/infinity_test/test_library/rspec.rb +0 -58
- data/lib/infinity_test/test_library/test_unit.rb +0 -52
- data/lib/infinity_test/test_unit_loader.rb +0 -5
- data/spec/factories/buzz/lib/buzz.rb +0 -0
- data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
- data/spec/factories/company/Gemfile +0 -0
- data/spec/factories/company/lib/company.rb +0 -0
- data/spec/factories/company/test/company_test.rb +0 -0
- data/spec/factories/images/failure.png +0 -0
- data/spec/factories/images/pending.png +0 -0
- data/spec/factories/images/sucess.png +0 -0
- data/spec/factories/infinity_test +0 -5
- data/spec/factories/infinity_test_example +0 -7
- data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
- data/spec/factories/travel/lib/travel.rb +0 -0
- data/spec/factories/travel/test/partner_test.rb +0 -0
- data/spec/factories/travel/test/travel_test.rb +0 -0
- data/spec/factories/wood/lib/wood.rb +0 -0
- data/spec/factories/wood/spec/wood_spec.rb +0 -0
- data/spec/infinity_test/application_library/rails_spec.rb +0 -140
- data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
- data/spec/infinity_test/application_spec.rb +0 -424
- data/spec/infinity_test/binary_path_spec.rb +0 -72
- data/spec/infinity_test/command_spec.rb +0 -53
- data/spec/infinity_test/configuration_spec.rb +0 -377
- data/spec/infinity_test/continuous_testing_spec.rb +0 -25
- data/spec/infinity_test/environment_spec.rb +0 -23
- data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
- data/spec/infinity_test/heuristics_spec.rb +0 -127
- data/spec/infinity_test/options_spec.rb +0 -91
- data/spec/infinity_test/runner_spec.rb +0 -42
- data/spec/infinity_test/test_framework_spec.rb +0 -127
- data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
- data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
- data/spec/infinity_test/test_library/rspec_spec.rb +0 -185
- data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
- data/spec/infinity_test_spec.rb +0 -40
- /data/images/faces/{sucess.png → success.png} +0 -0
- /data/images/hands/{sucess.png → success.png} +0 -0
- /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
- /data/images/rails/{sucess.png → success.png} +0 -0
- /data/images/rubies/{sucess.png → success.png} +0 -0
- /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
- /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
- /data/images/toy_story/{sucess.png → success.png} +0 -0
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module Builder
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# TODO: Refactoring this Ugly Code
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
def construct_command(options)
|
|
9
|
-
binary_name, ruby_version, command, file, environment = resolve_options(options)
|
|
10
|
-
|
|
11
|
-
unless have_binary?(binary_name) || options[:skip_binary?]
|
|
12
|
-
print_message(binary_name, ruby_version)
|
|
13
|
-
|
|
14
|
-
else
|
|
15
|
-
command = "#{command} #{decide_files(file)}"
|
|
16
|
-
rvm_ruby_version = "rvm #{ruby_version} ruby"
|
|
17
|
-
|
|
18
|
-
if application.have_gemfile? and not application.skip_bundler?
|
|
19
|
-
run_with_bundler!(rvm_ruby_version, command, environment)
|
|
20
|
-
else
|
|
21
|
-
run_without_bundler!(rvm_ruby_version, command)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
def run_with_bundler!(rvm_ruby_version, command, environment)
|
|
29
|
-
bundle_binary = search_bundle(environment)
|
|
30
|
-
unless have_binary?(bundle_binary)
|
|
31
|
-
print_message('bundle', environment.expanded_name)
|
|
32
|
-
else
|
|
33
|
-
%{#{rvm_ruby_version} #{bundle_binary} exec #{command}}
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
def run_without_bundler!(rvm_ruby_version, command)
|
|
39
|
-
%{#{rvm_ruby_version} #{command}}
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
#
|
|
43
|
-
# Contruct all the Commands for each ruby instance variable
|
|
44
|
-
# If don't want to run with many rubies, add the current ruby to the rubies instance
|
|
45
|
-
# and create the command with current ruby
|
|
46
|
-
#
|
|
47
|
-
def construct_commands(file=nil)
|
|
48
|
-
@rubies << RVM::Environment.current.environment_name if @rubies.empty?
|
|
49
|
-
construct_rubies_commands(file)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
#
|
|
53
|
-
# TODO: Refactoring this Ugly Code
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
def resolve_options(options)
|
|
57
|
-
ruby_version = options[:for]
|
|
58
|
-
binary_name = options[:skip_binary?] ? '' : options[:binary]
|
|
59
|
-
load_path = %{-I"#{options[:load_path]}"} if options[:load_path]
|
|
60
|
-
environment = options[:environment]
|
|
61
|
-
file = options[:file]
|
|
62
|
-
command = [ binary_name, load_path].compact.join(' ')
|
|
63
|
-
[binary_name, ruby_version, command, file, environment]
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class Command
|
|
3
|
-
attr_accessor :command, :results, :line, :ruby_version
|
|
4
|
-
|
|
5
|
-
# Create new Command object that receive the ruby_version and the command string
|
|
6
|
-
#
|
|
7
|
-
def initialize(options={})
|
|
8
|
-
@command = options[:command]
|
|
9
|
-
@ruby_version = options[:ruby_version]
|
|
10
|
-
@current_ruby_string = RVM::Environment.current_ruby_string
|
|
11
|
-
@results = []
|
|
12
|
-
@line = []
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# Code taken in Autotest gem and change a little
|
|
16
|
-
#
|
|
17
|
-
def run!
|
|
18
|
-
old_sync = $stdout.sync
|
|
19
|
-
$stdout.sync = true
|
|
20
|
-
begin
|
|
21
|
-
open("| #{@command}", "r") do |file|
|
|
22
|
-
until file.eof? do
|
|
23
|
-
test_line = file.getc or break
|
|
24
|
-
if yarv?
|
|
25
|
-
print(test_line)
|
|
26
|
-
else
|
|
27
|
-
putc(test_line)
|
|
28
|
-
end
|
|
29
|
-
@line.push(test_line)
|
|
30
|
-
push_in_the_results(test_line)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
ensure
|
|
34
|
-
$stdout.sync = old_sync
|
|
35
|
-
end
|
|
36
|
-
@results = @results.join
|
|
37
|
-
self
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Push in the results the test line
|
|
41
|
-
# If have in the Ruby Enterpise Edition or Ruby 1.8.* pack the numbers returned.
|
|
42
|
-
# Join otherwise.
|
|
43
|
-
#
|
|
44
|
-
def push_in_the_results(test_line)
|
|
45
|
-
if test_line == ?\n
|
|
46
|
-
@results.push(yarv? ? @line.join : @line.pack('c*'))
|
|
47
|
-
@line.clear
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# Using yarv?
|
|
52
|
-
#
|
|
53
|
-
def yarv?
|
|
54
|
-
@current_ruby_string =~ /ruby-1.9/
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class Configuration
|
|
3
|
-
|
|
4
|
-
SUPPORTED_FRAMEWORKS = [:growl, :lib_notify] # :snarl, :lib_notify
|
|
5
|
-
|
|
6
|
-
attr_accessor :notification_framework,
|
|
7
|
-
:sucess_image, :failure_image, :pending_image,
|
|
8
|
-
:rubies, :test_framework, :app_framework,
|
|
9
|
-
:exceptions_to_ignore, :cucumber,
|
|
10
|
-
:before_callback, :before_each_ruby_callback, :before_environment_callback,
|
|
11
|
-
:after_callback, :after_each_ruby_callback,
|
|
12
|
-
:verbose
|
|
13
|
-
|
|
14
|
-
IMAGES_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'images'))
|
|
15
|
-
|
|
16
|
-
SUCESS = 'sucess'
|
|
17
|
-
FAILURE = 'failure'
|
|
18
|
-
PENDING = 'pending'
|
|
19
|
-
|
|
20
|
-
# Initialize the Configuration object that keeps the images, callbacks, rubies
|
|
21
|
-
# and the test framework
|
|
22
|
-
#
|
|
23
|
-
def initialize
|
|
24
|
-
@default_dir_image = File.join(IMAGES_DIR, 'simpson')
|
|
25
|
-
@test_framework = :test_unit
|
|
26
|
-
@app_framework = :rubygems
|
|
27
|
-
@sucess_image = search_image(SUCESS)
|
|
28
|
-
@failure_image = search_image(FAILURE)
|
|
29
|
-
@pending_image = search_image(PENDING)
|
|
30
|
-
@verbose = false
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Set the notification framework to use with Infinity Test.
|
|
34
|
-
# The supported Notification Frameworks are:
|
|
35
|
-
#
|
|
36
|
-
# * Growl
|
|
37
|
-
# * Lib-Notify
|
|
38
|
-
#
|
|
39
|
-
# Here is the example of little Domain Specific Language to use:
|
|
40
|
-
#
|
|
41
|
-
# notifications :growl do
|
|
42
|
-
# # block
|
|
43
|
-
# end
|
|
44
|
-
#
|
|
45
|
-
# notifications :lib_notify
|
|
46
|
-
#
|
|
47
|
-
def notifications(framework, &block)
|
|
48
|
-
message = "Notification :#{framework} don't supported. The Frameworks supported are: #{SUPPORTED_FRAMEWORKS.join(',')}"
|
|
49
|
-
raise NotificationFrameworkDontSupported, message unless SUPPORTED_FRAMEWORKS.include?(framework)
|
|
50
|
-
@notification_framework = framework
|
|
51
|
-
yield self if block_given?
|
|
52
|
-
self
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Set the Success and Failure image to show in the notification framework
|
|
56
|
-
#
|
|
57
|
-
# show_images :failure => 'Users/tomas/images/my_custom_image.png', :sucess => 'custom_image.jpg'
|
|
58
|
-
#
|
|
59
|
-
# Or you cant set modes(directory) for show images (please see the images folder in => http://github.com/tomas-stefano/infinity_test/tree/master/images/ )
|
|
60
|
-
#
|
|
61
|
-
# show_images :mode => :simpson # => This will show images in the folder http://github.com/tomas-stefano/infinity_test/tree/master/images/simpson
|
|
62
|
-
# show_images :mode => :street_fighter # => This will show images in folder http://github.com/tomas-stefano/infinity_test/tree/master/images/street_fighter
|
|
63
|
-
# show_images :mode => '~/My/Mode' # => This will show images in the '~/My/Mode' directory
|
|
64
|
-
#
|
|
65
|
-
# The Convention in images folder is to set sucess, failure and pending images, and
|
|
66
|
-
# Infinity test will work on these names in the notification framework
|
|
67
|
-
#
|
|
68
|
-
def show_images(options={})
|
|
69
|
-
switch_mode!(options[:mode]) if options[:mode]
|
|
70
|
-
@sucess_image = options[:sucess] || search_image(SUCESS)
|
|
71
|
-
@failure_image = options[:failure] || search_image(FAILURE)
|
|
72
|
-
@pending_image = options[:pending] || search_image(PENDING)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Switch the image directory to show
|
|
76
|
-
#
|
|
77
|
-
def switch_mode!(mode)
|
|
78
|
-
case mode
|
|
79
|
-
when Symbol
|
|
80
|
-
@default_dir_image = File.join(IMAGES_DIR, mode.to_s)
|
|
81
|
-
when String
|
|
82
|
-
@default_dir_image = File.expand_path(File.join(mode))
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# Search the sucess, failure or pending images and return the first in the pattern
|
|
87
|
-
#
|
|
88
|
-
def search_image(file)
|
|
89
|
-
Dir.glob(File.join(@default_dir_image, file) + '*').first
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
# The options method to set:
|
|
93
|
-
#
|
|
94
|
-
# * test framework
|
|
95
|
-
# * ruby versions
|
|
96
|
-
# * verbose mode
|
|
97
|
-
# * app_framework
|
|
98
|
-
#
|
|
99
|
-
# Here is the example of Little Domain Language:
|
|
100
|
-
#
|
|
101
|
-
# use :rubies => ['1.9.1', '1.9.2'], :test_framework => :rspec
|
|
102
|
-
#
|
|
103
|
-
# use :rubies => [ '1.8.7-p249', '1.9.2@rails3'], :test_framework => :test_unit
|
|
104
|
-
#
|
|
105
|
-
# use :test_framework => :rspec, :app_framework => :rails
|
|
106
|
-
#
|
|
107
|
-
def use(options={})
|
|
108
|
-
rubies = options[:rubies]
|
|
109
|
-
@rubies = (rubies.is_a?(Array) ? rubies.join(',') : rubies) || []
|
|
110
|
-
@test_framework = options[:test_framework] || @test_framework
|
|
111
|
-
@app_framework = options[:app_framework] || @app_framework
|
|
112
|
-
@verbose = options[:verbose] || @verbose
|
|
113
|
-
@cucumber = options[:cucumber]
|
|
114
|
-
setting_gemset_for_each_rubies(options[:gemset]) if options[:gemset]
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# Setting a gemset for each rubies
|
|
118
|
-
#
|
|
119
|
-
# setting_gemset_for_each_rubies('infinity_test') # => ['1.8.7@infinity_test', '1.9.2@infinity_test']
|
|
120
|
-
#
|
|
121
|
-
def setting_gemset_for_each_rubies(gemset)
|
|
122
|
-
@rubies = @rubies.split(',').collect { |ruby| ruby << "@#{gemset}" }.join(',')
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
# InfinityTest try to use bundler if Gemfile is present.
|
|
126
|
-
# This method tell to InfinityTest to not use this convention.
|
|
127
|
-
#
|
|
128
|
-
def skip_bundler!
|
|
129
|
-
@skip_bundler = true
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# Return false if you want the InfinityTest run with bundler
|
|
133
|
-
#
|
|
134
|
-
def skip_bundler?
|
|
135
|
-
@skip_bundler ? true : false
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def cucumber?
|
|
139
|
-
@cucumber
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
# Method to use to ignore some dir/files changes
|
|
143
|
-
#
|
|
144
|
-
# Example:
|
|
145
|
-
#
|
|
146
|
-
# ignore :exceptions => %w(.svn .hg .git vendor tmp config rerun.txt)
|
|
147
|
-
#
|
|
148
|
-
# This is useless right now in the Infinity Test because the library
|
|
149
|
-
# only monitoring lib and test/spec/feature folder.
|
|
150
|
-
#
|
|
151
|
-
def ignore(options={})
|
|
152
|
-
@exceptions_to_ignore = options[:exceptions] || []
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
# Callback method to run anything you want, before the run the test suite command
|
|
156
|
-
#
|
|
157
|
-
# Example:
|
|
158
|
-
#
|
|
159
|
-
# before_run do
|
|
160
|
-
# clear :terminal
|
|
161
|
-
# end
|
|
162
|
-
#
|
|
163
|
-
def before_run(&block)
|
|
164
|
-
@before_callback = block
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
# Callback method to run anything you want, after the run the test suite command
|
|
168
|
-
#
|
|
169
|
-
# Example:
|
|
170
|
-
#
|
|
171
|
-
# after_run do
|
|
172
|
-
# # some code that I want to run after all the rubies run
|
|
173
|
-
# end
|
|
174
|
-
#
|
|
175
|
-
def after_run(&block)
|
|
176
|
-
@after_callback = block
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
# Callback method to handle before or after all run and for each ruby too!
|
|
180
|
-
#
|
|
181
|
-
# Example:
|
|
182
|
-
#
|
|
183
|
-
# before(:all) do
|
|
184
|
-
# clear :terminal
|
|
185
|
-
# end
|
|
186
|
-
#
|
|
187
|
-
# before(:each_ruby) do
|
|
188
|
-
# ...
|
|
189
|
-
# end
|
|
190
|
-
#
|
|
191
|
-
# Or if you pass not then will use :all option
|
|
192
|
-
#
|
|
193
|
-
# before do
|
|
194
|
-
# clear :terminal
|
|
195
|
-
# end
|
|
196
|
-
#
|
|
197
|
-
#
|
|
198
|
-
def before(hook=:all, &block)
|
|
199
|
-
setting_callback(hook, :all => :@before_callback, :each_ruby => :@before_each_ruby_callback, :env => :@before_environment_callback, &block)
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
# Callback method to handle before or after all run and for each ruby too!
|
|
203
|
-
#
|
|
204
|
-
# Example:
|
|
205
|
-
#
|
|
206
|
-
# after(:all) do
|
|
207
|
-
# clear :terminal
|
|
208
|
-
# end
|
|
209
|
-
#
|
|
210
|
-
# after(:each_ruby) do
|
|
211
|
-
# ...
|
|
212
|
-
# end
|
|
213
|
-
#
|
|
214
|
-
# Or if you pass not then will use :all option
|
|
215
|
-
#
|
|
216
|
-
# after do
|
|
217
|
-
# clear :terminal
|
|
218
|
-
# end
|
|
219
|
-
#
|
|
220
|
-
def after(hook=:all, &block)
|
|
221
|
-
setting_callback(hook, :all => :@after_callback, :each_ruby => :@after_each_ruby_callback, &block)
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
# Clear the terminal (Useful in the before callback)
|
|
225
|
-
#
|
|
226
|
-
def clear(option)
|
|
227
|
-
system('clear') if option == :terminal
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
def replace_patterns(&block)
|
|
231
|
-
block.call(InfinityTest.application)
|
|
232
|
-
InfinityTest.application
|
|
233
|
-
end
|
|
234
|
-
alias :before_env :replace_patterns
|
|
235
|
-
|
|
236
|
-
# Added heuristics to the User application
|
|
237
|
-
#
|
|
238
|
-
def heuristics(&block)
|
|
239
|
-
@heuristics ||= Heuristics.new
|
|
240
|
-
@heuristics.instance_eval(&block)
|
|
241
|
-
@heuristics
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
# Set #watch methods (For more information see Watchr gem)
|
|
245
|
-
#
|
|
246
|
-
# If don't want the heuristics 'magic'
|
|
247
|
-
#
|
|
248
|
-
def watch(pattern, &block)
|
|
249
|
-
@script ||= InfinityTest.watchr
|
|
250
|
-
@script.watch(pattern, &block)
|
|
251
|
-
@script
|
|
252
|
-
end
|
|
253
|
-
|
|
254
|
-
private
|
|
255
|
-
|
|
256
|
-
def setting_callback(hook, callback, &block)
|
|
257
|
-
if hook == :all
|
|
258
|
-
instance_variable_set(callback[:all], block)
|
|
259
|
-
elsif hook == :each_ruby
|
|
260
|
-
instance_variable_set(callback[:each_ruby], block)
|
|
261
|
-
end
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
end
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
class NotificationFrameworkDontSupported < StandardError
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
def infinity_test(&block)
|
|
271
|
-
InfinityTest.configuration.instance_eval(&block)
|
|
272
|
-
InfinityTest.configuration
|
|
273
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class ContinuousTesting
|
|
3
|
-
attr_accessor :application, :watchr, :global_commands
|
|
4
|
-
|
|
5
|
-
def initialize
|
|
6
|
-
@application = InfinityTest.application
|
|
7
|
-
@watchr = InfinityTest.watchr
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
##################
|
|
11
|
-
# Watchr Methods #
|
|
12
|
-
##################
|
|
13
|
-
|
|
14
|
-
def initialize_watchr!
|
|
15
|
-
add_signal
|
|
16
|
-
run_with_watchr!
|
|
17
|
-
end
|
|
18
|
-
alias :start! :initialize_watchr!
|
|
19
|
-
|
|
20
|
-
def run_with_watchr!
|
|
21
|
-
Watchr::Controller.new(@watchr, Watchr.handler.new).run
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def add_signal
|
|
25
|
-
Signal.trap 'INT' do
|
|
26
|
-
if @sent_an_int then
|
|
27
|
-
puts " Shutting down now"
|
|
28
|
-
exit
|
|
29
|
-
else
|
|
30
|
-
puts " Interrupt a second time to quit"
|
|
31
|
-
@sent_an_int = true
|
|
32
|
-
Kernel.sleep 1.1
|
|
33
|
-
@application.run_global_commands!
|
|
34
|
-
@sent_an_int = false
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class Dependencies
|
|
3
|
-
|
|
4
|
-
RVM_HOME_DIRECTORY = File.expand_path("~/.rvm/lib")
|
|
5
|
-
|
|
6
|
-
RVM_SYSTEM_WIDE_DIRECTORY = "/usr/local/rvm/lib"
|
|
7
|
-
|
|
8
|
-
RVM_LIBRARY_DIRECTORY = File.expand_path("~/.rvm/lib")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class << self
|
|
12
|
-
|
|
13
|
-
def require_rvm_ruby_api
|
|
14
|
-
require 'rvm'
|
|
15
|
-
RVM::Environment
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
# Try to require the rvm in home folder
|
|
20
|
-
# If not suceed raise a LoadError
|
|
21
|
-
# Try to see if the user has the RVM 1.0 or higher for the RVM Ruby API
|
|
22
|
-
# If not raise a NameError
|
|
23
|
-
#
|
|
24
|
-
def require_home_rvm
|
|
25
|
-
$LOAD_PATH.unshift(RVM_HOME_DIRECTORY) unless $LOAD_PATH.include?(RVM_HOME_DIRECTORY)
|
|
26
|
-
require_rvm_ruby_api
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def require_rvm_system_wide
|
|
30
|
-
$LOAD_PATH.unshift(RVM_SYSTEM_WIDE_DIRECTORY) unless $LOAD_PATH.include?(RVM_SYSTEM_WIDE_DIRECTORY)
|
|
31
|
-
require_rvm_ruby_api
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def try_to_require_system_wide
|
|
35
|
-
begin
|
|
36
|
-
require_rvm_system_wide
|
|
37
|
-
rescue LoadError, NameError
|
|
38
|
-
print_info_about_rvm
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def require_rvm
|
|
43
|
-
begin
|
|
44
|
-
require_home_rvm
|
|
45
|
-
rescue LoadError, NameError
|
|
46
|
-
try_to_require_system_wide
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def require_without_rubygems(options)
|
|
51
|
-
gem_name = options[:gem]
|
|
52
|
-
begin
|
|
53
|
-
require gem_name
|
|
54
|
-
rescue LoadError
|
|
55
|
-
require 'rubygems'
|
|
56
|
-
require gem_name
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def print_info_about_rvm
|
|
61
|
-
puts
|
|
62
|
-
puts "It appears that you have not installed the RVM library in #{RVM_HOME_DIRECTORY} or in #{RVM_SYSTEM_WIDE_DIRECTORY} or RVM is very old.\n"
|
|
63
|
-
puts "The RVM is installed?"
|
|
64
|
-
puts "If not, please see http://rvm.beginrescueend.com/rvm/install/"
|
|
65
|
-
puts "If so, try to run:"
|
|
66
|
-
puts "\t rvm update --head (or if you're using the head of rvm try: rvm get head)"
|
|
67
|
-
puts "\nIf the error continues, please create an issue in http://github.com/tomas-stefano/infinity_test"
|
|
68
|
-
puts 'Thanks :)'
|
|
69
|
-
puts
|
|
70
|
-
exit
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
InfinityTest::Dependencies.require_rvm
|
|
79
|
-
InfinityTest::Dependencies.require_without_rubygems :gem => 'watchr'
|
|
80
|
-
InfinityTest::Dependencies.require_without_rubygems :gem => 'notifiers'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module Environment
|
|
3
|
-
|
|
4
|
-
# Run in context of each Ruby Environment, and the Ruby Version
|
|
5
|
-
#
|
|
6
|
-
def environments(&block)
|
|
7
|
-
raise unless block_given?
|
|
8
|
-
RVM.environments(rubies).each do |environment|
|
|
9
|
-
ruby_version = environment.environment_name
|
|
10
|
-
block.call(environment, ruby_version)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class Heuristics
|
|
3
|
-
attr_reader :patterns, :script
|
|
4
|
-
|
|
5
|
-
def initialize
|
|
6
|
-
@patterns = {}
|
|
7
|
-
@script = InfinityTest.watchr
|
|
8
|
-
@application = InfinityTest.application
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def add(pattern, &block)
|
|
12
|
-
@patterns[pattern] = block
|
|
13
|
-
@script.watch(pattern, &block) # Watchr
|
|
14
|
-
@patterns
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def remove(pattern)
|
|
18
|
-
if pattern == :all
|
|
19
|
-
@patterns.clear
|
|
20
|
-
@script.rules.clear
|
|
21
|
-
else
|
|
22
|
-
@patterns.delete(pattern)
|
|
23
|
-
@script.rules.delete_if { |rule| rule.pattern == pattern }
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def all
|
|
28
|
-
@patterns.keys
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def run(options)
|
|
32
|
-
@application.run_commands_for_file(@application.files_to_run!(options))
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
require 'optparse'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
class Options < Hash
|
|
5
|
-
|
|
6
|
-
def initialize(arguments)
|
|
7
|
-
super()
|
|
8
|
-
@options = OptionParser.new do |options|
|
|
9
|
-
[:test_unit, :rspec, :bacon, :rubygems, :rails, :rubies, :verbose, :patterns, :bundler, :version].each do |name|
|
|
10
|
-
send("parse_#{name}", options)
|
|
11
|
-
end
|
|
12
|
-
options.banner = [ "Usage: infinity_test [options]", "Starts a continuous test server."].join("\n")
|
|
13
|
-
options.on_tail("--help", "You're looking at it.") do
|
|
14
|
-
print options.help
|
|
15
|
-
exit
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
@options.parse!(arguments.clone)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def parse_rspec(options)
|
|
22
|
-
options.on('--rspec', 'Test Framework: Rspec') do
|
|
23
|
-
self[:test_framework] = :rspec
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def parse_test_unit(options)
|
|
28
|
-
options.on('--test-unit', 'Test Framework: Test Unit [Default]') do
|
|
29
|
-
self[:test_framework] = :test_unit
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def parse_bacon(options)
|
|
34
|
-
options.on('--bacon', 'Test Framework: Bacon') do
|
|
35
|
-
self[:test_framework] = :bacon
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def parse_rubies(options)
|
|
40
|
-
options.on('--rubies=rubies', 'Specify the Ruby Versions for Testing with many Rubies') do |versions|
|
|
41
|
-
self[:rubies] = versions
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def parse_verbose(options)
|
|
46
|
-
options.on('--verbose', 'The Infinity Test dont print the commands', 'To print the commands set this option!') do
|
|
47
|
-
self[:verbose] = true
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def parse_rails(options)
|
|
52
|
-
options.on('--rails', 'Application Framework: Rails') do
|
|
53
|
-
self[:app_framework] = :rails
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def parse_rubygems(options)
|
|
58
|
-
options.on('--rubygems', 'Application Framework: Rubygems (Default)') do
|
|
59
|
-
self[:app_framework] = :rubygems
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# def parse_cucumber(options)
|
|
64
|
-
# options.on('--cucumber', 'Run with the Cucumber too') do
|
|
65
|
-
# self[:cucumber] = true
|
|
66
|
-
# end
|
|
67
|
-
# end
|
|
68
|
-
|
|
69
|
-
def parse_patterns(options)
|
|
70
|
-
options.on('--heuristics', 'Show all the Default Patterns and added by #heuristics method and EXIT.') do
|
|
71
|
-
self[:show_heuristics?] = true
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def parse_bundler(options)
|
|
76
|
-
options.on('--skip-bundler', "InfinityTest try to use bundler if Gemfile is present. If you don't want to use this convention, set this option.") do
|
|
77
|
-
self[:skip_bundler?] = true
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def parse_version(options)
|
|
82
|
-
options.on("--version", "Show version and exit") do
|
|
83
|
-
puts InfinityTest.version
|
|
84
|
-
exit
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
end
|
|
89
|
-
end
|