Sha256: bd122169da839f06bbe6508df7c7dd8e119d5d40236263b1b784769509f8d188

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new do |task|
  task.verbose = false
end

RuboCop::RakeTask.new

desc 'Generate README.md from README.md.erb'
task :readme do
  puts 'Generating README.md...'
  File.write('README.md', generate_readme)
  puts 'Done.'
end

namespace :readme do
  task :validate do
    puts 'Validating README.md...'

    unless File.read('README.md') == generate_readme
      raise <<-END.gsub(/^\s+\|/, '').chomp
        |README.md and README.md.erb are out of sync!
        |If you need to modify the content of README.md:
        |  * Edit README.md.erb.
        |  * Run `bundle exec rake readme`.
        |  * Commit both files.
      END
    end

    puts 'Done.'
  end
end

def generate_readme
  require 'erb'
  require 'increments/schedule'
  readme = File.read('README.md.erb')
  erb = ERB.new(readme, nil, '-')
  erb.result(binding)
end

ci_tasks = %w(spec rubocop)
# For some reason MRI 2.3 returns the method list with different order.
ci_tasks << 'readme:validate' if RUBY_VERSION.start_with?('2.2.')
task ci: ci_tasks

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
increments-schedule-0.14.0 Rakefile
increments-schedule-0.13.2 Rakefile
increments-schedule-0.13.1 Rakefile
increments-schedule-0.13.0 Rakefile
increments-schedule-0.12.0 Rakefile
increments-schedule-0.11.0 Rakefile
increments-schedule-0.10.0 Rakefile