Module: InfinityTest::Builder
- Included in:
- TestFramework
- Defined in:
- lib/infinity_test/builder.rb
Instance Method Summary collapse
-
#construct_command(options) ⇒ Object
TODO: Refactoring this Ugly Code.
-
#construct_commands(file = nil) ⇒ Object
Contruct all the Commands for each ruby instance variable If don’t want to run with many rubies, add the current ruby to the rubies instance and create the command with current ruby.
-
#resolve_options(options) ⇒ Object
TODO: Refactoring this Ugly Code.
- #run_with_bundler!(rvm_ruby_version, command, environment) ⇒ Object
- #run_without_bundler!(rvm_ruby_version, command) ⇒ Object
Instance Method Details
#construct_command(options) ⇒ Object
TODO: Refactoring this Ugly Code
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/infinity_test/builder.rb', line 8 def construct_command() binary_name, ruby_version, command, file, environment, = () unless have_binary?(binary_name) || [:skip_binary?] (binary_name, ruby_version) else command = "#{command} #{decide_files(file)}" rvm_ruby_version = "rvm #{ruby_version} ruby #{}" if application.have_gemfile? and not application.skip_bundler? run_with_bundler!(rvm_ruby_version, command, environment) else run_without_bundler!(rvm_ruby_version, command) end end end |
#construct_commands(file = nil) ⇒ Object
Contruct all the Commands for each ruby instance variable If don’t want to run with many rubies, add the current ruby to the rubies instance and create the command with current ruby
45 46 47 48 |
# File 'lib/infinity_test/builder.rb', line 45 def construct_commands(file=nil) @rubies << RVM::Environment.current.environment_name if @rubies.empty? construct_rubies_commands(file) end |
#resolve_options(options) ⇒ Object
TODO: Refactoring this Ugly Code
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/infinity_test/builder.rb', line 54 def () ruby_version = [:for] binary_name = [:skip_binary?] ? '' : [:binary] load_path = %{-I"#{[:load_path]}"} if [:load_path] environment = [:environment] file = [:file] = [:specific_options] command = [ binary_name, load_path].compact.join(' ') [binary_name, ruby_version, command, file, environment, ] end |
#run_with_bundler!(rvm_ruby_version, command, environment) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/infinity_test/builder.rb', line 26 def run_with_bundler!(rvm_ruby_version, command, environment) bundle_binary = search_bundle(environment) unless have_binary?(bundle_binary) ('bundle', environment.) else %{#{bundle_binary} exec #{rvm_ruby_version} #{command}} end end |
#run_without_bundler!(rvm_ruby_version, command) ⇒ Object
36 37 38 |
# File 'lib/infinity_test/builder.rb', line 36 def run_without_bundler!(rvm_ruby_version, command) %{#{rvm_ruby_version} #{command}} end |