Sha256: 60dd07fd0f40126a8841052e4e75cbdfa888494ed2f00eb6ccfdbe1991c8011d

Contents?: true

Size: 1.87 KB

Versions: 3

Compression:

Stored size: 1.87 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'learn'

SERVICE_URL = 'http://ironbroker.flatironschool.com'

spec_type = Learn::SpecTypeParser.new.spec_type
username = Learn::UsernameParser.get_username
user_id = Learn::UserIdParser.get_user_id

repo = ARGV.include?("--test") ? "git@github.com:flatiron-school/a-sample-repo.git" : Learn::RepoParser.get_repo

if spec_type == "jasmine"
  SERVICE_ENDPOINT = '/e/flatiron_jasmine/build/ironboard'

  options = {}
  OptionParser.new do |opts|
    opts.banner = "Usage: learn [options]"

    opts.on("-n", "--[no-]color", "Turn off color output") do |c|
      options[:color] = c
    end

    opts.on("-l", "--local", "Don't push results to Flatiron LMS") do |l|
      options[:local] = l
    end

    opts.on("-b", "--browser", "Run tests in browser") do |b|
      options[:browser] = b
    end

    opts.on("-o", "--out FILE") do |o|
      options[:out] = o
    end

    opts.on("-s", "--skip") do |s|
      options[:skip] = s
    end

    opts.on("-t", "--test") do |t|
      options[:test] = t
    end
  end.parse!

  if ARGV.any? { |arg| arg == "init" }
    Learn::Jasmine::Initializer.run
  else
    if !options[:skip]
      Learn::Jasmine::PhantomChecker.check_installation
    else
      username = "jasmine-flatiron"
      user_id = "none"
    end

    Learn::Jasmine::Runner.run(username, user_id, repo, options)
  end
elsif spec_type == "rspec"
  SERVICE_ENDPOINT = '/e/flatiron_rspec/build/ironboard'

  runner = Learn::RSpec::Runner.new(username, user_id, repo, ARGV)
  runner.run
elsif spec_type == 'python_unittest'
  SERVICE_ENDPOINT = '/e/flatiron_unittest/build/ironboard'

  Learn::PythonUnittest::RequirementsChecker.check_installation
  Learn::PythonUnittest::NoseInstaller.install

  runner = Learn::PythonUnittest::Runner.new(username, user_id, repo, ARGV)
  runner.run
else
  puts "This directory doesn't appear to have any specs in it."
end



Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
learn-co-1.0.2 bin/learn
learn-co-1.0.1 bin/learn
learn-co-1.0.0 bin/learn