class Chandler::CLI::Parser
Attributes
args[R]
config[R]
Public Class Methods
new(args, config=Chandler::Configuration.new)
click to toggle source
# File lib/chandler/cli/parser.rb, line 12 def initialize(args, config=Chandler::Configuration.new) @args = args @config = config parse_options end
Public Instance Methods
usage()
click to toggle source
# File lib/chandler/cli/parser.rb, line 18 def usage option_parser.to_s end
Private Instance Methods
option_parser()
click to toggle source
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength rubocop:disable Metrics/BlockLength
# File lib/chandler/cli/parser.rb, line 36 def option_parser OptionParser.new do |opts| opts.banner = "Usage: chandler push [tag] [options]" opts.separator("") opts.separator(summary) opts.separator("") opts.on("--git=[PATH]", "Path to .git directory") do |p| config.git_path = p end opts.on("--github=[URL]", "GitHub repository URL or owner/repo") do |u| config.github_repository = u end opts.on("--changelog=[PATH]", "Path to CHANGELOG Markdown file") do |p| config.changelog_path = p end opts.on("--tag-prefix=[PREFIX]", "Use PREFIX to identify Git version tags") do |p| config.tag_prefix = p end opts.on("--dry-run", "Simulate, but don’t actually push to GitHub") do |d| config.dry_run = d end opts.on("-h", "--help", "Show this help message") do info(opts.to_s) exit end opts.on("-v", "--version", "Print the chandler version number") do info("chandler version #{Chandler::VERSION}") exit end end end
parse_options()
click to toggle source
# File lib/chandler/cli/parser.rb, line 24 def parse_options unprocessed = [] until args.empty? option_parser.order!(args) unprocessed << args.shift end @args = unprocessed.compact end
summary()
click to toggle source
# File lib/chandler/cli/parser.rb, line 79 def summary <<-SUMMARY chandler scans your git repository for version tags (e.g. `v1.0.2`), parses out the corresponding release notes for those tags from your CHANGELOG, and uploads those notes to the GitHub releases area via the GitHub API. chandler will use reasonable defaults and inferences to configure itself. If chandler doesn’t work for you out of the box, override the configuration using these options. SUMMARY end