Sha256: c0e93891a24cbdcfb9bbbf8d6afc3c1a159ddecb9604126428215cad935fba21

Contents?: true

Size: 772 Bytes

Versions: 6

Compression:

Stored size: 772 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
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

6 entries across 6 versions & 1 rubygems

Version Path
scrapers-1.5.4 bin/new_scraper
scrapers-1.5.3 bin/new_scraper
scrapers-1.5.2 bin/new_scraper
scrapers-1.5.1 bin/new_scraper
scrapers-1.5.0 bin/new_scraper
scrapers-1.4.0 bin/new_scraper