Class: Gitem::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/gitem/generator.rb

Constant Summary collapse

TEMPLATE_PATH =
File.expand_path("index.html", __dir__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo_path, output_dir = nil) ⇒ Generator

Returns a new instance of Generator.



8
9
10
11
12
13
# File 'lib/gitem/generator.rb', line 8

def initialize(repo_path, output_dir = nil)
  @repo = Rugged::Repository.new(repo_path)
  @output_dir = output_dir || File.join(@repo.path, "srv")
  @processed_trees = Set.new
  @processed_blobs = Set.new
end

Instance Attribute Details

#output_dirObject (readonly)

Returns the value of attribute output_dir.



6
7
8
# File 'lib/gitem/generator.rb', line 6

def output_dir
  @output_dir
end

Instance Method Details

#export!Object



15
16
17
18
19
20
21
22
23
# File 'lib/gitem/generator.rb', line 15

def export!
  setup_directories
  export_branches
  export_tags
  export_commits
  export_repo_info
  copy_template
  puts "✓ Generated: #{@output_dir}"
end