Sha256: 31b18f70de35d92e58f2a4af9226db2bcfcc37ad138a5ad3b4acda0c6b1cae5e

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'thor'
require_relative 'generators/app'
require_relative 'config'

module Lopata
  class Runner < Thor
    desc 'test', 'Run tests'
    option :env, default: :qa, aliases: 'e'
    option :"no-log", type: :boolean, aliases: 'n'
    option :focus, type: :boolean, aliases: 'f'
    option :rerun, type: :boolean, aliases: 'r'
    option :users, type: :array, aliases: 'u'
    option :build, aliases: 'b'
    option :keep, type: :boolean, aliases: 'k'
    def test
      require 'rspec'

      Dir["./spec/support/**/*.rb"].sort.each { |f| require f}
      ENV['HOME'] = File.absolute_path('.') # disable warning on rspec loading on windows
      Lopata::Config.ops = {
        focus: options[:focus],
        rerun: options[:rerun],
        users: options[:users],
        build: options[:build],
        env:   options[:env],
        keep:  options[:keep]
      }
      Lopata::Config.init(options[:env])
      Lopata::Config.initialize_test
      Lopata::Config.init_rspec

      ::RSpec::Core::Runner.run ['spec']
    end

    default_task :test

    register Generators::App, :new, 'lopata new project-name', 'Init new lopata projects'
  end
end

unless ARGV.first == 'new'
  raise 'No Lopatafile found in running dir' unless File.exists?('./Lopatafile')
  eval File.binread('./Lopatafile')
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lopata-0.0.13 lib/lopata/runner.rb
lopata-0.0.8 lib/lopata/runner.rb