Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
source "http://rubygems.org"
gemspec

gem 'thor'

group :development, :test do
gem 'rspec'
end
19 changes: 19 additions & 0 deletions lib/tasks/cucumber_spork.thor
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class CucumberSpork < Thor
include Thor::Actions

desc "start", "starts Spork Cucumber in the background"
def start
run "(bundle exec spork cucumber &)"
end

desc "stop", "stops Spork Cucumber"
def stop
Process.kill(:TERM, `ps -ef | grep "spork cucumber" | grep -v grep | awk '{ print $2 }'`.to_i)
end

desc "restart", "restarts Spork Cucumber"
def restart
invoke :stop
invoke :start
end
end
4 changes: 2 additions & 2 deletions lib/tasks/spork.thor
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ class Spork < Thor

desc "start", "starts Spork in the background"
def start
run "(bundle exec spork &)"
run "(bundle exec spork rspec &)"
end

desc "stop", "stops Spork"
def stop
Process.kill(:TERM, `ps -ef | grep spork | grep -v grep | awk '{ print $2 }'`.to_i)
Process.kill(:TERM, `ps -ef | grep "spork rspec" | grep -v grep | awk '{ print $2 }'`.to_i)
end

desc "restart", "restarts Spork"
Expand Down
9 changes: 5 additions & 4 deletions lib/thor_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
require 'rails/generators'

module ThorTasks

class InstallGenerator < Rails::Generators::Base
desc "Installs thor tasks into your Rails application."

def self.source_root
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'tasks'))
end

def copy_tasks
copy_file "spec.thor", "lib/tasks/spec.thor"
copy_file "spork.thor", "lib/tasks/spork.thor"
copy_file "cucumber_spork.thor", "lib/tasks/cucumber_spork.thor"
end
end

end
7 changes: 7 additions & 0 deletions spec/tasks/cucumber_spork.thor_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

describe CucumberSpork do
it { should respond_to :start }
it { should respond_to :restart }
it { should respond_to :stop }
end