Sha256: 0e4a776a0f1156dec96ab22cbcb417fdea23080db2d15caf5414ac36eb69c563

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require_relative File.join('..', 'lib', 'bhook')

puts "Bhook version #{Bhook::VERSION}"
parser = Bhook::ArgsParser.new(ARGV)
args = parser.parse

exit unless args

if args.help
  puts parser.help_text
  exit
end

Bhook::L.level = args.verbose ? Logger::DEBUG : Logger::INFO

if args.generate_theme
  Bhook::L.level = Logger::DEBUG
  Bhook::ThemeGenerator.new(args.generate_theme).generate!
  exit
end

workspaces = Bhook::Workspaces.new

if args.mount
  args.mount.each do |project, from_to|
    from = File.expand_path(from_to['from'])
    to = File.expand_path(from_to['to'])
    Bhook::L.debug "Mounting: #{project} \n\tfrom #{from} \n\tto #{to}"
    workspaces.mount(Bhook::Workspace.new(from, to, args.theme))
  end
else
  workspaces.mount(Bhook::Workspace.new(args.source, args.output, args.theme))
end

if args.benchmark
  require 'benchmark'
  n = 10
  Benchmark.bmbm do |bench|
    Bhook::L.level = Logger::WARN
    bench.report("Generate HTML #{n} times") { n.times { workspaces.each(&:process!) } }
  end
  exit
end

args.watch ? workspaces.watch! : workspaces.process!

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bhook-0.3.2 bin/bhook
bhook-0.3.1 bin/bhook
bhook-0.3.0 bin/bhook