Class: Appraisal::Command
- Inherits:
- 
      Object
      
        - Object
- Appraisal::Command
 
- Defined in:
- lib/appraisal/command.rb
Overview
Executes commands with a clean environment
Instance Attribute Summary collapse
- 
  
    
      #command  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute command. 
- 
  
    
      #env  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute env. 
- 
  
    
      #gemfile  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute gemfile. 
Instance Method Summary collapse
- 
  
    
      #initialize(command, options = {})  ⇒ Command 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Command. 
- #run ⇒ Object
Constructor Details
#initialize(command, options = {}) ⇒ Command
Returns a new instance of Command.
| 10 11 12 13 14 | # File 'lib/appraisal/command.rb', line 10 def initialize(command, = {}) @gemfile = [:gemfile] @env = .fetch(:env, {}) @command = command_starting_with_bundle(command) end | 
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
| 8 9 10 | # File 'lib/appraisal/command.rb', line 8 def command @command end | 
#env ⇒ Object (readonly)
Returns the value of attribute env.
| 8 9 10 | # File 'lib/appraisal/command.rb', line 8 def env @env end | 
#gemfile ⇒ Object (readonly)
Returns the value of attribute gemfile.
| 8 9 10 | # File 'lib/appraisal/command.rb', line 8 def gemfile @gemfile end | 
Instance Method Details
#run ⇒ Object
| 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # File 'lib/appraisal/command.rb', line 16 def run run_env = test_environment.merge(env) Bundler.with_original_env do ensure_bundler_is_available announce ENV["BUNDLE_GEMFILE"] = gemfile ENV["APPRAISAL_INITIALIZED"] = "1" run_env.each_pair do |key, value| ENV[key] = value end unless Kernel.system(command_as_string) exit(1) end end end |