Class: Rag::Project

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

Overview

== ERB support variables

  • project # the name of your project, provided by `rag new "
  • others from .ragrc

== Configrauton

  • ~/.ragrc
  • APP/.ragrc
  • from cmdline

you can use arbitrary name in .ragrc, then you can use then in template file.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, app_path, o = {}) ⇒ Project

Returns a new instance of Project.



28
29
30
31
32
33
34
# File 'lib/rag/new.rb', line 28

def initialize(template, app_path, o={})
  @template = template
  @options = o
  o["name"] ||= Pa.absolute(app_path).fname 
  o["class_name"] ||= o["name"].capitalize
  @app_path = Pa(app_path)
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



27
28
29
# File 'lib/rag/new.rb', line 27

def app_path
  @app_path
end

#optionsObject (readonly)

Returns the value of attribute options.



27
28
29
# File 'lib/rag/new.rb', line 27

def options
  @options
end

#templateObject (readonly)

Returns the value of attribute template.



27
28
29
# File 'lib/rag/new.rb', line 27

def template
  @template
end

Class Method Details

.create(*args) ⇒ Object



22
23
24
# File 'lib/rag/new.rb', line 22

def create(*args)
  Project.new(*args).create
end

Instance Method Details

#createObject



36
37
38
39
40
41
42
43
# File 'lib/rag/new.rb', line 36

def create
  create_project_directory
  if @app_path == "."
    copy_files
  else
    copy_files :overwrite => true
  end
end