Sha256: f83b727ce88c36181fbe282ab226b4ab0782fcb3f1b48094c536825525db016c

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

#!/usr/bin/env rake
require 'bundler/gem_tasks'
require 'yard'
require 'rubygems/package_task'
require 'active_support/core_ext/string/strip'

YARD::Rake::YardocTask.new do |t|
  t.files   = ['lib/**/*.rb', 'README.md', 'LICENCE.md']
  t.options = ['--output-dir=doc/yard', '--markup-provider=redcarpet', '--markup=markdown' ]
end

task :terminal do
  sh "script/terminal"
end

task :term => :terminal
task :t => :terminal

namespace :version do
  version_file = Dir.glob('lib/**/version.rb').first

  task :bump do

    new_version = ENV['VERSION']

    raw_module_name = File.open(version_file, "r").readlines.grep(/module/).first
    module_name = raw_module_name.chomp.match(/module\s+(\S+)/) {$1}

    version_string = %Q{#main #{module_name}
module #{module_name}
  VERSION = '#{new_version}'
end}

    File.open(version_file, "w") do |f|
      f.write version_string.strip_heredoc
    end

    sh "git add #{version_file}" 
    sh "git commit -m 'version bump to #{new_version}'" 
    sh "git tag data_uri-#{new_version}" 
  end

  task :show do
    raw_version = File.open(version_file, "r").readlines.grep(/VERSION/).first

    if raw_version
      version = raw_version.chomp.match(/VERSION\s+=\s+["']([^'"]+)["']/) { $1 }
      puts version
    else
      warn "Could not parse version file \"#{version_file}\""
    end

  end

  task :restore do
    sh "git checkout #{version_file}"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
command_exec-0.1.3 Rakefile