class Softcover::Builder

Attributes

built_files[RW]
manifest[RW]

Public Class Methods

new() click to toggle source
# File lib/softcover/builder.rb, line 7
def initialize
  @manifest = Softcover::BookManifest.new(verify_paths: true,
                                          source: source)
  @built_files = []
  ensure_style_file_locations
  write_polytexnic_commands_file
  write_language_customization_file
end

Public Instance Methods

build!(options={}) click to toggle source
# File lib/softcover/builder.rb, line 16
def build!(options={})
  setup(options)
  build(options)
  verify
  self
end
clean!() click to toggle source
# File lib/softcover/builder.rb, line 23
def clean!; end

Private Instance Methods

ensure_style_file_locations() click to toggle source

Ensures the style files are in the right location. This is for backwards compatibility.

# File lib/softcover/builder.rb, line 31
def ensure_style_file_locations
  styles_dir = Softcover::Directories::STYLES
  mkdir styles_dir
  files = Dir.glob('*.sty')
  FileUtils.mv(files, styles_dir)
end
listing_customization() click to toggle source
# File lib/softcover/builder.rb, line 54
      def listing_customization
        listing = language_labels["listing"].downcase
        box     = language_labels["aside"]
        <<-EOS
% Aside box label
\\renewcommand{\\boxlabel}{#{box}}

% Codelisting captions
\\usepackage[hypcap=false]{caption}
\\DeclareCaptionFormat{#{listing}}{\\hspace{-0.2em}\\colorbox[gray]{.85}{\\hspace{0.1em}\\parbox{0.997\\textwidth}{#1#2#3}}\\vspace{-1.3\\baselineskip}}
\\captionsetup[#{listing}]{format=#{listing},labelfont=bf,skip=16pt,font={rm,normalsize}}
\\DeclareCaptionType{#{listing}}
\\newcommand{\\codecaption}[1]{\\captionof{#{listing}}{#1}}
        EOS
      end
setup() click to toggle source
# File lib/softcover/builder.rb, line 26
def setup; end
styles_dir() click to toggle source
# File lib/softcover/builder.rb, line 49
def styles_dir
  File.join(Dir.pwd, Softcover::Directories::STYLES)
end
verify() click to toggle source
# File lib/softcover/builder.rb, line 27
def verify; end
write_language_customization_file() click to toggle source
# File lib/softcover/builder.rb, line 43
def write_language_customization_file
  filename = File.join(styles_dir, 'language_customization.sty')
  contents = listing_customization
  File.write(filename, contents)
end
write_polytexnic_commands_file() click to toggle source

Writes out the PolyTeXnic commands from polytexnic.

# File lib/softcover/builder.rb, line 39
def write_polytexnic_commands_file
  Polytexnic.write_polytexnic_style_file(styles_dir)
end