Class: Protod::TaskGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/protod/task_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_raketaskObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/protod/task_generator.rb', line 5

def create_raketask
  create_file "lib/tasks/protod.rake", <<~RUBY
    # frozen_string_literal: true

    begin
      require 'protod/rake_task'

      Protod::RakeTask::Builder.new do |builder|
        # If you want to change the rake task namespace, comment in it.
        # default: :protod
        # builder.name = :pd
      end.build
    rescue LoadError => e
      $stderr.puts "#\{e\}\\nYou might should remove 'lib/tasks/protod.rake'."
    end
  RUBY
end