Class: YMDP::Generator::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ymdp_generator.rb

Overview

Parses the command as the first parameter and generates the appropriate files.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Base

Returns a new instance of Base.

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
# File 'lib/ymdp_generator.rb', line 40

def initialize(params={})
  @template_path = params[:template_path]
  @application_path = params[:application_path]
    
  raise ArgumentError.new("template_path is required") unless @template_path
  raise ArgumentError.new("application_path is required") unless @application_path
end

Instance Attribute Details

#application_pathObject

Returns the value of attribute application_path.



38
39
40
# File 'lib/ymdp_generator.rb', line 38

def application_path
  @application_path
end

#template_pathObject

Returns the value of attribute template_path.



38
39
40
# File 'lib/ymdp_generator.rb', line 38

def template_path
  @template_path
end

Instance Method Details

#generate(view) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ymdp_generator.rb', line 48

def generate(view)
  $stdout.puts "Create a new view: #{view}"
  
  p = {
    :template_path => template_path,
    :application_path => application_path
  }

  YMDP::Generator::Templates::View.new(view, p).generate
  YMDP::Generator::Templates::JavaScript.new(view, p).generate
  YMDP::Generator::Templates::Stylesheet.new(view, p).generate
  # YMDP::Generator::Templates::Translation.new(view, p).generate
  YMDP::Generator::Templates::Modifications.new(view, p).generate
end