Class: Nakor::Generators::App

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/nakor/generators/app.rb

Constant Summary collapse

IMAGE_FILES =
%W{
  bk_default.png
  btn_about.png
  btn_about_over.png
  btn_help.png
  btn_help_over.png
  btn_play.png
  btn_play_over.png
  btn_settings.png
  btn_settings_over.png
  splash_screen.png
}
SCRIPT_FILES =
%W{
  active_record.lua
  geometry.lua
  io_ext.lua
  middleclass.lua
  orm.lua
  radlib.lua
  sql.lua
  string_ext.lua
  table_ext.lua
  time_ext.lua
  ui.lua
  underscore.lua
}
TEMPLATE_FILES =
%W{
  about.lua
  build.settings
  config.lua
  help.lua
  init_buttons.lua
  loadmenu.lua
  main.lua
  menu.lua
  play.lua
  README
  settings.lua
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



51
52
53
# File 'lib/nakor/generators/app.rb', line 51

def self.source_root
  File.dirname(__FILE__) + "/corona-game-template"
end

Instance Method Details

#copy_image_filesObject



81
82
83
84
85
# File 'lib/nakor/generators/app.rb', line 81

def copy_image_files
  IMAGE_FILES.each do |image_file|
    copy_file "images/#{image_file}", "#{app_name}/#{app_name}/images/#{image_file}"
  end
end

#copy_script_filesObject



75
76
77
78
79
# File 'lib/nakor/generators/app.rb', line 75

def copy_script_files
  SCRIPT_FILES.each do |script_file|
    copy_file "scripts/lib/#{script_file}", "#{app_name}/#{app_name}/scripts/lib/#{script_file}"
  end
end

#copy_template_filesObject



69
70
71
72
73
# File 'lib/nakor/generators/app.rb', line 69

def copy_template_files
  TEMPLATE_FILES.each do |template_file|
    template template_file, "#{app_name}/#{app_name}/#{template_file}"
  end
end

#create_groupObject



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/nakor/generators/app.rb', line 55

def create_group
  # Create the top-level app directory
  empty_directory app_name

  # Create the subdirectories
  create_subdirectory app_name
  create_subdirectory "#{app_name}/images"
  create_subdirectory "#{app_name}/scripts"
  create_subdirectory "#{app_name}/scripts/lib"
  create_subdirectory "server"
  create_subdirectory "assets"
  create_subdirectory "doc"
end

#doneObject



87
88
89
# File 'lib/nakor/generators/app.rb', line 87

def done
  puts "Successfully generated '#{app_name}'"
end