kata 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +55 -183
- data/bin/kata +6 -3
- data/lib/kata/setup/ruby.rb +2 -2
- data/lib/kata/version.rb +1 -1
- metadata +6 -9
data/README.md
CHANGED
@@ -1,211 +1,83 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
A kata is defined as an exercise in programming which helps hone your skills
|
4
|
-
through practice and repetition. Authoring katas is done in blogs but you can't
|
5
|
-
really test yourself. This gem provides a DSL to author the kata and administer
|
6
|
-
it as a test providing feedback for evaluation. It also provides basic github
|
7
|
-
repo setup so that you can chart solution progress over time.
|
8
|
-
|
9
|
-
## Authoring a Kata
|
1
|
+
## Kata
|
10
2
|
|
11
|
-
|
3
|
+
A kata is defined as an exercise in programming which helps hone your skills through practice and
|
4
|
+
repetition. Authoring katas is done in blogs but you can't really test yourself. This gem provides a
|
5
|
+
DSL to author the kata and administer it as a test providing feedback for evaluation. It also
|
6
|
+
provides basic github repo setup so that you can chart solution progress over time.
|
12
7
|
|
13
|
-
|
14
|
-
much like an RSpec test as illustrated below:
|
8
|
+
The inspiration for this gem came from my friend [Nick Hengeveld](https://github.com/nhengeveld)
|
15
9
|
|
16
|
-
|
17
|
-
requirement "Create an add method that will accept two digits as arguments" do
|
18
|
-
example "invoking with 1 and 2 returns 3"
|
19
|
-
example "invoking with 5 only returns 5"
|
20
|
-
example "invoking with no arguments returns 0"
|
21
|
-
end
|
22
|
-
requirement "Modify the add method to access multple digits as arguments" do
|
23
|
-
example "invoking with 1 and 2 and 3 returns 6"
|
24
|
-
example "invoking with 1 and 2 and 3 and 4 and 5 returns 15"
|
25
|
-
end
|
26
|
-
context "sub" do
|
27
|
-
requirement "Create a sub method that will accept two digits as arguments" do
|
28
|
-
detail "Negative numbers are not allowed"
|
29
|
-
detail "Digits must range from 0-9"
|
30
|
-
example "9-6 = 3"
|
31
|
-
end
|
32
|
-
requirement "Modify the sub method to access multple digits as arguments" do
|
33
|
-
example "9-6-3 = 0"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
10
|
+
### Installation
|
37
11
|
|
38
|
-
|
39
|
-
illustrated below:
|
12
|
+
It is up on rubygems.org so add it to your project bundle:
|
40
13
|
|
41
|
-
|
42
|
-
2. context
|
43
|
-
3. requirement
|
44
|
-
4. detail
|
45
|
-
5. example
|
14
|
+
gem kata
|
46
15
|
|
47
|
-
|
48
|
-
It takes 2 arguments:
|
16
|
+
or do it the old fashioned way and install the gem manually:
|
49
17
|
|
50
|
-
|
51
|
-
being used in creating the parent directory of the github repo during setup.
|
52
|
-
* *&block* - A ruby block that includes calls to *context()* or *requirement()*
|
53
|
-
|
54
|
-
1. The **context()** method allows for grouping of requirements with 2 arguments:
|
55
|
-
|
56
|
-
* *string* - A description of the provided context
|
57
|
-
* *&block* - A ruby block consisting of a call to *requirement()*
|
58
|
-
|
59
|
-
this method call is optional and not required to define a kata.
|
60
|
-
|
61
|
-
1. The **requirement()** method is the heart of a kata as it is used to provide the
|
62
|
-
business rules that the code should provide solutions to. It follows the same
|
63
|
-
pattern of the other methods with 2 arguments:
|
64
|
-
|
65
|
-
* *string* - A description of the requirement that the code implementing the
|
66
|
-
kata should meet
|
67
|
-
* *&block* - A ruby block consisting of calls to *detail()* or *example()*
|
68
|
-
|
69
|
-
1. The **detail()** method takes a single argument allowing for further defintion
|
70
|
-
of a requirement. This method can be called repeatedly in a block.
|
71
|
-
|
72
|
-
* *string* - A description of the detail of requirement
|
73
|
-
|
74
|
-
1. The **example()** method takes a single argument allowing for illustration of
|
75
|
-
examples of the requirement in practice
|
76
|
-
|
77
|
-
* *string* - An example that will help illustrate the requirement in practice
|
78
|
-
|
79
|
-
## Setting up a Kata
|
80
|
-
|
81
|
-
To setup a minimal github repo you must first already have a github account and
|
82
|
-
git installed on your machine. To build a kata repo simply use the setup
|
83
|
-
command:
|
84
|
-
|
85
|
-
wesbailey@feynman:~/scratch-1.9.0> kata setup sample.rb
|
86
|
-
Creating github repo...complete
|
87
|
-
creating files for repo and initializing...done
|
88
|
-
You can now change directories to my_first-2011-03-17-225948 and take your kata
|
89
|
-
|
90
|
-
Looking in that directory you can see what files have been created:
|
91
|
-
|
92
|
-
.rspec
|
93
|
-
README
|
94
|
-
lib
|
95
|
-
lib/my_first.rb
|
96
|
-
spec
|
97
|
-
spec/my_first_spec.rb
|
98
|
-
spec/spec_helper.rb
|
99
|
-
spec/support
|
100
|
-
spec/support/helpers
|
101
|
-
spec/support/matchers
|
102
|
-
spec/support/matchers/my_first.rb
|
103
|
-
|
104
|
-
For the files that are generated you will see the following default contents:
|
105
|
-
|
106
|
-
*.rspec*
|
107
|
-
|
108
|
-
--color --format d
|
109
|
-
|
110
|
-
*README*
|
111
|
-
|
112
|
-
Leveling up my ruby awesomeness!
|
113
|
-
|
114
|
-
*lib/my_first.rb*
|
115
|
-
|
116
|
-
class MyFirst
|
117
|
-
end
|
118
|
-
|
119
|
-
*spec/my_first_spec.rb*
|
120
|
-
|
121
|
-
require 'spec_helper'
|
122
|
-
require 'my_first'
|
123
|
-
|
124
|
-
describe MyFirst do
|
125
|
-
describe "new" do
|
126
|
-
it "should instantiate" do
|
127
|
-
lambda {
|
128
|
-
MyFirst.new
|
129
|
-
}.should_not raise_exception
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
*spec/spec_helper.rb*
|
135
|
-
|
136
|
-
$: << '.' << File.join(File.dirname(__FILE__), '..', 'lib')
|
137
|
-
|
138
|
-
require 'rspec'
|
139
|
-
|
140
|
-
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
141
|
-
|
142
|
-
*spec/support/matchers/my_first.rb*
|
18
|
+
gem install kata
|
143
19
|
|
144
|
-
|
145
|
-
match do |your_match|
|
146
|
-
#your_match.method_on_object_to_execute == expected
|
147
|
-
end
|
148
|
-
end
|
20
|
+
### Usage
|
149
21
|
|
150
|
-
|
22
|
+
NAME
|
23
|
+
kata - Ruby kata management
|
151
24
|
|
152
|
-
|
25
|
+
SYNOPSIS
|
26
|
+
kata [COMMAND] [ARGS]
|
153
27
|
|
154
|
-
|
155
|
-
|
156
|
-
|
28
|
+
DESCRIPTION
|
29
|
+
The kata gem allows one to manage their personal development in the
|
30
|
+
practice of writing code through repitition.
|
157
31
|
|
158
|
-
|
159
|
-
|
32
|
+
PRIMARY COMMANDS
|
33
|
+
kata setup [--no-repo] [--language=option] file
|
34
|
+
Setup a github repo for the kata development session.
|
160
35
|
|
161
|
-
|
162
|
-
|
163
|
-
|
36
|
+
--no-repo - Add the directory tree and files to the current repo if possible
|
37
|
+
--language=option - Define the programming language for the directory tree that is built
|
38
|
+
file - Path to the code kata source file for the practice session
|
164
39
|
|
165
|
-
|
40
|
+
kata take file
|
41
|
+
Start a kata development session
|
166
42
|
|
167
|
-
|
168
|
-
|
169
|
-
Create an add method that will accept two digits as arguments
|
170
|
-
- detail: invoking with 1 and 2 returns 3
|
171
|
-
- detail: invoking with 1 returns 1
|
172
|
-
- detail: invoking with no arguments returns 0
|
173
|
-
- example: "1,2" sums to 3
|
43
|
+
kata version
|
44
|
+
Current installed version number
|
174
45
|
|
175
|
-
|
46
|
+
kata help
|
47
|
+
This usage message
|
176
48
|
|
177
|
-
|
178
|
-
requirement is completed. Once it is then enter and the next requirement will
|
179
|
-
appear as illustrated below:
|
49
|
+
### [Wiki](https://github.com/wbailey/kata/wiki)
|
180
50
|
|
181
|
-
|
182
|
-
- example: "1,2,3" sums to 6
|
183
|
-
- example: "1,2,3,4,5" sums to 15
|
51
|
+
The [Wiki](https://github.com/wbailey/kata/wiki) has all of the documentation necessary for getting you started.
|
184
52
|
|
185
|
-
|
53
|
+
### DSL Reference
|
186
54
|
|
187
|
-
|
188
|
-
|
55
|
+
* kata(string, &block)
|
56
|
+
* context(string, &block)
|
57
|
+
* requirement(string, &block)
|
58
|
+
* detail(string)
|
59
|
+
* example(string)
|
189
60
|
|
190
|
-
|
61
|
+
### Contributors
|
191
62
|
|
192
|
-
|
193
|
-
displayed:
|
63
|
+
Wes Bailey ([Exposing Gotchas](http://exposinggotchas.blogspot.com/ "Exposing Gotchas"))
|
194
64
|
|
195
|
-
|
196
|
-
- Create an add method that will accept two digits as arguments 00:02:02
|
197
|
-
- Modify the add method to access multple digits as arguments 00:00:45
|
198
|
-
---------------------------------------------------------------------- --------
|
199
|
-
Total Time taking Calculator kata: 00:02:47
|
200
|
-
|
65
|
+
### License
|
201
66
|
|
202
|
-
|
67
|
+
Copyright (c) 2011-2012 Wes Bailey
|
203
68
|
|
204
|
-
|
205
|
-
|
69
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
70
|
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
71
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
72
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
73
|
+
furnished to do so, subject to the following conditions:
|
206
74
|
|
207
|
-
|
75
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
76
|
+
portions of the Software.
|
208
77
|
|
209
|
-
|
78
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
79
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
80
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
81
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
82
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
210
83
|
|
211
|
-
Wes Bailey ([Exposing Gotchas](http://exposinggotchas.blogspot.com/ "Exposing Gotchas"))
|
data/bin/kata
CHANGED
@@ -16,9 +16,12 @@ DESCRIPTION
|
|
16
16
|
practice of writing code through repitition.
|
17
17
|
|
18
18
|
PRIMARY COMMANDS
|
19
|
-
kata setup
|
20
|
-
Setup a github repo for the kata development session.
|
21
|
-
|
19
|
+
kata setup [--no-repo] [--language=option] file
|
20
|
+
Setup a github repo for the kata development session.
|
21
|
+
|
22
|
+
--no-repo - Add the directory tree and files to the current repo if possible
|
23
|
+
--language=option - Define the programming language for the directory tree that is built
|
24
|
+
file - Path to the code kata source file for the practice session
|
22
25
|
|
23
26
|
kata take file
|
24
27
|
Start a kata development session
|
data/lib/kata/setup/ruby.rb
CHANGED
data/lib/kata/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
17
|
-
requirement: &
|
17
|
+
requirement: &2151828020 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.0.0
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2151828020
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: command_line_reporter
|
28
|
-
requirement: &
|
28
|
+
requirement: &2151826140 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 3.2.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2151826140
|
37
37
|
description: This DSL provides an easy way for you to write a code kata for pairing
|
38
38
|
exercises or individual testing
|
39
39
|
email: baywes@gmail.com
|
@@ -68,9 +68,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
|
-
segments:
|
72
|
-
- 0
|
73
|
-
hash: -448375996502687545
|
74
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
73
|
requirements:
|