Class: Scruber::CLI::Generators::ScraperGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/scruber/cli/generators.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
13 14 15 |
# File 'lib/scruber/cli/generators.rb', line 13 def self.source_root File.dirname(__FILE__) + '/templates' end |
Instance Method Details
#create_files ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scruber/cli/generators.rb', line 17 def create_files if defined?(APP_PATH) scraper_path = Scruber::AppSearcher.find_scraper(name, APP_PATH) if scraper_path.present? raise ::Thor::Error, "ERROR: Scraper already exists" end template 'scrapers/sample.tt', File.('../../scrapers/'+name+'.rb', APP_PATH) else raise ::Thor::Error, "ERROR: Scruber project not found." end end |