29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/meta_commit/cli.rb', line 29
def changelog(from_tag=nil, to_tag=nil)
repository_path = options[:directory]
filename = options[:filename]
repository = MetaCommit::Git::Repo.new(repository_path)
from_tag_commit = repository.commit_of_tag(from_tag)
to_tag_commit = repository.commit_of_tag(to_tag)
container = boot_container_with_config(File.join(repository_path, MetaCommit::ConfigurationStore::META_COMMIT_CONFIG_FILENAME))
examiner = MetaCommit::Changelog::Commands::CommitDiffExaminer.new(
container.resolve(:parse_command),
container.resolve(:contextual_ast_node_factory),
container.resolve(:diff_factory)
)
meta = examiner.meta(repository, from_tag_commit, to_tag_commit)
adapter = MetaCommit::Changelog::Adapters::Changelog.new(repository.dir, filename, to_tag, to_tag_commit.time.strftime('%Y-%m-%d'))
change_saver = MetaCommit::Services::ChangeSaver.new(repository, adapter)
change_saver.store_meta(meta)
say("added version [#{to_tag}] to #{filename}")
end
|