Sha256: 7536b44dd6499529d68811089c67760961a07d195f33b84adb25bc2b8458dec1

Contents?: true

Size: 1.74 KB

Versions: 22

Compression:

Stored size: 1.74 KB

Contents

require 'bundler/gem_helper'
require 'yard'
require "rspec/core/rake_task"

YARD::Rake::YardocTask.new do |t|
  t.files   = ['lib/**/*.rb']
  t.options = []
end

if /darwin/ =~ RUBY_PLATFORM
  task :spec do
    sh "rsdl -S rspec #{ENV['SPEC_OPTS']} #{ENV['SPEC']}"
  end

  task :guard do
    rspec_path = 'spec/rspec'
    File.open(rspec_path, 'w') do |f|
      f.write(<<-EOS)
#!/bin/sh
bundle exec rsdl -S rspec $@
      EOS
    end
    chmod(0755, rspec_path)
    begin
      sh "bundle exec guard"
    ensure
      rm_rf(rspec_path)
    end
  end
else
  RSpec::Core::RakeTask.new(:spec)
  task :guard do
    sh "bundle exec guard"
  end
end

task :rubocop do
  files = `git ls-files | grep -e '.rb$' | grep -v '^samples/'`
  sh "rubocop #{files.split(/\s+/m).join(' ')}"
end

namespace :gem do
  Bundler::GemHelper.install_tasks
end

task :build do
  ENV['GEM_PLATFORM'] = 'linux'
  Rake::Task['gem:build'].invoke

  ENV['GEM_PLATFORM'] = 'x86-mingw32'
  Rake::Task['gem:build'].reenable
  Rake::Task['gem:build'].invoke
end

task :release do
  ENV['GEM_PLATFORM'] = 'linux'
  Rake::Task['gem:release'].invoke

  ENV['GEM_PLATFORM'] = 'x86-mingw32'
  Rake::Task['gem:release'].reenable
  Rake::Task['gem:build'].reenable
  Rake::Task['gem:release'].invoke

  require 'smalruby/version'
  next_version = Smalruby::VERSION.split('.').tap { |versions|
    versions[-1] = (versions[-1].to_i + 1).to_s
  }.join('.')
  File.open('lib/smalruby/version.rb', 'r+') do |f|
    lines = []
    while line = f.gets
      line = "#{$1} '#{next_version}'\n" if /(\s*VERSION = )/.match(line)
      lines << line
    end
    f.rewind
    f.write(lines.join)
  end
  sh 'git add lib/smalruby/version.rb'
  sh "git commit -m #{next_version}"
  sh 'git push'
end

task :default => [:rubocop, :spec]

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
smalruby-0.0.24-x86-mingw32 Rakefile
smalruby-0.0.24 Rakefile
smalruby-0.0.23-x86-mingw32 Rakefile
smalruby-0.0.23 Rakefile
smalruby-0.0.22-x86-mingw32 Rakefile
smalruby-0.0.22 Rakefile
smalruby-0.0.21-x86-mingw32 Rakefile
smalruby-0.0.21 Rakefile
smalruby-0.0.20-x86-mingw32 Rakefile
smalruby-0.0.20 Rakefile
smalruby-0.0.19-x86-mingw32 Rakefile
smalruby-0.0.19 Rakefile
smalruby-0.0.18-x86-mingw32 Rakefile
smalruby-0.0.18 Rakefile
smalruby-0.0.17-x86-mingw32 Rakefile
smalruby-0.0.17 Rakefile
smalruby-0.0.16-x86-mingw32 Rakefile
smalruby-0.0.16 Rakefile
smalruby-0.0.15-x86-mingw32 Rakefile
smalruby-0.0.15 Rakefile