Class: Quiver::CLI::NewApplication

Inherits:
Object
  • Object
show all
Includes:
Thor::Actions, Thor::Base
Defined in:
lib/quiver/cli/generators/new_application.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ NewApplication

Returns a new instance of NewApplication.



34
35
36
37
38
39
# File 'lib/quiver/cli/generators/new_application.rb', line 34

def initialize(name, options)
  self.name = name
  self.options = options
  @destination_stack ||= []
  self.behavior = :invoke
end

Class Method Details

.generators_arrayObject



21
22
23
# File 'lib/quiver/cli/generators/new_application.rb', line 21

def self.generators_array
  @generators_array ||= []
end

.generators_hashObject



25
26
27
# File 'lib/quiver/cli/generators/new_application.rb', line 25

def self.generators_hash
  @generators_hash ||= {}
end

.inherited(subclass) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/quiver/cli/generators/new_application.rb', line 11

def self.inherited(subclass)
  generators_hash.each do |k, v|
    subclass.generators_hash[k] = v
  end

  generators_array.each do |i|
    subclass.generators_array << i
  end
end

.register_step(name, step, opts = {}) ⇒ Object



29
30
31
32
# File 'lib/quiver/cli/generators/new_application.rb', line 29

def self.register_step(name, step, opts={})
  generators_hash[name] = step
  generators_array << name unless opts[:skip_queueing] || generators_array.include?(name)
end

.source_rootObject



7
8
9
# File 'lib/quiver/cli/generators/new_application.rb', line 7

def self.source_root
  File.expand_path(File.join('..', '..', 'templates'), __FILE__)
end

Instance Method Details

#generate!Object



41
42
43
44
45
46
47
48
49
# File 'lib/quiver/cli/generators/new_application.rb', line 41

def generate!
  self.class.generators_array.each do |name|
    if step = self.class.generators_hash[name]
      instance_exec(&step)
    end
  end

  git_init
end