Rakefile in command_exec-0.1.3 vs Rakefile in command_exec-0.2.0

- old
+ new

@@ -1,29 +1,34 @@ #!/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' ] +unless ENV['TRAVIS_CI'] == 'true' + namespace :gem do + require 'bundler/gem_tasks' + end + + require 'yard' + require 'rubygems/package_task' + require 'active_support/core_ext/string/strip' end +YARD::Rake::YardocTask.new do; end + +desc 'start tmux' task :terminal do sh "script/terminal" end task :term => :terminal task :t => :terminal namespace :version do version_file = Dir.glob('lib/**/version.rb').first + desc 'bump version of library to new version' task :bump do - new_version = ENV['VERSION'] + new_version = ENV['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} @@ -38,10 +43,11 @@ sh "git add #{version_file}" sh "git commit -m 'version bump to #{new_version}'" sh "git tag data_uri-#{new_version}" end + desc 'show version of library' 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 } @@ -50,10 +56,35 @@ warn "Could not parse version file \"#{version_file}\"" end end + desc 'Restore version file from git repository' task :restore do sh "git checkout #{version_file}" end +end + +namespace :travis do + desc 'Runs travis-lint to check .travis.yml' + task :check do + sh 'travis-lint' + end +end + +namespace :test do + desc 'Run specs' + task :specs do + sh 'bundle exec rspec spec' + end + + desc 'Run tests in "travis mode"' + task :travis_specs do + ENV['TRAVIS_CI'] = 'true' + sh 'rspec spec' + end +end + +task :console do + sh 'script/console' end