Sha256: ca758daaf3f116ed20bcd905d4d1a207d41c531cbac3e9b5f0ff8bfb6cbc2dc1

Contents?: true

Size: 791 Bytes

Versions: 6

Compression:

Stored size: 791 Bytes

Contents

module Natour
  module_function

  def create(dir, out_dir: nil, out_file: nil, overwrite: false,
             track_formats: %i[gpx fit], create_map: true, map_layers: [], adoc_author: nil)
    out_dir = Pathname(out_dir || dir)
    out_file = Pathname(out_file || "#{Pathname(dir).realpath.basename}.adoc")
    reports = Report.load_directory(
      dir, track_formats: track_formats, create_map: create_map, map_layers: map_layers
    )
    reports.each.with_index(1) do |report, index|
      filename = if index < 2
                   out_dir.join(out_file)
                 else
                   out_dir.join("#{out_file.basename('.*')} (#{index})#{out_file.extname}")
                 end
      report.save_adoc(filename, overwrite: overwrite, author: adoc_author)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
natour-0.6.0 lib/natour/create.rb
natour-0.5.0 lib/natour/create.rb
natour-0.4.0 lib/natour/create.rb
natour-0.3.0 lib/natour/create.rb
natour-0.2.0 lib/natour/create.rb
natour-0.1.0 lib/natour/cli/create.rb