Sha256: 49346ffaff376d75c6ed0a68d3aa6390239bbc7419b870025e1bac11aa426b95

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

#!/usr/bin/env ruby
require 'thor'
require 'scrapers'
require "active_support/core_ext/string/inflections"
require 'pry'

class NewScraper < Thor::Group
  include Thor::Actions
  
  argument :name
  class_option :test_framework, :aliases => "-T", :default => :spec
  
  def self.source_root
    File.expand_path("../../", __FILE__)
  end


  def create_lib_file
    template("templates/new_scraper.tt", "lib/scrapers/#{name.underscore}.rb")
  end

  def create_test_file

    if %w[test_unit minitest test].include?(options["test_framework"])
      test = "test"
    else
      test = "spec"
    end

    template("templates/new_scraper_#{test}.tt", "#{test}/scrapers/#{name.underscore}_#{test}.rb")
  end

end

NewScraper.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scrapers-1.5.6 bin/new_scraper
scrapers-1.5.5 bin/new_scraper