Sha256: 11aa8ad7fdc509c37868d4c2206e9574d88648cddaf1e4f20c34aa8c370b2bb7

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

require 'thor'
require 'date'
require 'yaml'

module Codelog
  class CLI < Thor
    desc 'setup', 'Generate the changelogs folder structure and the template.yml file'
    def setup
      Codelog::Command::Setup.run
    end

    desc 'new <NAME>', 'Generate a file from the template for the unreleased changes'
    method_option :edit, desc: 'Opens the default system editor after creating a changefile',
                         aliases: '-e', type: :boolean
    method_option :interactive, desc: 'Add contents interactively to change file',
                                aliases: '-i', type: :boolean
    def new(name = 'change')
      Codelog::Command::New.run name, options
    end

    desc 'release [VERSION] <RELEASE_DATE>', 'Generate new release updating changelog'
    method_option :preview, desc: 'Prints the preview of the specified version release',
                            aliases: ['-p', '--preview'], type: :boolean
    def release(version_number,
                release_date = Date.today.strftime(Codelog::Config.date_input_format))
      if options[:preview]
        Codelog::Command::Preview.run version_number, release_date
      else
        Codelog::Command::Release.run version_number, release_date
      end
    end

    desc 'bump [VERSION_TYPE] <RELEASE_DATE>', 'Bumps the next version,
     being it major, minor or patch'
    method_option :preview, desc: 'Prints the preview of the next version',
                            aliases: ['-p', '--preview'], type: :boolean
    def bump(version_type, release_date =
                Date.today.strftime(Codelog::Config.date_input_format))
      Codelog::Command::Bump.run version_type, release_date, options
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
codelog-0.8.0 lib/codelog/cli.rb