Class: InfuseDSL

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/infuse/infuse_dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInfuseDSL

Returns a new instance of InfuseDSL.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/infuse/infuse_dsl.rb', line 12

def initialize
  @slides = []
  @title = @author = @company = @copyright = @subtitle = @background = @format = @transition = ""

  @template_dir = File.dirname(__FILE__) + "/themes/plain/"
  @operashow_templates = {
      :header => "operashow-header.html.erb",
      :footer => "operashow-footer.html.erb",
      :slide => "slide.html.erb",
      :title_slide => "title-page.html.erb"
  }

  @html_templates = {
      :header => "header.html.erb",
      :footer => "footer.html.erb",
      :slide => "slide.html.erb",
      :title_slide => "title-page.html.erb"
  }
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



7
8
9
# File 'lib/infuse/infuse_dsl.rb', line 7

def author
  @author
end

#backgroundObject

Returns the value of attribute background.



8
9
10
# File 'lib/infuse/infuse_dsl.rb', line 8

def background
  @background
end

#companyObject

Returns the value of attribute company.



7
8
9
# File 'lib/infuse/infuse_dsl.rb', line 7

def company
  @company
end

Returns the value of attribute copyright.



7
8
9
# File 'lib/infuse/infuse_dsl.rb', line 7

def copyright
  @copyright
end

#formatObject

Returns the value of attribute format.



8
9
10
# File 'lib/infuse/infuse_dsl.rb', line 8

def format
  @format
end

#output_dirObject

Derived



10
11
12
# File 'lib/infuse/infuse_dsl.rb', line 10

def output_dir
  @output_dir
end

#slidesObject

Returns the value of attribute slides.



7
8
9
# File 'lib/infuse/infuse_dsl.rb', line 7

def slides
  @slides
end

#source_fileObject

Derived



10
11
12
# File 'lib/infuse/infuse_dsl.rb', line 10

def source_file
  @source_file
end

#subtitleObject

Returns the value of attribute subtitle.



7
8
9
# File 'lib/infuse/infuse_dsl.rb', line 7

def subtitle
  @subtitle
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/infuse/infuse_dsl.rb', line 7

def title
  @title
end

#transitionObject

Returns the value of attribute transition.



8
9
10
# File 'lib/infuse/infuse_dsl.rb', line 8

def transition
  @transition
end

Instance Method Details

#add_slide(slide) ⇒ Object



32
33
34
# File 'lib/infuse/infuse_dsl.rb', line 32

def add_slide(slide)
  @slides << slide
end

#runObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/infuse/infuse_dsl.rb', line 36

def run
  html_output = generate_slideshow(@html_templates)
  operashow_output = generate_slideshow(@operashow_templates)

  prepare_target_dir

  begin
    File.new(output_file, "w").puts(html_output)
    File.new(output_file('operashow-'), "w").puts(operashow_output)
  rescue
    puts $!
    exit
  end

end