Class: DaimonSkycrawlers::Generator::Crawler
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- DaimonSkycrawlers::Generator::Crawler
- Includes:
- Thor::Actions
- Defined in:
- lib/daimon_skycrawlers/generator/crawler.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/daimon_skycrawlers/generator/crawler.rb', line 10 def self.source_root File.join(__dir__, "templates") end |
Instance Method Details
#create_files ⇒ Object
14 15 16 17 18 19 |
# File 'lib/daimon_skycrawlers/generator/crawler.rb', line 14 def create_files config = { class_name: name.classify, } template("crawler.rb.erb", "app/crawlers/#{name.underscore}.rb", config) end |
#display_post_message ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/daimon_skycrawlers/generator/crawler.rb', line 21 def puts "\nYou can register your crawler in `app/crawler.rb` to run your crawler.\nFollowing code snippet is useful:\n\n base_url = \"https://www.example.com/\"\n crawler = \#{name.classify}.new(base_url)\n DaimonSkycrawlers.register_crawler(crawler)\n\n" end |