Sha256: dbc2c2a09bf2c50d8c057bbc341d3c191438d3063ccf0d2bf7fe979e0790b7ed

Contents?: true

Size: 963 Bytes

Versions: 5

Compression:

Stored size: 963 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 :make_bin, :aliases => "-B", :default => true
    
  def self.source_root
    File.expand_path("../../", __FILE__)
  end

  def create_bin_file
    return unless options["make_bin"]
    template("templates/bin/new_scraper_bin.erb", "bin/#{file_name}")
    template("templates/lib/new_scraper_thor.rb.erb", "lib/#{file_name}_thor.rb")
    template("templates/spec/new_scraper_thor_spec.rb.erb", "spec/#{file_name}_thor_spec.rb")
  end

  def create_scraper_lib_file
    template("templates/lib/scrapers/new_scraper_lib.rb.erb", "lib/scrapers/#{file_name}.rb")
    template("templates/spec/lib/new_scraper_lib_spec.rb.erb", "spec/lib/scrapers/#{file_name}_spec.rb")
  end

  private

  def file_name
    name.underscore
  end

end

NewScraper.start

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scrapers-3.2.0 bin/new_scraper
scrapers-3.1.0 bin/new_scraper
scrapers-3.0.0 bin/new_scraper
scrapers-2.1.0 bin/new_scraper
scrapers-2.0.2 bin/new_scraper