infinity_test 1.0.3 → 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.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +31 -0
  3. data/.gitignore +3 -0
  4. data/.rspec +2 -2
  5. data/AI_INTEGRATION_IDEAS.md +203 -0
  6. data/Gemfile +3 -15
  7. data/History.markdown +82 -0
  8. data/{.infinity_test → INFINITY_TEST} +18 -15
  9. data/LICENSE.txt +2 -2
  10. data/README.md +627 -0
  11. data/Rakefile +1 -65
  12. data/TODO.markdown +24 -19
  13. data/bin/infinity_test +1 -4
  14. data/images/fuuu/pending.png +0 -0
  15. data/images/fuuu/success.png +0 -0
  16. data/infinity_test.gemspec +41 -189
  17. data/lib/infinity_test/core/auto_discover.rb +67 -0
  18. data/lib/infinity_test/core/base.rb +369 -0
  19. data/lib/infinity_test/core/callback.rb +59 -0
  20. data/lib/infinity_test/core/changed_file.rb +13 -0
  21. data/lib/infinity_test/core/command_builder.rb +48 -0
  22. data/lib/infinity_test/core/command_runner.rb +62 -0
  23. data/lib/infinity_test/core/configuration_merge.rb +37 -0
  24. data/lib/infinity_test/core/continuous_test_server.rb +106 -0
  25. data/lib/infinity_test/core/load_configuration.rb +48 -0
  26. data/lib/infinity_test/core/notifier.rb +59 -0
  27. data/lib/infinity_test/core/options.rb +134 -0
  28. data/lib/infinity_test/core/runner.rb +18 -0
  29. data/lib/infinity_test/core/version.rb +5 -0
  30. data/lib/infinity_test/framework/base.rb +57 -0
  31. data/lib/infinity_test/framework/padrino.rb +33 -0
  32. data/lib/infinity_test/framework/rails.rb +35 -0
  33. data/lib/infinity_test/framework/rubygems.rb +29 -0
  34. data/lib/infinity_test/framework/shared_example.rb +47 -0
  35. data/lib/infinity_test/observer/base.rb +40 -0
  36. data/lib/infinity_test/observer/filewatcher.rb +72 -0
  37. data/lib/infinity_test/observer/listen.rb +74 -0
  38. data/lib/infinity_test/observer/shared_example.rb +35 -0
  39. data/lib/infinity_test/old_dsl/configuration.rb +26 -0
  40. data/lib/infinity_test/strategy/base.rb +34 -0
  41. data/lib/infinity_test/strategy/rbenv.rb +32 -0
  42. data/lib/infinity_test/strategy/ruby_default.rb +20 -0
  43. data/lib/infinity_test/strategy/rvm.rb +50 -0
  44. data/lib/infinity_test/strategy/shared_example.rb +32 -0
  45. data/lib/infinity_test/test_framework/base.rb +64 -0
  46. data/lib/infinity_test/test_framework/rspec.rb +48 -0
  47. data/lib/infinity_test/test_framework/shared_example.rb +56 -0
  48. data/lib/infinity_test/test_framework/test_unit.rb +57 -0
  49. data/lib/infinity_test.rb +53 -35
  50. data/spec/infinity_test/core/auto_discover_spec.rb +149 -0
  51. data/spec/infinity_test/core/base_spec.rb +240 -0
  52. data/spec/infinity_test/core/callback_spec.rb +89 -0
  53. data/spec/infinity_test/core/changed_file_spec.rb +26 -0
  54. data/spec/infinity_test/core/command_builder_spec.rb +38 -0
  55. data/spec/infinity_test/core/configuration_merge_spec.rb +124 -0
  56. data/spec/infinity_test/core/continuous_test_server_spec.rb +116 -0
  57. data/spec/infinity_test/core/load_configuration_spec.rb +43 -0
  58. data/spec/infinity_test/core/notifier_spec.rb +151 -0
  59. data/spec/infinity_test/core/options_spec.rb +168 -0
  60. data/spec/infinity_test/core/runner_spec.rb +17 -0
  61. data/spec/infinity_test/framework/base_spec.rb +55 -0
  62. data/spec/infinity_test/framework/padrino_spec.rb +36 -0
  63. data/spec/infinity_test/framework/rails_spec.rb +36 -0
  64. data/spec/infinity_test/framework/rubygems_spec.rb +34 -0
  65. data/spec/infinity_test/observer/base_spec.rb +78 -0
  66. data/spec/infinity_test/observer/filewatcher_spec.rb +51 -0
  67. data/spec/infinity_test/observer/listen_spec.rb +50 -0
  68. data/spec/infinity_test/{builder_spec.rb → strategy/base_spec.rb} +1 -2
  69. data/spec/infinity_test/strategy/rbenv_spec.rb +53 -0
  70. data/spec/infinity_test/strategy/ruby_default_spec.rb +32 -0
  71. data/spec/infinity_test/strategy/rvm_spec.rb +69 -0
  72. data/spec/infinity_test/test_framework/rspec_spec.rb +119 -0
  73. data/spec/infinity_test/test_framework/test_unit_spec.rb +193 -0
  74. data/spec/spec_helper.rb +34 -119
  75. metadata +272 -176
  76. data/.rvmrc +0 -1
  77. data/Gemfile.lock +0 -62
  78. data/Readme.markdown +0 -147
  79. data/Tasks +0 -4
  80. data/VERSION.yml +0 -5
  81. data/buzz_images/buzz_lightyear.jpg +0 -0
  82. data/buzz_images/buzz_lightyear_continencia.gif +0 -0
  83. data/buzz_images/to_infinity_and_beyond.png +0 -0
  84. data/features/heuristics.feature +0 -23
  85. data/features/support/env.rb +0 -2
  86. data/images/fuuu/sucess.png +0 -0
  87. data/lib/infinity_test/application.rb +0 -362
  88. data/lib/infinity_test/application_library/rails.rb +0 -94
  89. data/lib/infinity_test/application_library/rubygems.rb +0 -43
  90. data/lib/infinity_test/binary_path.rb +0 -43
  91. data/lib/infinity_test/builder.rb +0 -66
  92. data/lib/infinity_test/command.rb +0 -58
  93. data/lib/infinity_test/configuration.rb +0 -277
  94. data/lib/infinity_test/continuous_testing.rb +0 -40
  95. data/lib/infinity_test/dependencies.rb +0 -80
  96. data/lib/infinity_test/environment.rb +0 -15
  97. data/lib/infinity_test/heuristics.rb +0 -36
  98. data/lib/infinity_test/heuristics_helper.rb +0 -9
  99. data/lib/infinity_test/options.rb +0 -96
  100. data/lib/infinity_test/runner.rb +0 -38
  101. data/lib/infinity_test/test_framework.rb +0 -110
  102. data/lib/infinity_test/test_library/bacon.rb +0 -55
  103. data/lib/infinity_test/test_library/cucumber.rb +0 -22
  104. data/lib/infinity_test/test_library/rspec.rb +0 -60
  105. data/lib/infinity_test/test_library/test_unit.rb +0 -52
  106. data/lib/infinity_test/test_unit_loader.rb +0 -5
  107. data/spec/factories/buzz/lib/buzz.rb +0 -0
  108. data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
  109. data/spec/factories/company/Gemfile +0 -0
  110. data/spec/factories/company/lib/company.rb +0 -0
  111. data/spec/factories/company/test/company_test.rb +0 -0
  112. data/spec/factories/images/failure.png +0 -0
  113. data/spec/factories/images/pending.png +0 -0
  114. data/spec/factories/images/sucess.png +0 -0
  115. data/spec/factories/infinity_test +0 -5
  116. data/spec/factories/infinity_test_example +0 -7
  117. data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
  118. data/spec/factories/travel/lib/travel.rb +0 -0
  119. data/spec/factories/travel/test/partner_test.rb +0 -0
  120. data/spec/factories/travel/test/travel_test.rb +0 -0
  121. data/spec/factories/wood/lib/wood.rb +0 -0
  122. data/spec/factories/wood/spec/wood_spec.rb +0 -0
  123. data/spec/infinity_test/application_library/rails_spec.rb +0 -140
  124. data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
  125. data/spec/infinity_test/application_spec.rb +0 -434
  126. data/spec/infinity_test/binary_path_spec.rb +0 -72
  127. data/spec/infinity_test/command_spec.rb +0 -53
  128. data/spec/infinity_test/configuration_spec.rb +0 -382
  129. data/spec/infinity_test/continuous_testing_spec.rb +0 -25
  130. data/spec/infinity_test/environment_spec.rb +0 -23
  131. data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
  132. data/spec/infinity_test/heuristics_spec.rb +0 -127
  133. data/spec/infinity_test/options_spec.rb +0 -111
  134. data/spec/infinity_test/runner_spec.rb +0 -42
  135. data/spec/infinity_test/test_framework_spec.rb +0 -127
  136. data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
  137. data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
  138. data/spec/infinity_test/test_library/rspec_spec.rb +0 -189
  139. data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
  140. data/spec/infinity_test_spec.rb +0 -40
  141. /data/images/faces/{sucess.png → success.png} +0 -0
  142. /data/images/hands/{sucess.png → success.png} +0 -0
  143. /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
  144. /data/images/rails/{sucess.png → success.png} +0 -0
  145. /data/images/rubies/{sucess.png → success.png} +0 -0
  146. /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
  147. /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
  148. /data/images/toy_story/{sucess.png → success.png} +0 -0
@@ -1,43 +0,0 @@
1
- module InfinityTest
2
- module BinaryPath
3
-
4
- def self.included(base)
5
- base.extend ClassMethods
6
- base.send :include, ClassMethods
7
- end
8
-
9
- def rvm_bin_path(environment, binary)
10
- environment.path_for(binary)
11
- end
12
-
13
- def print_message(gem_name, ruby_version)
14
- puts "\n Ruby => #{ruby_version}: I searched the #{gem_name} binary path and I don't find nothing. You have the #{gem_name} installed in this version?"
15
- end
16
-
17
- def search_binary(binary_name, options)
18
- rvm_bin_path(options[:environment], binary_name)
19
- end
20
-
21
- def have_binary?(binary)
22
- File.exist?(binary)
23
- end
24
-
25
- module ClassMethods
26
-
27
- # Set the binary to search in the RVM binary folder
28
- #
29
- # binary :bundle
30
- #
31
- def binary(binary_name, options={})
32
- method_sufix = options[:name] || binary_name
33
- eval <<-EVAL
34
- def search_#{method_sufix}(environment)
35
- search_binary('#{binary_name}', :environment => environment)
36
- end
37
- EVAL
38
- end
39
-
40
- end
41
-
42
- end
43
- end
@@ -1,66 +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, specific_options = resolve_options(options)
10
-
11
- unless have_binary?(binary_name) || options[:skip_binary?]
12
- print_message(binary_name, ruby_version)
13
- else
14
- command = "#{command} #{decide_files(file)}"
15
- rvm_ruby_version = "rvm #{ruby_version} ruby #{specific_options}"
16
-
17
- if application.have_gemfile? and not application.skip_bundler?
18
- run_with_bundler!(rvm_ruby_version, command, environment)
19
- else
20
- run_without_bundler!(rvm_ruby_version, command)
21
- end
22
- end
23
- end
24
-
25
- #
26
- def run_with_bundler!(rvm_ruby_version, command, environment)
27
- bundle_binary = search_bundle(environment)
28
- unless have_binary?(bundle_binary)
29
- print_message('bundle', environment.expanded_name)
30
- else
31
- %{#{bundle_binary} exec #{rvm_ruby_version} #{command}}
32
- end
33
- end
34
-
35
- #
36
- def run_without_bundler!(rvm_ruby_version, command)
37
- %{#{rvm_ruby_version} #{command}}
38
- end
39
-
40
- #
41
- # Contruct all the Commands for each ruby instance variable
42
- # If don't want to run with many rubies, add the current ruby to the rubies instance
43
- # and create the command with current ruby
44
- #
45
- def construct_commands(file=nil)
46
- @rubies << RVM::Environment.current.environment_name if @rubies.empty?
47
- construct_rubies_commands(file)
48
- end
49
-
50
- #
51
- # TODO: Refactoring this Ugly Code
52
- #
53
- #
54
- def resolve_options(options)
55
- ruby_version = options[:for]
56
- binary_name = options[:skip_binary?] ? '' : options[:binary]
57
- load_path = %{-I"#{options[:load_path]}"} if options[:load_path]
58
- environment = options[:environment]
59
- file = options[:file]
60
- specific_options = options[:specific_options]
61
- command = [ binary_name, load_path].compact.join(' ')
62
- [binary_name, ruby_version, command, file, environment, specific_options]
63
- end
64
-
65
- end
66
- 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,277 +0,0 @@
1
- module InfinityTest
2
- class Configuration
3
-
4
- SUPPORTED_FRAMEWORKS = [:growl, :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, :specific_options
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
- @specific_options = options[:specific_options]
111
- @test_framework = options[:test_framework] || @test_framework
112
- @app_framework = options[:app_framework] || @app_framework
113
- @verbose = options[:verbose] || @verbose
114
- @cucumber = options[:cucumber]
115
- setting_gemset_for_each_rubies(options[:gemset]) if options[:gemset]
116
- end
117
-
118
- # Setting a gemset for each rubies
119
- #
120
- # setting_gemset_for_each_rubies('infinity_test') # => ['1.8.7@infinity_test', '1.9.2@infinity_test']
121
- #
122
- def setting_gemset_for_each_rubies(gemset)
123
- @rubies = @rubies.split(',').collect { |ruby| ruby << "@#{gemset}" }.join(',')
124
- end
125
-
126
- # InfinityTest try to use bundler if Gemfile is present.
127
- # This method tell to InfinityTest to not use this convention.
128
- #
129
- def skip_bundler!
130
- @skip_bundler = true
131
- end
132
-
133
- # Return false if you want the InfinityTest run with bundler
134
- #
135
- def skip_bundler?
136
- @skip_bundler ? true : false
137
- end
138
-
139
- def cucumber?
140
- @cucumber
141
- end
142
-
143
- # Method to use to ignore some dir/files changes
144
- #
145
- # Example:
146
- #
147
- # ignore :exceptions => %w(.svn .hg .git vendor tmp config rerun.txt)
148
- #
149
- # This is useless right now in the Infinity Test because the library
150
- # only monitoring lib and test/spec/feature folder.
151
- #
152
- def ignore(options={})
153
- @exceptions_to_ignore = options[:exceptions] || []
154
- end
155
-
156
- # Callback method to run anything you want, before the run the test suite command
157
- #
158
- # Example:
159
- #
160
- # before_run do
161
- # clear :terminal
162
- # end
163
- #
164
- def before_run(&block)
165
- @before_callback = block
166
- end
167
-
168
- # Callback method to run anything you want, after the run the test suite command
169
- #
170
- # Example:
171
- #
172
- # after_run do
173
- # # some code that I want to run after all the rubies run
174
- # end
175
- #
176
- def after_run(&block)
177
- @after_callback = block
178
- end
179
-
180
- # Callback method to handle before or after all run and for each ruby too!
181
- #
182
- # Example:
183
- #
184
- # before(:all) do
185
- # clear :terminal
186
- # end
187
- #
188
- # before(:each_ruby) do
189
- # ...
190
- # end
191
- #
192
- # Or if you pass not then will use :all option
193
- #
194
- # before do
195
- # clear :terminal
196
- # end
197
- #
198
- #
199
- def before(hook=:all, &block)
200
- setting_callback(hook,
201
- :all => :@before_callback,
202
- :each_ruby => :@before_each_ruby_callback,
203
- :env => :@before_environment_callback, &block)
204
- end
205
-
206
- # Callback method to handle before or after all run and for each ruby too!
207
- #
208
- # Example:
209
- #
210
- # after(:all) do
211
- # clear :terminal
212
- # end
213
- #
214
- # after(:each_ruby) do
215
- # ...
216
- # end
217
- #
218
- # Or if you pass not then will use :all option
219
- #
220
- # after do
221
- # clear :terminal
222
- # end
223
- #
224
- def after(hook=:all, &block)
225
- setting_callback(hook, :all => :@after_callback, :each_ruby => :@after_each_ruby_callback, &block)
226
- end
227
-
228
- # Clear the terminal (Useful in the before callback)
229
- #
230
- def clear(option)
231
- system('clear') if option == :terminal
232
- end
233
-
234
- def replace_patterns(&block)
235
- block.call(InfinityTest.application)
236
- InfinityTest.application
237
- end
238
- alias :before_env :replace_patterns
239
-
240
- # Added heuristics to the User application
241
- #
242
- def heuristics(&block)
243
- @heuristics ||= Heuristics.new
244
- @heuristics.instance_eval(&block)
245
- @heuristics
246
- end
247
-
248
- # Set #watch methods (For more information see Watchr gem)
249
- #
250
- # If don't want the heuristics 'magic'
251
- #
252
- def watch(pattern, &block)
253
- @script ||= InfinityTest.watchr
254
- @script.watch(pattern, &block)
255
- @script
256
- end
257
-
258
- private
259
-
260
- def setting_callback(hook, callback, &block)
261
- if hook == :all
262
- instance_variable_set(callback[:all], block)
263
- elsif hook == :each_ruby
264
- instance_variable_set(callback[:each_ruby], block)
265
- end
266
- end
267
-
268
- end
269
- end
270
-
271
- class NotificationFrameworkDontSupported < StandardError
272
- end
273
-
274
- def infinity_test(&block)
275
- InfinityTest.configuration.instance_eval(&block)
276
- InfinityTest.configuration
277
- 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,9 +0,0 @@
1
- module InfinityTest
2
- module HeuristicsHelper
3
-
4
- def heuristics(&block)
5
- InfinityTest.configuration.heuristics(&block)
6
- end
7
-
8
- end
9
- end