diff --git a/History.md b/History.md index b124c31..9042e3c 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,31 @@ # RELEASE HISTORY +## Unreleased (1.11.0) + +VCLog's commands are now subcommands of `vclog`, in place of an +executable each. + +Changes: + +* Add `vclog version`, `vclog bump`, `vclog news`, `vclog formats` and + `vclog autotag`, which do what `vclog-version`, `vclog-bump`, + `vclog-news`, `vclog-formats` and `vclog-autotag` did. +* Add `vclog log`, the same as plain `vclog`, and `vclog history`, the + same as `vclog -r`. +* Add `vclog help`, which lists the commands, and `vclog help COMMAND`. +* Deprecate the separate executables. They still work, and will be + removed in 2.0. +* A first argument that isn't a command or an option is now an error. + Before, it was ignored. +* Autotag puts a release's tag on the latest commit made on or before + its date in the history file, counting the whole of that day. Before, + it stopped at the start of the day, so a release committed on its + own date was tagged one commit early. Its prompt now shows the + commit the tag will go on. +* Fix the `--prefix` and `--file` options of autotag: the first took no + value and the second raised an error. + + ## 1.10.0 / 2026-11-24 The first release since 2012. It makes VCLog work on current Ruby (2.7 diff --git a/README.md b/README.md index 92fbea7..ad0fa36 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,12 @@ To generate an a different format use -f: ### Creating Release Histories -To get a release history specify `-r`, `--release` or `--history` option. +To get a release history use the `history` command. - $ vclog -r + $ vclog history + +The `-r`, `--release` or `--history` option of plain `vclog` does the +same. Again the default format is an ANSI colored GNU-like text style. @@ -47,19 +50,20 @@ message is used as the release note. If the underlying SCM doesn't support tag messages than the message of the first commit prior to the tag is used. -See `vclog --help` for more options. +See `vclog --help` for more options, and `vclog help` for the list of +commands. ### Bumping Versions VCLog can also be used to intelligently bump versions. To see the current tag version: - $ vclog-version + $ vclog version 1.1.0 To see the next reasonable version based on current changes: - $ vclog-bump + $ vclog bump 1.2.0 VCLog can determine the appropriate version based on commit level. Any @@ -67,6 +71,17 @@ commit with a level greater than 1 will bump the major number, while any commit with a level of 0 or 1 will bump the minor number. All lower level only bump the patch level. +### Other Commands + + $ vclog news # the latest release note in the History file + $ vclog autotag # tag each release in the History file not yet tagged + $ vclog formats # list the output formats + $ vclog help # list the commands + +Before 1.11 these were separate executables: `vclog-version`, +`vclog-bump`, `vclog-news`, `vclog-formats` and `vclog-autotag`. Those +still work, but are deprecated and will be removed in 2.0. + ### Writing Heuristics VCLog can be configured to support custom log heuristics to suite the work flow diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..2c21529 --- /dev/null +++ b/TODO.md @@ -0,0 +1,10 @@ +# TODO + +## For 2.0 + +* Remove the deprecated executables `vclog-version`, `vclog-bump`, + `vclog-news`, `vclog-formats` and `vclog-autotag` (the files in + `bin/`, the "Deprecated Commands" feature in + `spec/feature_commands.rb`, and the mentions in the README and + `man/man1/vclog.1.ronn`). They were deprecated in 1.11.0, when their + work moved to subcommands: `vclog version`, `vclog bump`, and so on. diff --git a/bin/vclog b/bin/vclog index 274c766..d4a3577 100755 --- a/bin/vclog +++ b/bin/vclog @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -require 'vclog/cli/log' - -VCLog::CLI::Log.run(ARGV) +require 'vclog/cli' +VCLog::CLI.run(ARGV) diff --git a/bin/vclog-autotag b/bin/vclog-autotag index 52ab433..591e568 100755 --- a/bin/vclog-autotag +++ b/bin/vclog-autotag @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -require 'vclog/cli/autotag' +# Deprecated: use `vclog autotag`. Kept so that existing scripts go on working. -VCLog::CLI::Autotag.run(ARGV) +require 'vclog/cli' +VCLog::CLI.run(['autotag'] + ARGV) diff --git a/bin/vclog-bump b/bin/vclog-bump index 0a3f7b7..da0d3a2 100755 --- a/bin/vclog-bump +++ b/bin/vclog-bump @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -require 'vclog/cli/bump' +# Deprecated: use `vclog bump`. Kept so that existing scripts go on working. -VCLog::CLI::Bump.run(ARGV) +require 'vclog/cli' +VCLog::CLI.run(['bump'] + ARGV) diff --git a/bin/vclog-formats b/bin/vclog-formats index 7cc9af4..68b8d89 100755 --- a/bin/vclog-formats +++ b/bin/vclog-formats @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -require 'vclog/cli/formats' +# Deprecated: use `vclog formats`. Kept so that existing scripts go on working. -VCLog::CLI::Formats.run(ARGV) +require 'vclog/cli' +VCLog::CLI.run(['formats'] + ARGV) diff --git a/bin/vclog-news b/bin/vclog-news index eff1c79..dabcd86 100755 --- a/bin/vclog-news +++ b/bin/vclog-news @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -require 'vclog/cli/news' +# Deprecated: use `vclog news`. Kept so that existing scripts go on working. -VCLog::CLI::News.run(ARGV) +require 'vclog/cli' +VCLog::CLI.run(['news'] + ARGV) diff --git a/bin/vclog-version b/bin/vclog-version index 89115bd..09951ee 100755 --- a/bin/vclog-version +++ b/bin/vclog-version @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -require 'vclog/cli/version' +# Deprecated: use `vclog version`. Kept so that existing scripts go on working. -VCLog::CLI::Version.run(ARGV) +require 'vclog/cli' +VCLog::CLI.run(['version'] + ARGV) diff --git a/lib/vclog/cli.rb b/lib/vclog/cli.rb index a733858..0a6ab37 100644 --- a/lib/vclog/cli.rb +++ b/lib/vclog/cli.rb @@ -4,5 +4,93 @@ require 'vclog/cli/formats' require 'vclog/cli/bump' require 'vclog/cli/version' +require 'vclog/cli/news' require 'vclog/cli/autotag' +module VCLog + + # The `vclog` command line. The first argument can name a command; + # without one, a change log is printed. + # + # vclog [log] [options] + # vclog history [options] + # vclog version + # vclog bump + # vclog news + # vclog formats + # vclog autotag [options] + # vclog help [command] + # + module CLI + + # What each command does, in the order they are listed by `help`. + COMMANDS = [ + ['log', Log, 'print a change log (the default)'], + ['history', Log, 'print a release history'], + ['version', Version, 'print the current version'], + ['bump', Bump, 'print the next version, judging by the changes'], + ['news', News, 'print the latest release note of the history file'], + ['formats', Formats, 'list the output formats'], + ['autotag', Autotag, 'tag each release in the history file not yet tagged'] + ] + + # Other names a command answers to. + ALIASES = { 'changelog'=>'log', 'release'=>'history', 'templates'=>'formats' } + + # + # Run the command line. + # + def self.run(argv=ARGV) + argv = argv.dup + name = ALIASES[argv.first] || argv.first + + case name + when 'help' + argv.shift + help(argv.first) + when 'history' + argv.shift + Log.run(['--history'] + argv) + else + command = COMMANDS.find{ |term, _, _| term == name } + if command + argv.shift + command[1].run(argv) + elsif name && name !~ /\A-/ + $stderr.puts "vclog: unknown command -- #{name}" + $stderr.puts "Try `vclog help`." + exit(-1) + else + Log.run(argv) + end + end + end + + # + # Print the list of commands, or the help of one of them. + # + def self.help(name=nil) + name = ALIASES[name] || name + command = COMMANDS.find{ |term, _, _| term == name } + if command + command[1].run(name == 'history' ? ['--history', '--help'] : ['--help']) + elsif name + $stderr.puts "vclog: unknown command -- #{name}" + exit(-1) + else + puts "Usage: vclog [command] [options]" + puts + puts "COMMANDS:" + COMMANDS.each do |term, _, description| + puts " %-9s %s" % [term, description] + end + puts " %-9s %s" % ['help', 'show this list, or the options of a command'] + puts + puts "With no command, a change log is printed. See `vclog help log`" + puts "for its options." + end + end + + end + +end diff --git a/lib/vclog/cli/autotag.rb b/lib/vclog/cli/autotag.rb index fa47dc9..cf7385a 100644 --- a/lib/vclog/cli/autotag.rb +++ b/lib/vclog/cli/autotag.rb @@ -13,14 +13,14 @@ def self.terms # def parser super do |opt| - opt.banner = "Usage: vclog autotag" + opt.banner = "Usage: vclog autotag [options]" opt.separator(" ") opt.separator("DESCRIPTION:") opt.separator(" Ensure each entry in History has been tagged.") opt.separator(" ") opt.separator("SPECIAL OPTIONS:") - opt.on('--prefix', '-p', 'tag label prefix'){ options[:prefix] = true } - opt.on('--file' , '-f FILE', 'specify history file'){ options[:history_file] = file } + opt.on('--prefix', '-p PREFIX', 'tag label prefix'){ |prefix| options[:prefix] = prefix } + opt.on('--file' , '-f FILE', 'specify history file'){ |file| options[:history_file] = file } opt.on('--force' , '-y', 'perform tagging without confirmation'){ options[:force] = true } opt.on('--dryrun', '-n', 'run in dryrun mode'){ $DRYRUN = true } end diff --git a/lib/vclog/cli/bump.rb b/lib/vclog/cli/bump.rb index 2647abe..646724b 100644 --- a/lib/vclog/cli/bump.rb +++ b/lib/vclog/cli/bump.rb @@ -13,7 +13,7 @@ def self.terms # def parser super do |opt| - opt.banner = "Usage: vclog-bump" + opt.banner = "Usage: vclog bump" opt.separator(" ") opt.separator("Display a bumped version number.") end diff --git a/lib/vclog/cli/formats.rb b/lib/vclog/cli/formats.rb index 2f2b1c6..4786d88 100644 --- a/lib/vclog/cli/formats.rb +++ b/lib/vclog/cli/formats.rb @@ -14,7 +14,9 @@ def self.terms # def parser super do |opt| - opt.banner = "Usage: vclog-formats" + opt.banner = "Usage: vclog formats" + opt.separator(" ") + opt.separator("List the output formats.") end end diff --git a/lib/vclog/cli/log.rb b/lib/vclog/cli/log.rb index 01525de..c6d48e6 100644 --- a/lib/vclog/cli/log.rb +++ b/lib/vclog/cli/log.rb @@ -31,9 +31,10 @@ class Log < Abstract # Returns a instance of OptionParser. def parser super do |parser| - parser.banner = 'Usage: vclog [options]' + parser.banner = 'Usage: vclog [log|history] [options]' parser.separator(' ') parser.separator('Print a change log or release history.') + parser.separator('See `vclog help` for the other commands.') parser.separator(' ') parser.separator('OPTIONS: (use varies with format)') parser.on('-f', '--format FORMAT', 'output format (ansi,gnu,html,...)') do |format| diff --git a/lib/vclog/cli/news.rb b/lib/vclog/cli/news.rb index e26c14d..fdb884b 100644 --- a/lib/vclog/cli/news.rb +++ b/lib/vclog/cli/news.rb @@ -13,7 +13,7 @@ def self.terms # def parser super do |opt| - opt.banner = "Usage: vclog-news" + opt.banner = "Usage: vclog news" opt.separator(" ") opt.separator("Display first release note from history file.") end diff --git a/lib/vclog/repo.rb b/lib/vclog/repo.rb index e3a2772..6b71f22 100644 --- a/lib/vclog/repo.rb +++ b/lib/vclog/repo.rb @@ -84,16 +84,16 @@ def history_file # # Read history file and make a commit tag for any release not already - # tagged. Unless the force option is set the user will be prompted for + # tagged, on the latest commit made on or before the release's date. Unless the force option is set the user will be prompted for # each new tag. # def autotag(prefix=nil) history_file.tags.each do |tag| label = "#{prefix}#{tag.name}" if not adapter.tag?(label) - chg = adapter.change_by_date(tag.date) + chg = adapter.change_by_date(end_of_day(tag.date)) if chg - if force? or ask_yn(new_tag_message(label, tag) + "\nCreate tag? [yN] ") + if force? or ask_yn(new_tag_message(label, tag, chg) + "\nCreate tag? [yN] ") adapter.tag(chg.rev, label, tag.date, tag.message) end else @@ -281,8 +281,17 @@ def ask_yn(message) # # Returns a String. # - def new_tag_message(label, tag) - "#{label} / #{tag.date.strftime('%Y-%m-%d')}\n#{tag.message}" + def new_tag_message(label, tag, change) + "#{label} / #{tag.date.strftime('%Y-%m-%d')}\n#{tag.message}\n" + + "on commit #{change.id.to_s[0,7]} #{change.date.strftime('%Y-%m-%d %H:%M')} #{change.summary}" + end + + # + # The last second of the day a time falls in. A release dated in the + # history file takes in the commits made during that day. + # + def end_of_day(time) + ::Time.new(time.year, time.month, time.day, 23, 59, 59) end end diff --git a/lib/vclog/version.rb b/lib/vclog/version.rb index e55ce6c..81800f0 100644 --- a/lib/vclog/version.rb +++ b/lib/vclog/version.rb @@ -1,3 +1,3 @@ module VCLog - VERSION = '1.10.0' + VERSION = '1.11.0' end diff --git a/man/man1/index.txt b/man/man1/index.txt index ea429cf..dc0f3a2 100644 --- a/man/man1/index.txt +++ b/man/man1/index.txt @@ -1,7 +1,5 @@ # manuals vclog(1) vclog.1.ronn -vclog-changelog(1) vclog-changelog.1.ronn -vclog-history(1) vclog-history.1.ronn vclog-version(1) vclog-version.1.ronn vclog-news(1) vclog-news.1.ronn vclog-bump(1) vclog-bump.1.ronn diff --git a/man/man1/vclog-autotag.1.ronn b/man/man1/vclog-autotag.1.ronn index 7729fa7..843a36d 100644 --- a/man/man1/vclog-autotag.1.ronn +++ b/man/man1/vclog-autotag.1.ronn @@ -3,7 +3,7 @@ vclog-autotag(1) - tag history entries ## SYNOPSIS -`vclog-autotag` +`vclog autotag` ## DESCRIPTION diff --git a/man/man1/vclog-bump.1.ronn b/man/man1/vclog-bump.1.ronn index 4424426..8be7137 100644 --- a/man/man1/vclog-bump.1.ronn +++ b/man/man1/vclog-bump.1.ronn @@ -3,7 +3,7 @@ vclog-bump(1) - suggest next version ## SYNOPSIS -`vclog-bump` +`vclog bump` ## DESCRIPTION diff --git a/man/man1/vclog-news.1.ronn b/man/man1/vclog-news.1.ronn index e59474e..3e13620 100644 --- a/man/man1/vclog-news.1.ronn +++ b/man/man1/vclog-news.1.ronn @@ -3,7 +3,7 @@ vclog-news(1) - output latest release notice ## SYNOPSIS -`vclog-news` +`vclog news` ## DESCRIPTION @@ -11,7 +11,7 @@ Display the most recent entry in a project's history file. This command does NOT show the latest tag message, rather it is useful for making a new tag. For instnace: - `vclog-news | git tag -a -F - v1.0.0` + `vclog news | git tag -a -F - v1.0.0` This command will create a new git tag using the most recent message in the history file. diff --git a/man/man1/vclog-version.1.ronn b/man/man1/vclog-version.1.ronn index 6b3c253..7b98441 100644 --- a/man/man1/vclog-version.1.ronn +++ b/man/man1/vclog-version.1.ronn @@ -3,7 +3,7 @@ vclog-version(1) - display current version ## SYNOPSIS -`vclog-version` +`vclog version` ## DESCRIPTION diff --git a/man/man1/vclog.1.ronn b/man/man1/vclog.1.ronn index ceff212..ecdef3e 100644 --- a/man/man1/vclog.1.ronn +++ b/man/man1/vclog.1.ronn @@ -3,18 +3,53 @@ vclog(1) - version control logs ## SYNOPSIS -`vclog [options]` +`vclog [command] [options]` ## DESCRIPTION VCLog is a versitle cross-VCS/SCM changelog and release history generator. It currently supports Git, Hg and (limited) Subversion. +## COMMANDS + + * `log` + Print a change log. This is the default when no command is given. + + * `history` + Print a release history. The same as `vclog log --history`. + + * `version` + Print the current version. See vclog-version(1). + + * `bump` + Print the next version, judging by the changes. See vclog-bump(1). + + * `news` + Print the latest release note of the history file. See vclog-news(1). + + * `formats` + List the output formats. + + * `autotag` + Tag each release in the history file not yet tagged. See vclog-autotag(1). + + * `help` [] + List the commands, or show the options of one. + +The separate executables `vclog-version`, `vclog-bump`, `vclog-news`, +`vclog-formats` and `vclog-autotag` are deprecated and will be removed +in version 2.0. + ## OPTIONS +These are the options of `log` and `history`. + Note that not all formats support all options, and some formats use them in variant manners. + * `-r`, `--release`, `--history` + Print a release history instead of a change log. + * `-f`, `--format ` Output format (ansi, rdoc, html, etc.) diff --git a/spec/feature_commands.rb b/spec/feature_commands.rb index 3f585f9..410910c 100644 --- a/spec/feature_commands.rb +++ b/spec/feature_commands.rb @@ -1,35 +1,137 @@ -Feature "Version Commands" do +Feature "Commands" do As "a maintainer" - We "want to know the current version and the next one" + We "want one command line with a command for each task" Scenario "Current version" do + Given "a suitable Git repository" + When "I run `vclog version`" + Then "the exit status should be 0" + And 'the output should be "0.10.0"' + end + + Scenario "Next version" do + Given "a suitable Git repository" + When "I run `vclog bump`" + Then "the exit status should be 0" + And 'the output should be "0.11.0"' + end + + Scenario "Latest release note" do + Given "a suitable Git repository" + When "I run `vclog news`" + Then "the exit status should be 0" + And 'the output should be "The second release fixes the frobnicator."' + end + + Scenario "List of formats" do + Given "a suitable Git repository" + When "I run `vclog formats`" + Then "the exit status should be 0" + And 'the output should include "markdown"' + end + + Scenario "Change log by name" do + Given "a suitable Git repository" + When "I run `vclog log -f gnu`" + Then "the exit status should be 0" + And 'the output should include "CHANGELOG"' + And 'the output should include "Add the frobnicator."' + end + + Scenario "Change log is the default" do + Given "a suitable Git repository" + When "I run `vclog -f gnu`" + Then "the exit status should be 0" + And 'the output should include "CHANGELOG"' + end + + Scenario "Release history by name" do + Given "a suitable Git repository" + When "I run `vclog history -f gnu`" + Then "the exit status should be 0" + And 'the output should include "RELEASE HISTORY"' + And 'the output should include "0.10.0 / 2020-01-07"' + end + + Scenario "Release history by option" do + Given "a suitable Git repository" + When "I run `vclog -r -f gnu`" + Then "the exit status should be 0" + And 'the output should include "RELEASE HISTORY"' + end + + Scenario "List of commands" do + Given "a suitable Git repository" + When "I run `vclog help`" + Then "the exit status should be 0" + And 'the output should include "COMMANDS:"' + And 'the output should include "autotag"' + end + + Scenario "Help for a command" do + Given "a suitable Git repository" + When "I run `vclog help bump`" + Then "the exit status should be 0" + And 'the output should include "Usage: vclog bump"' + end + + Scenario "Unknown command" do + Given "a suitable Git repository" + When "I run `vclog frobnicate`" + Then "the exit status should be 255" + And 'the error output should include "unknown command -- frobnicate"' + end + + Scenario "Tag the releases in the history file, as a dry run" do + Given "a suitable Git repository" + When "I run `vclog autotag -n -y --debug`" + Then "the exit status should be 0" + And 'the output should not include "0.1.0"' + end + + include RepoCreation + include Shellout +end + +Feature "Deprecated Commands" do + As "a maintainer with scripts written for earlier versions" + We "want the separate executables to go on working" + + Scenario "vclog-version" do Given "a suitable Git repository" When "I run `vclog-version`" Then "the exit status should be 0" And 'the output should be "0.10.0"' end - Scenario "Bumped version" do + Scenario "vclog-bump" do Given "a suitable Git repository" When "I run `vclog-bump`" Then "the exit status should be 0" And 'the output should be "0.11.0"' end - Scenario "Latest release note" do + Scenario "vclog-news" do Given "a suitable Git repository" When "I run `vclog-news`" Then "the exit status should be 0" And 'the output should be "The second release fixes the frobnicator."' end - Scenario "List of formats" do + Scenario "vclog-formats" do Given "a suitable Git repository" When "I run `vclog-formats`" Then "the exit status should be 0" And 'the output should include "markdown"' end + Scenario "vclog-autotag" do + Given "a suitable Git repository" + When "I run `vclog-autotag --help`" + Then "the exit status should be 0" + And 'the output should include "Usage: vclog autotag"' + end + include RepoCreation include Shellout end diff --git a/spec/featurettes/shellout.rb b/spec/featurettes/shellout.rb index 2e16e84..03f4656 100644 --- a/spec/featurettes/shellout.rb +++ b/spec/featurettes/shellout.rb @@ -21,4 +21,8 @@ module Shellout @stdout.strip.assert == text end + Then 'the error output should include "(.*?)"' do |text| + @stderr.assert.include?(text) + end + end diff --git a/test/case_git.rb b/test/case_git.rb index dd2ed01..e3ba5b6 100644 --- a/test/case_git.rb +++ b/test/case_git.rb @@ -80,4 +80,47 @@ end end + test "autotag tags a release in the history file that has no tag" do + Dir.mktmpdir do |dir| + env = { 'GIT_CONFIG_GLOBAL'=>File::NULL, 'GIT_CONFIG_SYSTEM'=>File::NULL, + 'GIT_AUTHOR_DATE'=>'2020-03-01 12:00:00 +0000', 'GIT_COMMITTER_DATE'=>'2020-03-01 12:00:00 +0000' } + File.write(File.join(dir, 'HISTORY.md'), "## 1.0.0 / 2020-03-02\n\nThe first one.\n") + [ %w[init -q -b master], %w[config user.name Tester], %w[config user.email tester@example.com], + %w[config commit.gpgsign false], %w[config tag.gpgsign false], + %w[add HISTORY.md], ['commit', '-q', '-m', 'Start.'] + ].each do |args| + system(env, 'git', '-C', dir, *args, :out=>File::NULL, :err=>File::NULL).assert == true + end + + VCLog::Repo.new(dir, :force=>true).autotag + + tag = VCLog::Repo.new(dir, {}).tags.find{ |t| t.name == '1.0.0' } + tag.assert != nil + tag.message.assert == "The first one." + tag.commit.message.assert == "Start." + end + end + + test "autotag takes in the commits made on the day of the release" do + Dir.mktmpdir do |dir| + git = lambda do |date, *args| + env = { 'GIT_CONFIG_GLOBAL'=>File::NULL, 'GIT_CONFIG_SYSTEM'=>File::NULL, + 'GIT_AUTHOR_DATE'=>date, 'GIT_COMMITTER_DATE'=>date } + system(env, 'git', '-C', dir, *args, :out=>File::NULL, :err=>File::NULL).assert == true + end + File.write(File.join(dir, 'HISTORY.md'), "## 1.0.0 / 2020-03-02\n\nThe first one.\n") + [ %w[init -q -b master], %w[config user.name Tester], %w[config user.email tester@example.com], + %w[config commit.gpgsign false], %w[config tag.gpgsign false], %w[add HISTORY.md] + ].each{ |args| git.call('2020-03-01 12:00:00', *args) } + git.call('2020-03-01 12:00:00', 'commit', '-q', '-m', 'Start.') + git.call('2020-03-02 12:00:00', 'commit', '-q', '--allow-empty', '-m', 'Release 1.0.0.') + git.call('2020-03-03 12:00:00', 'commit', '-q', '--allow-empty', '-m', 'Carry on.') + + VCLog::Repo.new(dir, :force=>true).autotag + + tag = VCLog::Repo.new(dir, {}).tags.find{ |t| t.name == '1.0.0' } + tag.commit.message.assert == "Release 1.0.0." + end + end + end