kwoon 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +21 -0
- data/README.markdown +74 -0
- data/bin/kwoon +16 -0
- data/features/descriptions/create.feature +73 -0
- data/features/descriptions/git.feature +15 -0
- data/features/descriptions/start.feature +13 -0
- data/features/step_definitions/command_steps.rb +11 -0
- data/features/step_definitions/git_steps.rb +43 -0
- data/features/step_definitions/rvm_steps.rb +18 -0
- data/features/support/env.rb +15 -0
- data/kwoon.gemspec +30 -0
- data/lib/kwoon/cli.rb +87 -0
- data/lib/kwoon/templates/Gemfile.tt +12 -0
- data/lib/kwoon/templates/autotest/discover.rb.tt +5 -0
- data/lib/kwoon/templates/autotest/kwoon_rspec2.rb.tt +59 -0
- data/lib/kwoon/templates/autotest.tt +1 -0
- data/lib/kwoon/templates/gitignore.tt +2 -0
- data/lib/kwoon/templates/lib/kata_name.rb.tt +0 -0
- data/lib/kwoon/templates/rspec.tt +1 -0
- data/lib/kwoon/templates/rvmrc.tt +1 -0
- data/lib/kwoon/templates/spec/kata_name_spec.rb.tt +8 -0
- data/lib/kwoon/templates/spec/spec_helper.rb.tt +4 -0
- data/lib/kwoon/version.rb +3 -0
- metadata +119 -0
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in kwoon.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# The following gems aren't dependencies in an installed gem
|
7
|
+
# (RubyGems puts gems in directories eg kwoon-0.0.1)
|
8
|
+
# Hacky but it will do for now.
|
9
|
+
dir_name = File.dirname(__FILE__).split("/").last
|
10
|
+
unless dir_name =~ /\d$/
|
11
|
+
group :development do
|
12
|
+
gem "awesome_print"
|
13
|
+
gem "cucumber"
|
14
|
+
gem "aruba"
|
15
|
+
gem "rspec", ">= 2.0.0.rc"
|
16
|
+
gem "autotest"
|
17
|
+
gem "autotest-fsevent"
|
18
|
+
end
|
19
|
+
|
20
|
+
gem "awesome_print", :require => "ap", :group => [ :development, :dev_utils ]
|
21
|
+
end
|
data/README.markdown
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Kwoon
|
2
|
+
|
3
|
+
## Prerequisites
|
4
|
+
|
5
|
+
You need Git installed.
|
6
|
+
|
7
|
+
If you intend to publish the kata history, you need push rights to
|
8
|
+
a remote Git repository.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
### RVM
|
13
|
+
|
14
|
+
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
|
15
|
+
|
16
|
+
### Ruby
|
17
|
+
|
18
|
+
rvm install 1.9.2
|
19
|
+
rvm use 1.9.2
|
20
|
+
|
21
|
+
(Kwoon should run fine in 1.8 implementations too.)
|
22
|
+
|
23
|
+
### kwoon
|
24
|
+
|
25
|
+
gem install kwoon
|
26
|
+
|
27
|
+
## Running a kata
|
28
|
+
|
29
|
+
kwoon create <kata_name> [--ruby_version=1.9.2]
|
30
|
+
|
31
|
+
The --ruby-version flag is optional. Kwoon defaults to creating projects
|
32
|
+
targeting Ruby 1.9.2. The value of --ruby-version must be a valid RVM
|
33
|
+
ruby version. Run `rvm list known` to see these.
|
34
|
+
|
35
|
+
cd <kata_name>
|
36
|
+
|
37
|
+
Answer "y" when asked if you trust the .rvmrc file.
|
38
|
+
|
39
|
+
Initialise Git:
|
40
|
+
|
41
|
+
kwoon git <remote_git_repo>
|
42
|
+
|
43
|
+
e.g.
|
44
|
+
|
45
|
+
kwoon git git@github.com:account_name/repo_name.git
|
46
|
+
|
47
|
+
You must specify a remote repository in this version of Kwoon.
|
48
|
+
(It doesn't have to exist at this point, though.)
|
49
|
+
|
50
|
+
Next start a pairing session:
|
51
|
+
|
52
|
+
kwoon start <username1> <username2> ... <usernameN>
|
53
|
+
|
54
|
+
e.g.
|
55
|
+
|
56
|
+
kwoon start fred wilma
|
57
|
+
|
58
|
+
This will create a branch "fred-wilma-YYYYMMDDhhmm"
|
59
|
+
|
60
|
+
Start autotest.
|
61
|
+
|
62
|
+
autotest
|
63
|
+
|
64
|
+
(Autotest will refuse to run if you haven't run `kwoon start`).
|
65
|
+
|
66
|
+
Autotest is set up to commit all your work to Git after every change
|
67
|
+
in red/green status.
|
68
|
+
|
69
|
+
Hack away! Then, when done...
|
70
|
+
|
71
|
+
git push
|
72
|
+
|
73
|
+
Git is configured to create a new branch on the remote repo from
|
74
|
+
your current branch (e.g. "fred-wilma-201010081655").
|
data/bin/kwoon
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
def project_file(*path_parts)
|
7
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", *path_parts))
|
8
|
+
end
|
9
|
+
ENV['BUNDLE_GEMFILE'] = project_file("Gemfile")
|
10
|
+
|
11
|
+
Bundler.require(:default, :dev_utils)
|
12
|
+
|
13
|
+
require 'kwoon/cli'
|
14
|
+
|
15
|
+
Kwoon::CLI.start
|
16
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
Feature: Create a Kata
|
2
|
+
In order to get a Kata setup easily and quickly
|
3
|
+
As a Developer
|
4
|
+
I want a command line utility that sets up all I need to start a Kata
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given there is no RVM gemset "kwoon_test_kata_name" for Ruby "1.9.2"
|
8
|
+
|
9
|
+
Scenario: Create a kata
|
10
|
+
When I successfully run "kwoon create test_kata_name" with the local gem in a clean environment
|
11
|
+
|
12
|
+
Then the following directories should exist:
|
13
|
+
| test_kata_name |
|
14
|
+
And the following files should exist:
|
15
|
+
| test_kata_name/.autotest |
|
16
|
+
| test_kata_name/.rspec |
|
17
|
+
| test_kata_name/.rvmrc |
|
18
|
+
| test_kata_name/.gitignore |
|
19
|
+
| test_kata_name/autotest/discover.rb |
|
20
|
+
| test_kata_name/autotest/kwoon_rspec2.rb |
|
21
|
+
| test_kata_name/Gemfile |
|
22
|
+
| test_kata_name/Gemfile.lock |
|
23
|
+
| test_kata_name/lib/test_kata_name.rb |
|
24
|
+
| test_kata_name/spec/test_kata_name_spec.rb |
|
25
|
+
| test_kata_name/spec/spec_helper.rb |
|
26
|
+
|
27
|
+
And the file "test_kata_name/.rvmrc" should contain exactly:
|
28
|
+
"""
|
29
|
+
rvm use 1.9.2@kwoon_test_kata_name
|
30
|
+
"""
|
31
|
+
And the file "test_kata_name/.gitignore" should contain exactly:
|
32
|
+
"""
|
33
|
+
.DS_Store
|
34
|
+
.bundle
|
35
|
+
"""
|
36
|
+
And the file "test_kata_name/.autotest" should contain exactly:
|
37
|
+
"""
|
38
|
+
require "autotest/fsevent" if RUBY_PLATFORM =~ /darwin/
|
39
|
+
"""
|
40
|
+
And the file "test_kata_name/spec/test_kata_name_spec.rb" should contain exactly:
|
41
|
+
"""
|
42
|
+
require 'spec_helper'
|
43
|
+
require 'test_kata_name'
|
44
|
+
|
45
|
+
describe "test_kata_name" do
|
46
|
+
it "does something" do
|
47
|
+
fail "needs some specs"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
"""
|
51
|
+
And the file "test_kata_name/Gemfile" should contain exactly:
|
52
|
+
"""
|
53
|
+
source :rubygems
|
54
|
+
|
55
|
+
# No gems in the default group...
|
56
|
+
|
57
|
+
group :test do
|
58
|
+
gem "rspec", ">= 2.0.0.rc"
|
59
|
+
end
|
60
|
+
|
61
|
+
group :install_only do
|
62
|
+
gem "autotest"
|
63
|
+
gem "autotest-fsevent" if RUBY_PLATFORM =~ /darwin/
|
64
|
+
end
|
65
|
+
"""
|
66
|
+
|
67
|
+
And there should be a gemset called "kwoon_test_kata_name"
|
68
|
+
And the gemset "kwoon_test_kata_name" should include the gems:
|
69
|
+
| bundler |
|
70
|
+
| rspec |
|
71
|
+
| autotest |
|
72
|
+
| autotest-fsevent |
|
73
|
+
| kwoon |
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Git branch creation for a new Kata
|
2
|
+
In order to have Git setup with a branch for each version of the Kata
|
3
|
+
As a Developer
|
4
|
+
I want to have a command line utility that configures Git
|
5
|
+
|
6
|
+
Scenario: Setup the Git repository
|
7
|
+
Given I have successfully run "kwoon create test_kata" with the local gem in a clean environment
|
8
|
+
When I cd to "test_kata"
|
9
|
+
# NOTE this mimics the 'real life' situation of cd'ing into the folder
|
10
|
+
# as that would actually switch gemsets to kwoon_test_kata
|
11
|
+
And I successfully run "rvm 1.9.2@kwoon_test_kata exec kwoon git user@git.host:repo.git" in a clean environment
|
12
|
+
Then the Git remote "origin" should point to "user@git.host:repo.git"
|
13
|
+
And the Git config setting for "push.default" should be "current"
|
14
|
+
And all files have been committed to the Git repository
|
15
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Start a Kata
|
2
|
+
In order to have a have my work recorded in a silo
|
3
|
+
As a Developer
|
4
|
+
I want to start a Kata session with a baseline to work from
|
5
|
+
|
6
|
+
Scenario: Start
|
7
|
+
Given I have successfully run "kwoon create test_kata" with the local gem in a clean environment
|
8
|
+
And I cd to "test_kata"
|
9
|
+
# NOTE this mimics the 'real life' situation of cd'ing into the folder
|
10
|
+
# as that would actually switch gemsets to kwoon_test_kata
|
11
|
+
And I have successfully run "rvm 1.9.2@kwoon_test_kata exec kwoon git user@git.host:repo.git" in a clean environment
|
12
|
+
And I successfully run "rvm 1.9.2@kwoon_test_kata exec kwoon start andy ashley" in a clean environment
|
13
|
+
Then I should be on a Git branch called "andy-ashley" with a timestamp appended
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^I (?:have )?successfully run "([^"]*)" in a clean environment$/ do |command|
|
2
|
+
Bundler.with_clean_env do
|
3
|
+
When %'I successfully run "#{command}"'
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^I (?:have )?successfully run "([^"]*)" with the local gem in a clean environment$/ do |command|
|
8
|
+
Bundler.with_clean_env do
|
9
|
+
When %'I successfully run "#{command} --kwoon-gem #{KWOON_GEM}"'
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module GitHelpers
|
2
|
+
def repo
|
3
|
+
Grit::Repo.new(".")
|
4
|
+
end
|
5
|
+
end
|
6
|
+
World(GitHelpers)
|
7
|
+
|
8
|
+
Then /^the Git remote "([^"]*)" should point to "([^"]*)"$/ do |git_remote, point_to|
|
9
|
+
in_current_dir do
|
10
|
+
repo.config[%'remote.#{git_remote}.url'].should eq point_to
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^the Git config setting for "([^"]*)" should be "([^"]*)"$/ do |setting, value|
|
15
|
+
in_current_dir do
|
16
|
+
repo.config[setting].should eq value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /^all files have been committed to the Git repository$/ do
|
21
|
+
# NOTE: Current version of Grit (2.3.0) doesn't handle a repository with no commits
|
22
|
+
|
23
|
+
in_current_dir do
|
24
|
+
repo.status.any?.should be_true
|
25
|
+
|
26
|
+
repo.status.added.should be_empty
|
27
|
+
repo.status.changed.should be_empty
|
28
|
+
repo.status.deleted.should be_empty
|
29
|
+
repo.status.untracked.should be_empty
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Then /^I should be on a Git branch called "([^"]*)" with a timestamp appended$/ do |branch_name|
|
34
|
+
in_current_dir do
|
35
|
+
repo.head.name.should =~ /#{branch_name}-(\d+)/
|
36
|
+
|
37
|
+
repo.head.name =~ /#{branch_name}-(\d+)/
|
38
|
+
timestamp_string = $1
|
39
|
+
timestamp_string =~ /(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
|
40
|
+
timestamp = Time.local($1, $2, $3, $4, $5)
|
41
|
+
timestamp.should be_close(Time.new, 60)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Given /^there is no RVM gemset "([^"]*)" for Ruby "([^"]*)"$/ do |gemset, ruby_version|
|
2
|
+
RVM.environment(ruby_version) do |env|
|
3
|
+
env.gemset_delete(gemset)
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
Then /^there should be a gemset called "([^"]*)"$/ do |expected_gemset|
|
8
|
+
RVM.gemset_list.should include(expected_gemset)
|
9
|
+
end
|
10
|
+
|
11
|
+
Then /^the gemset "([^"]*)" should include the gems:$/ do |gemset, gems_table|
|
12
|
+
Bundler.with_clean_env do
|
13
|
+
installed_gems = `rvm 1.9.2@#{gemset} gem list`
|
14
|
+
gems_table.raw.each do |row|
|
15
|
+
installed_gems.should include(row.first)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler.require(:default, :development)
|
3
|
+
|
4
|
+
rvm_lib_path = "#{`echo $rvm_path`.strip}/lib"
|
5
|
+
$LOAD_PATH.unshift(rvm_lib_path) unless $LOAD_PATH.include?(rvm_lib_path)
|
6
|
+
require 'rvm'
|
7
|
+
|
8
|
+
def project_file(*path_parts)
|
9
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", *path_parts))
|
10
|
+
end
|
11
|
+
KWOON_COMMAND = project_file("bin", "kwoon")
|
12
|
+
KWOON_GEM = project_file("kwoon-#{Kwoon::VERSION}.gem")
|
13
|
+
|
14
|
+
system "gem build kwoon.gemspec"
|
15
|
+
system "gem install #{KWOON_GEM}"
|
data/kwoon.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "kwoon/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "kwoon"
|
7
|
+
s.version = Kwoon::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Ashley Moran", "Andy Shipman"]
|
10
|
+
s.email = ["ashley.moran@patchspace.co.uk; andy@cllearview.com"]
|
11
|
+
s.homepage = "http://patch-tag.com/r/ashleymoran/kwoon/snapshot/current/content/pretty/README.markdown"
|
12
|
+
s.summary = "kwoon-#{Kwoon::VERSION}"
|
13
|
+
s.description = "A helper utility for running Coding Dojos"
|
14
|
+
|
15
|
+
s.rubyforge_project = "kwoon"
|
16
|
+
|
17
|
+
s.default_executable = "kwoon"
|
18
|
+
|
19
|
+
s.add_dependency "thor"
|
20
|
+
s.add_dependency "grit"
|
21
|
+
|
22
|
+
s.files = %w[
|
23
|
+
Gemfile
|
24
|
+
kwoon.gemspec
|
25
|
+
README.markdown
|
26
|
+
] + Dir["lib/**/*"]
|
27
|
+
s.test_files = Dir["spec/**/*"] + Dir["features/**/*"]
|
28
|
+
s.executables = "kwoon"
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
end
|
data/lib/kwoon/cli.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Useful commands for development:
|
2
|
+
# rm -rf shopping && gem uninstall -x kwoon && gem build kwoon.gemspec && gem install /Users/andy/dev/patchspace/kwoon/kwoon-0.0.1.gem && kwoon create shopping --kwoon-gem /Users/andy/dev/patchspace/kwoon/kwoon-0.0.1.gem && cd shopping && kwoon git blah@blah.com:a/ab
|
3
|
+
# rm -rf shopping && gem build kwoon.gemspec && gem install /Users/andy/dev/patchspace/kwoon/kwoon-0.0.1.gem && kwoon create shopping --kwoon-gem /Users/andy/dev/patchspace/kwoon/kwoon-0.0.1.gem && cd shopping && kwoon git blah@blah.com:a/ab
|
4
|
+
|
5
|
+
require 'thor'
|
6
|
+
require 'thor/base'
|
7
|
+
|
8
|
+
module Kwoon
|
9
|
+
class CLI < Thor
|
10
|
+
include Thor::Actions
|
11
|
+
|
12
|
+
def self.source_root; File.expand_path(File.dirname(__FILE__)); end
|
13
|
+
def self.exit_on_failure?; true; end
|
14
|
+
|
15
|
+
desc "create KATA_NAME", "Create a kata"
|
16
|
+
method_option :"ruby-version", :type => :string, :default => "1.9.2"
|
17
|
+
method_option :"kwoon-gem", :type => :string, :default => "kwoon"
|
18
|
+
def create(kata_name)
|
19
|
+
@kata_name = kata_name
|
20
|
+
@gemset = "kwoon_" + kata_name
|
21
|
+
@ruby_version = options[:"ruby-version"]
|
22
|
+
|
23
|
+
Bundler.with_clean_env do
|
24
|
+
puts "*** Creating kata directory"
|
25
|
+
FileUtils.mkdir(kata_name)
|
26
|
+
template "templates/autotest.tt", "#{kata_name}/.autotest"
|
27
|
+
template "templates/gitignore.tt", "#{kata_name}/.gitignore"
|
28
|
+
template "templates/rspec.tt", "#{kata_name}/.rspec"
|
29
|
+
template "templates/rvmrc.tt", "#{kata_name}/.rvmrc"
|
30
|
+
template "templates/Gemfile.tt", "#{kata_name}/Gemfile"
|
31
|
+
template "templates/autotest/discover.rb.tt", "#{kata_name}/autotest/discover.rb"
|
32
|
+
template "templates/autotest/kwoon_rspec2.rb.tt", "#{kata_name}/autotest/kwoon_rspec2.rb"
|
33
|
+
template "templates/lib/kata_name.rb.tt", "#{kata_name}/lib/#{kata_name}.rb"
|
34
|
+
template "templates/spec/kata_name_spec.rb.tt", "#{kata_name}/spec/#{kata_name}_spec.rb"
|
35
|
+
template "templates/spec/spec_helper.rb.tt", "#{kata_name}/spec/spec_helper.rb"
|
36
|
+
puts
|
37
|
+
|
38
|
+
puts "*** Creating kata gemset"
|
39
|
+
system "rvm #{@ruby_version} gemset create #{@gemset}"
|
40
|
+
puts
|
41
|
+
|
42
|
+
Dir.chdir(kata_name) do
|
43
|
+
puts "*** Installing & updating bundler"
|
44
|
+
system "rvm #{@ruby_version}@#{@gemset} exec gem install bundler"
|
45
|
+
system "rvm #{@ruby_version}@#{@gemset} exec gem update bundler"
|
46
|
+
puts
|
47
|
+
|
48
|
+
puts "*** Bundling kata gems"
|
49
|
+
system "rvm #{@ruby_version}@#{@gemset} exec bundle"
|
50
|
+
system "rvm #{@ruby_version}@#{@gemset} gem install #{options[:"kwoon-gem"]}"
|
51
|
+
puts
|
52
|
+
end
|
53
|
+
|
54
|
+
puts "*** Now run the following commands:"
|
55
|
+
puts " cd #{kata_name}"
|
56
|
+
puts " kwoon git REPO_NAME"
|
57
|
+
puts " kwoon start USERNAME_1 USERNAME_2 ... USERNAME_N"
|
58
|
+
puts " autotest"
|
59
|
+
puts
|
60
|
+
puts "e.g."
|
61
|
+
puts " kwoon git git@github.com:account_name/repo.git"
|
62
|
+
puts " kwoon start fred wilma"
|
63
|
+
puts
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "git GIT_REMOTE_REPO", 'Initialise Git and set the remote repo (e.g. "kwoon git user@git.host:repo.git")'
|
68
|
+
def git(remote_repo_name)
|
69
|
+
repo = Grit::Repo.init(".")
|
70
|
+
|
71
|
+
repo.config["push.default"] = "current"
|
72
|
+
repo.remote_add("origin", remote_repo_name)
|
73
|
+
|
74
|
+
repo.add(".")
|
75
|
+
repo.commit_index("Initialise Kata")
|
76
|
+
end
|
77
|
+
|
78
|
+
desc "start USERNAME_1 USERNAME_2 ... USERNAME_N", "Create a new branch based on the template in master"
|
79
|
+
def start(*usernames)
|
80
|
+
raise Thor::Error.new("You must supply at least one username") if usernames.empty?
|
81
|
+
repo = Grit::Repo.init(".")
|
82
|
+
new_branch_name = "#{usernames.join("-")}-#{Time.new.strftime("%Y%m%d%H%M")}"
|
83
|
+
repo.git.branch({}, new_branch_name, "master")
|
84
|
+
repo.git.checkout({}, new_branch_name)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'autotest/rspec2'
|
2
|
+
|
3
|
+
class Autotest::KwoonRspec2 < Autotest::Rspec2
|
4
|
+
# Fix a bug in RSpec 2.0.0.rc
|
5
|
+
# http://github.com/rspec/rspec-core/issues/issue/178
|
6
|
+
def consolidate_failures(failed)
|
7
|
+
filters = new_hash_of_arrays
|
8
|
+
failed.each do |spec, trace|
|
9
|
+
# if trace =~ /(.*spec\.rb)/
|
10
|
+
if trace =~ /(.*\.rb)/
|
11
|
+
filters[$1] << spec
|
12
|
+
end
|
13
|
+
end
|
14
|
+
return filters
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Git
|
19
|
+
def commit(message, options = { })
|
20
|
+
puts "*** Committing (#{message})"
|
21
|
+
system "git add ."
|
22
|
+
system "git commit -am '#{message}' #{"--allow-empty" if options[:allow_empty]}"
|
23
|
+
puts "*** Finished committing"
|
24
|
+
puts
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_master?
|
28
|
+
# On branch master
|
29
|
+
status_message = `git status`
|
30
|
+
status_message.include?("# On branch master")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
git = Git.new
|
35
|
+
|
36
|
+
if git.on_master?
|
37
|
+
puts 'Please run "kwoon start ..." before starting autotest'
|
38
|
+
exit(1)
|
39
|
+
end
|
40
|
+
|
41
|
+
Autotest.add_hook(:initialize) do
|
42
|
+
git.commit("Starting", :allow_empty => true)
|
43
|
+
end
|
44
|
+
|
45
|
+
Autotest.add_hook(:red) do
|
46
|
+
git.commit("Red", :allow_empty => true)
|
47
|
+
end
|
48
|
+
|
49
|
+
Autotest.add_hook(:green) do
|
50
|
+
git.commit("Green")
|
51
|
+
end
|
52
|
+
|
53
|
+
Autotest.add_hook(:all_good) do
|
54
|
+
git.commit("All good", :allow_empty => true)
|
55
|
+
end
|
56
|
+
|
57
|
+
Autotest.add_hook(:quit) do
|
58
|
+
git.commit("Stopping", :allow_empty => true)
|
59
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "autotest/fsevent" if RUBY_PLATFORM =~ /darwin/
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
@@ -0,0 +1 @@
|
|
1
|
+
rvm use <%= @ruby_version %>@<%= @gemset %>
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kwoon
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Ashley Moran
|
13
|
+
- Andy Shipman
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-08 00:00:00 +01:00
|
19
|
+
default_executable: kwoon
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: thor
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: grit
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
type: :runtime
|
46
|
+
version_requirements: *id002
|
47
|
+
description: A helper utility for running Coding Dojos
|
48
|
+
email:
|
49
|
+
- ashley.moran@patchspace.co.uk; andy@cllearview.com
|
50
|
+
executables:
|
51
|
+
- kwoon
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files: []
|
55
|
+
|
56
|
+
files:
|
57
|
+
- Gemfile
|
58
|
+
- kwoon.gemspec
|
59
|
+
- README.markdown
|
60
|
+
- lib/kwoon/cli.rb
|
61
|
+
- lib/kwoon/templates/autotest/discover.rb.tt
|
62
|
+
- lib/kwoon/templates/autotest/kwoon_rspec2.rb.tt
|
63
|
+
- lib/kwoon/templates/autotest.tt
|
64
|
+
- lib/kwoon/templates/Gemfile.tt
|
65
|
+
- lib/kwoon/templates/gitignore.tt
|
66
|
+
- lib/kwoon/templates/lib/kata_name.rb.tt
|
67
|
+
- lib/kwoon/templates/rspec.tt
|
68
|
+
- lib/kwoon/templates/rvmrc.tt
|
69
|
+
- lib/kwoon/templates/spec/kata_name_spec.rb.tt
|
70
|
+
- lib/kwoon/templates/spec/spec_helper.rb.tt
|
71
|
+
- lib/kwoon/version.rb
|
72
|
+
- features/descriptions/create.feature
|
73
|
+
- features/descriptions/git.feature
|
74
|
+
- features/descriptions/start.feature
|
75
|
+
- features/step_definitions/command_steps.rb
|
76
|
+
- features/step_definitions/git_steps.rb
|
77
|
+
- features/step_definitions/rvm_steps.rb
|
78
|
+
- features/support/env.rb
|
79
|
+
- bin/kwoon
|
80
|
+
has_rdoc: true
|
81
|
+
homepage: http://patch-tag.com/r/ashleymoran/kwoon/snapshot/current/content/pretty/README.markdown
|
82
|
+
licenses: []
|
83
|
+
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
requirements: []
|
106
|
+
|
107
|
+
rubyforge_project: kwoon
|
108
|
+
rubygems_version: 1.3.7
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: kwoon-0.0.1
|
112
|
+
test_files:
|
113
|
+
- features/descriptions/create.feature
|
114
|
+
- features/descriptions/git.feature
|
115
|
+
- features/descriptions/start.feature
|
116
|
+
- features/step_definitions/command_steps.rb
|
117
|
+
- features/step_definitions/git_steps.rb
|
118
|
+
- features/step_definitions/rvm_steps.rb
|
119
|
+
- features/support/env.rb
|