Class: Milestoner::CLI
- Inherits:
-
Thor
- Object
- Thor
- Milestoner::CLI
- Includes:
- Thor::Actions, ThorPlus::Actions
- Defined in:
- lib/milestoner/cli.rb
Overview
The Command Line Interface (CLI) for the gem.
Instance Method Summary collapse
- #commits ⇒ Object
- #edit ⇒ Object
- #help(task = nil) ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ CLI
constructor
A new instance of CLI.
- #publish(version = ) ⇒ Object
- #push ⇒ Object
- #tag(version = ) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ CLI
Returns a new instance of CLI.
14 15 16 17 18 19 20 |
# File 'lib/milestoner/cli.rb', line 14 def initialize args = [], = {}, config = {} super args, , config @configuration = Milestoner::Configuration.new Milestoner::Identity.file_name, defaults: defaults @tagger = Milestoner::Tagger.new configuration.settings[:version], commit_prefixes: configuration.settings[:git_commit_prefixes] @pusher = Milestoner::Pusher.new end |
Instance Method Details
#commits ⇒ Object
24 25 26 27 28 |
# File 'lib/milestoner/cli.rb', line 24 def commits tagger.commit_list.each { |commit| say commit } rescue Milestoner::Errors::Base => base_error error base_error. end |
#edit ⇒ Object
60 61 62 63 |
# File 'lib/milestoner/cli.rb', line 60 def edit info "Editing: #{configuration.computed_file_path}..." `#{editor} #{configuration.computed_file_path}` end |
#help(task = nil) ⇒ Object
73 74 75 |
# File 'lib/milestoner/cli.rb', line 73 def help task = nil say && super end |
#publish(version = ) ⇒ Object
52 53 54 55 56 |
# File 'lib/milestoner/cli.rb', line 52 def publish version = configuration.settings[:version] tag_and_push version, rescue Milestoner::Errors::Base => base_error error base_error. end |
#push ⇒ Object
42 43 44 45 46 47 |
# File 'lib/milestoner/cli.rb', line 42 def push pusher.push info "Tags pushed to remote repository." rescue Milestoner::Errors::Base => base_error error base_error. end |
#tag(version = ) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/milestoner/cli.rb', line 33 def tag version = configuration.settings[:version] tagger.create version, sign: sign_tag?([:sign]) say "Repository tagged: #{tagger.version_label}." rescue Milestoner::Errors::Base => base_error error base_error. end |
#version ⇒ Object
67 68 69 |
# File 'lib/milestoner/cli.rb', line 67 def version say Milestoner::Identity.version_label end |