Sha256: 2b3787bb7cacecc704ec7147fb24013ce33808e5bf19c268ea2217352c61df6f

Contents?: true

Size: 1.06 KB

Versions: 12

Compression:

Stored size: 1.06 KB

Contents

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

        desc "file", "Show version file format & name"
        def file
          puts "#{VersionInfo.file_format.to_s} format: #{target::VERSION.file_name}"
        end

        desc "show", "Show tag. Create version file if none"
        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

12 entries across 12 versions & 1 rubygems

Version Path
version_info-1.9.0 lib/version_info/thor_tasks.rb
version_info-1.8.8 lib/version_info/thor_tasks.rb
version_info-1.8.7 lib/version_info/thor_tasks.rb
version_info-1.8.5 lib/version_info/thor_tasks.rb
version_info-1.8.2 lib/version_info/thor_tasks.rb
version_info-1.8.0 lib/version_info/thor_tasks.rb
version_info-1.7.7 lib/version_info/thor_tasks.rb
version_info-1.7.6 lib/version_info/thor_tasks.rb
version_info-1.7.5 lib/version_info/thor_tasks.rb
version_info-1.7.4 lib/version_info/thor_tasks.rb
version_info-1.7.3 lib/version_info/thor_tasks.rb
version_info-1.7.2 lib/version_info/thor_tasks.rb