Sha256: dd83c3fd2f7ac18fa8c941f2f6dfc54526cba1b1cc047ae409e02f1d2b89245c

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

class Lono::CLI::New
  class Hook < Lono::CLI::New::Sequence
    def self.cli_options
      [
        [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
        [:blueprint, aliases: :b, desc: "Blueprint name. Only use you want a blueprint helper. Otherwise a project helper is generated"],
      ]
    end
    cli_options.each do |args|
      class_option(*args)
    end

    def set_source
      set_template_source "hook"
    end

    def create_hook
      logger.info "=> Generating hook"
      if blueprint
        directory ".", "app/blueprints/#{blueprint}"
      else
        directory ".", "."
      end
    end

  private
    # So templates/hooks/config/hooks.rb.tt has access to blueprint
    def blueprint
      @options[:blueprint]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/cli/new/hook.rb
lono-8.0.0.pre.rc5 lib/lono/cli/new/hook.rb
lono-8.0.0.pre.rc4 lib/lono/cli/new/hook.rb