DannyBen/snapcrawl

View on GitHub
Runfile

Summary

Maintainability
Test Coverage
require 'snapcrawl/version'

title   'Snapcrawl Runfile'
summary 'Runfile tasks for building the Snapcrawl gem'
version Snapcrawl::VERSION

import_gem 'runfile-tasks/gem'
import 'debug'

help   "Regenerate the command line output in the README file"
action :patchme do
  readme = File.read 'README.md'
  usage  = `bundle exec snapcrawl -h`
  usage.gsub!(/^/, "    ")
  readme.gsub!(/(\$ snapcrawl --help)(.*)(---\s*)/m) { "#{$1}\n\n#{usage}\n#{$3}" }
  File.write "README.md", readme
end

help   "Generate changelog and append old changelog"
action :changelog do
  system "git changelog --save"
  # append older changelog (prior to switching to git-changelog)
  system "cat .changelog.old.md >> CHANGELOG.md"
end

usage  "mockserver"
help   "Start the mock server"
action :mockserver do
  Dir.chdir 'spec/server' do
    system 'rackup -p 3000 -o 0.0.0.0'
  end
rescue Interrupt
  abort "\rBye"
end