Sha256: 08d9d7bc6fbf27c1edd4c0a39a7c77584bcca1b0d5bf3f22cf61a89733aedc4c

Contents?: true

Size: 935 Bytes

Versions: 5

Compression:

Stored size: 935 Bytes

Contents

module VersionInfo
  module ThorTasks
    def self.install(opts = {})
      Class.new(::Thor) do
        @target = opts[:class]
        class << self
            attr_reader :target
        end
        namespace :vinfo

        desc 'show', "Show version tag and create version_info.yml if missing"
        def show
          puts target::VERSION.tag
          target::VERSION.save unless File.exist?(target::VERSION.file_name)
        end

        desc "inspect", "Show complete version info"
        def inspect
          puts target::VERSION.inspect
        end

        desc "bump SEGMENT=patch", "bumps segment: [#{VersionInfo.segments.join(', ')}]"
        def bump(sgm = :patch)
            target::VERSION.bump(sgm)
            puts "version changed to #{target::VERSION}"
            target::VERSION.save
        end

      protected
        def target
            self.class.target
        end
      end
    end
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
version_info-1.1.4 lib/version_info/thor_tasks.rb
version_info-1.1.2 lib/version_info/thor_tasks.rb
version_info-1.1.1 lib/version_info/thor_tasks.rb
version_info-1.1.0 lib/version_info/thor_tasks.rb
version_info-1.0.0 lib/version_info/thor_tasks.rb