Class: Emque::Consuming::Generators::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/emque/consuming/generators/application.rb

Constant Summary collapse

IGNORE =
[".", ".."]

Instance Method Summary collapse

Constructor Details

#initialize(options, name) ⇒ Application

Returns a new instance of Application.



11
12
13
14
# File 'lib/emque/consuming/generators/application.rb', line 11

def initialize(options, name)
  self.name = Inflecto.underscore(name)
  self.options = options
end

Instance Method Details

#generateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/emque/consuming/generators/application.rb', line 16

def generate
  context = Class.new(Object) { |obj|
    def initialize(options, name)
      @name = Inflecto.camelize(name)
      @options = options
    end

    def get_binding; binding; end
  }.new(options, name).get_binding

  @current_dir = File.realdirpath(Dir.pwd)

  recursively_copy_templates(
    File.realdirpath(
      File.join(
        File.dirname(__FILE__),
        "..",
        "..",
        "..",
        "templates"
      )
    ),
    [current_dir, name],
    context
  )
end