Method: View#create

Defined in:
lib/view.rb

#create(output_dir) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/view.rb', line 26

def create output_dir
  assert_dir output_dir

  system "cp #{view_dir}/favicon.ico #{output_dir}"

  if templates == "two-column"
    system "cp #{view_dir}/ios.ico #{output_dir}"
  end
  
  assert_dir "#{output_dir}/public"
  system "cp #{view_dir}/public/* #{output_dir}/public/"
  
  assert_dir "#{output_dir}/schema"
  system "cp #{schema_dir}/* #{output_dir}/schema"

  create_inqlude_all(output_dir)

  @root = ""

  Dir.glob("#{view_dir}*.html.haml") do |file|
    template_name = (File.basename file).split(".").first

    if !["layout","group","library"].include? template_name
      render_template template_name, output_dir
    end
  end

  groups_path = "#{output_dir}/groups/"
  assert_dir groups_path
  
  @root = "../"
  
  @group_name = "kde-frameworks"
  file_name = "groups/kde-frameworks"
  render_template "group", output_dir, file_name
  

  library_path = "#{output_dir}/libraries/"
  assert_dir library_path

  @root = "../"

  @manifest_handler.libraries.each do |library|
    @library = library
    @manifest = library.latest_manifest
    file_name = "libraries/" + library.name
    render_template "library", output_dir, file_name
  end

  if templates == 'two-column'
    topics_path = "#{output_dir}/topics/"
    assert_dir topics_path

    @root = "../"

    topics.each do |topic|
      @topic = topic
      file_name = "topics/" + topic
      render_template "topic", output_dir, file_name
    end
  end
end