Class: ProjectGenerator

Inherits:
Sprout::Generator::NamedBase
  • Object
show all
Defined in:
lib/sprout/generators/project/project_generator.rb

Instance Method Summary collapse

Instance Method Details

#manifestObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/sprout/generators/project/project_generator.rb', line 4

def manifest
  record do |m|
    base = class_name
    m.directory base
    m.directory File.join(base, 'bin')

    # Tediously create all of the directories we're about to fill up
    m.directory File.join(base, 'html-template')
    m.directory File.join(base, 'html-template', 'www')
    m.directory File.join(base, 'html-template', 'www', 'db_images')
    m.directory File.join(base, 'html-template', 'www', 'db_images', 'customer')
    m.directory File.join(base, 'html-template', 'www', 'db_images', 'customer', '60')
    m.directory File.join(base, 'html-template', 'www', 'db_images', 'tour')
    m.directory File.join(base, 'html-template', 'www', 'db_images', 'tour', '2166')
    m.directory File.join(base, 'html-template', 'www', 'player-assets')
    m.directory File.join(base, 'html-template', 'www', 'player-assets', 'hotspotIcons')
    m.directory File.join(base, 'html-template', 'www', 'player-assets', 'hotspotIcons', 'arrow')
    m.directory File.join(base, 'html-template', 'www', 'player-assets', 'hotspotIcons', 'stillCamera')

    # Copy all of the files into the directory structure we just created
    abs_path = source_path('html-template')               # Get the absolute path so FileList will work
    FileList["#{abs_path}/**/*.*"].map do |absolute_file| # Grab all files (not directories)
      absolute_file.sub("#{abs_path}", 'html-template')   # Strip the absolute path back off
    end.each do |file_name|
      m.file file_name, File.join(base, file_name)        # Copy each file
    end
    m.template 'TourInfo.xml', File.join(base, 'html-template', 'www', 'TourInfo.xml')

    m.directory File.join(base, 'lib')
    m.file 'TourBuzzCore.swc', File.join(base, 'lib', 'TourBuzzCore.swc')
    m.file 'linker_report.xml', File.join(base, 'lib', 'linker_report.xml')

    m.directory File.join(base, 'src')
    m.template 'DefaultSkin.mxml', File.join(base, 'src', "#{project_name}Skin.mxml")

    m.template 'Rakefile', File.join(base, "Rakefile")
  end
end