Class: Zubat::CLI::App
- Inherits:
-
Object
show all
- Defined in:
- lib/zubat/cli/app.rb
Defined Under Namespace
Classes: GitRepo, Progress
Constant Summary
collapse
- Argv =
Data.define(:files, :silent, :root) do
def self.parse!(argv)
opt = OptionParser.new
root = nil
silent = false
opt.on('--silent', '-s') { silent = true }
opt.on('--root=ROOT') { |v| root = v }
files = opt.parse!(argv).uniq
abort 'no files to process, aborting.' if argv.empty?
new(files:, silent:, root:)
end
end
Instance Method Summary
collapse
Instance Method Details
#start(argv) ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/zubat/cli/app.rb', line 78
def start(argv)
argv = Argv.parse!(argv)
files = argv.files
repo = nil
results = Dir.chdir(argv.root || Dir.pwd) do
repo = GitRepo.guess
commits = Zubat::Commit.find(files:)
Progress
.new(commits, silent: argv.silent)
.map { |commit| Zubat::Analizer.new.analize(files:, commit:) }
end
file = Generator.new.generate(results:, site_url: repo&.site_url)
puts "Generated - #{file}\n"
end
|