class Sincli::Generators::Base

Attributes

name[R]
options[R]

Public Class Methods

new(name, options) click to toggle source
# File lib/sincli/generators/base.rb, line 9
def initialize(name, options)
  @name = name
  @options = options
  self.destination_root = Dir.pwd
  self.behavior = :invoke
end

Private Class Methods

source_root() click to toggle source
# File lib/sincli/generators/base.rb, line 40
def self.source_root
  f = File.expand_path('../templates', __dir__)
  Pathname.new f
end

Private Instance Methods

contrib_extensions() click to toggle source
# File lib/sincli/generators/base.rb, line 22
def contrib_extensions
  return [] if options[:no_contrib]

  %w[reloader required_params].tap do |e|
    if @options[:api_only]
      e.push 'json'
    else
      e.push 'respond_with', 'content_for'
    end
  end
end
extensions() click to toggle source
# File lib/sincli/generators/base.rb, line 34
def extensions
  return contrib_extensions if options[:api_only]

  contrib_extensions + ['flash']
end
git_keep() click to toggle source
# File lib/sincli/generators/base.rb, line 18
def git_keep
  create_file('.', '.gitkeep')
end