Top Level Namespace

Includes:
Monkeybars::Swing

Defined Under Namespace

Modules: Neurogami Classes: AboutController, AboutFrame, AboutModel, AboutView, String, __NAME__Controller, __NAME__Frame, __NAME__Model, __NAME__View

Instance Method Summary collapse

Instance Method Details

#camelize(name, first_letter_in_uppercase = true) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/rhesus/utils.rb', line 28

def camelize name, first_letter_in_uppercase = true
  name = name.to_s
  if first_letter_in_uppercase
    name.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
  else
    name[0..0] + camelize( name[1..-1])
  end
end

#setup_directory(path) ⇒ Object

def copy_over_prebuilt_template base_path, name

%w{model view controller ui}.each do |unit|
  FileUtils.mkdir_p File.join(base_path, name)
  from = File.join( template_base_dir, name , name + '_' + unit + '.rb')
  dest = File.join(base_path, name, name + '_' + unit + '.rb' )
  warn "cp '#{from}' to '#{dest}'"
  FileUtils.cp from, dest 
end

end



22
23
24
25
26
# File 'lib/rhesus/utils.rb', line 22

def setup_directory path
  FileUtils.mkdir_p path.gsub("\\", "/")
  FileUtils.cd path
  path.split("/").last
end

#snake_case(name) ⇒ Object



4
5
6
# File 'lib/rhesus/utils.rb', line 4

def snake_case name 
  name.gsub(/\B[A-Z]/, '_\&').downcase
end

#template_base_dirObject



8
9
10
# File 'lib/rhesus/utils.rb', line 8

def template_base_dir 
  File.expand_path( File.join( File.dirname(__FILE__), '..', 'templates' ) )
end