newkata 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +65 -0
- data/Guardfile +6 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/bin/newkata +12 -0
- data/features/creation.feature +21 -0
- data/features/rspec.feature +16 -0
- data/features/step_definitions/creation_steps.rb +4 -0
- data/features/step_definitions/rspec_steps.rb +3 -0
- data/features/support/env.rb +2 -0
- data/lib/newkata/version.rb +3 -0
- data/lib/newkata.rb +38 -0
- data/newkata.gemspec +30 -0
- data/templates/Gemfile +9 -0
- data/templates/Guardfile +20 -0
- data/templates/lib/skel.rb.tt +3 -0
- data/templates/spec/skel_spec.rb.tt +10 -0
- metadata +121 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git@github.com:ameuret/aruba.git
|
3
|
+
revision: 68ec4bb35f10085f2dfaf4e4811903444c450162
|
4
|
+
specs:
|
5
|
+
aruba (0.4.0)
|
6
|
+
bcat (>= 0.6.1)
|
7
|
+
childprocess (>= 0.1.9)
|
8
|
+
cucumber (>= 0.10.5)
|
9
|
+
rdiscount (>= 1.6.8)
|
10
|
+
rspec (>= 2.6.0)
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: http://rubygems.org/
|
14
|
+
specs:
|
15
|
+
bcat (0.6.1)
|
16
|
+
rack (~> 1.0)
|
17
|
+
builder (3.0.0)
|
18
|
+
childprocess (0.1.9)
|
19
|
+
ffi (~> 1.0.6)
|
20
|
+
cucumber (0.10.6)
|
21
|
+
builder (>= 2.1.2)
|
22
|
+
diff-lcs (>= 1.1.2)
|
23
|
+
gherkin (~> 2.4.0)
|
24
|
+
json (>= 1.4.6)
|
25
|
+
term-ansicolor (>= 1.0.5)
|
26
|
+
diff-lcs (1.1.2)
|
27
|
+
ffi (1.0.9)
|
28
|
+
gherkin (2.4.0)
|
29
|
+
json (>= 1.4.6)
|
30
|
+
guard (0.4.2)
|
31
|
+
thor (~> 0.14.6)
|
32
|
+
guard-cucumber (0.5.0)
|
33
|
+
cucumber (>= 0.10)
|
34
|
+
guard (>= 0.4.0)
|
35
|
+
guard-rspec (0.4.0)
|
36
|
+
guard (>= 0.4.0)
|
37
|
+
json (1.5.1)
|
38
|
+
libnotify (0.5.5)
|
39
|
+
rack (1.3.0)
|
40
|
+
rb-inotify (0.8.5)
|
41
|
+
ffi (>= 0.5.0)
|
42
|
+
rdiscount (1.6.8)
|
43
|
+
rspec (2.6.0)
|
44
|
+
rspec-core (~> 2.6.0)
|
45
|
+
rspec-expectations (~> 2.6.0)
|
46
|
+
rspec-mocks (~> 2.6.0)
|
47
|
+
rspec-core (2.6.4)
|
48
|
+
rspec-expectations (2.6.0)
|
49
|
+
diff-lcs (~> 1.1.2)
|
50
|
+
rspec-mocks (2.6.0)
|
51
|
+
term-ansicolor (1.0.5)
|
52
|
+
thor (0.14.6)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
aruba!
|
59
|
+
cucumber
|
60
|
+
guard
|
61
|
+
guard-cucumber
|
62
|
+
guard-rspec
|
63
|
+
libnotify
|
64
|
+
rb-inotify
|
65
|
+
rspec
|
data/Guardfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
New Kata
|
2
|
+
========
|
3
|
+
|
4
|
+
A simple project generator, handy to tryout a new class with a corresponding (r)spec.
|
5
|
+
|
6
|
+
Features
|
7
|
+
--------
|
8
|
+
|
9
|
+
- Generates a project structure that uses Bundler and Guard
|
10
|
+
- Trivial to customize thanks to Thor
|
11
|
+
- So simple it can serve as a playground for beginners to Thor, Cucumber and Aruba
|
12
|
+
- Gets you coding faster than you can say pinan nidan
|
13
|
+
|
14
|
+
Installation
|
15
|
+
------------
|
16
|
+
|
17
|
+
gem install newkata
|
18
|
+
|
19
|
+
Usage
|
20
|
+
-----
|
21
|
+
|
22
|
+
newkata StringCalculator
|
23
|
+
cd stringcalculator
|
24
|
+
bundle
|
25
|
+
bundle exec guard
|
26
|
+
|
27
|
+
|
28
|
+
EMACS users
|
29
|
+
-----------
|
30
|
+
|
31
|
+
RVM (through http://www.emacswiki.org/emacs/RvmEl), Bundler and RSpec play nicely with EMACS.
|
32
|
+
Launch guard under bundler using the current rvm with:
|
33
|
+
|
34
|
+
M-x rvm-use-default
|
35
|
+
M-x eshell
|
36
|
+
bundle exec guard
|
37
|
+
|
data/Rakefile
ADDED
data/bin/newkata
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Project creation
|
2
|
+
In order to quickly start flexing my brain muscles
|
3
|
+
as a Ruby developer, I need to create an empty
|
4
|
+
kata project with one command
|
5
|
+
|
6
|
+
Scenario: Create a kata project
|
7
|
+
Given I wish to create a kata for StringCalculator
|
8
|
+
When I run `newkata StringCalculator`
|
9
|
+
Then the following files should exist:
|
10
|
+
| stringcalculator/Gemfile |
|
11
|
+
| stringcalculator/Guardfile |
|
12
|
+
And the file "stringcalculator/lib/stringcalculator.rb" should contain "class StringCalculator"
|
13
|
+
And the file "stringcalculator/spec/stringcalculator_spec.rb" should contain "describe StringCalculator"
|
14
|
+
|
15
|
+
Scenario: Specify a lower-cased name
|
16
|
+
When I run `newkata stringcalculator`
|
17
|
+
Then the output should contain "The name argument must be usable as a Ruby class name"
|
18
|
+
|
19
|
+
|
20
|
+
# LocalWords: StringCalculator stringcalculator newkata
|
21
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Set up an RSpec environment running under Guard
|
2
|
+
In order to start coding in serenity
|
3
|
+
as a BDD Ruby developer, I need an RSpec set up
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I run `newkata StringCalculator`
|
7
|
+
|
8
|
+
Scenario: Coding under Guard
|
9
|
+
When I cd to "stringcalculator"
|
10
|
+
And I run `bundle exec guard` interactively
|
11
|
+
And I sleep for 5 seconds
|
12
|
+
And I stop the running process
|
13
|
+
Then the output should contain "1 example, 0 failures, 1 pending"
|
14
|
+
|
15
|
+
# LocalWords: StringCalculator stringcalculator newkata
|
16
|
+
|
data/lib/newkata.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "thor/group"
|
2
|
+
|
3
|
+
module NewKata
|
4
|
+
|
5
|
+
class App < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
argument :name
|
9
|
+
|
10
|
+
def self.source_root
|
11
|
+
File.dirname(__FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
def check_name
|
15
|
+
begin
|
16
|
+
instance_eval("class #{name};end")
|
17
|
+
rescue SyntaxError
|
18
|
+
puts "The name argument must be usable as a Ruby class name."
|
19
|
+
raise ArgumentError
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_class_file
|
24
|
+
template('../templates/lib/skel.rb.tt', "#{name.downcase}/lib/#{name.downcase}.rb")
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_spec_file
|
28
|
+
template('../templates/spec/skel_spec.rb.tt', "#{name.downcase}/spec/#{name.downcase}_spec.rb")
|
29
|
+
end
|
30
|
+
|
31
|
+
def copy_config_files
|
32
|
+
copy_file "../templates/Gemfile", "#{name.downcase}/Gemfile"
|
33
|
+
copy_file "../templates/Guardfile", "#{name.downcase}/Guardfile"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/newkata.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("lib", File.dirname(__FILE__))
|
3
|
+
require "newkata/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "newkata"
|
7
|
+
s.version = Newkata::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Arnaud Meuret"]
|
10
|
+
s.email = ["arnaud@meuret.name"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Generate a simple Ruby project hierarchy perfect for code katas.}
|
13
|
+
s.description = %q{A simple project generator, handy to tryout a new class with a corresponding (r)spec.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "newkata"
|
16
|
+
|
17
|
+
s.add_dependency "guard"
|
18
|
+
s.add_dependency "rb-inotify"
|
19
|
+
s.add_dependency "rspec"
|
20
|
+
s.add_dependency "guard-rspec"
|
21
|
+
s.add_dependency "libnotify"
|
22
|
+
|
23
|
+
# dev gems are better managed directly by the Gemfile
|
24
|
+
# s.add_development_dependency ""
|
25
|
+
|
26
|
+
s.files = `git ls-files`.split("\n")
|
27
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
28
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
end
|
data/templates/Gemfile
ADDED
data/templates/Guardfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^spec/.+_spec\.rb$})
|
11
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
12
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
13
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
14
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
15
|
+
watch('spec/spec_helper.rb') { "spec" }
|
16
|
+
watch('config/routes.rb') { "spec/routing" }
|
17
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
18
|
+
# Capybara request specs
|
19
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newkata
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Arnaud Meuret
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-06-15 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: &79492730 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *79492730
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rb-inotify
|
27
|
+
requirement: &79535560 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *79535560
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &79535350 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *79535350
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: guard-rspec
|
49
|
+
requirement: &79535140 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *79535140
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: libnotify
|
60
|
+
requirement: &79534930 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *79534930
|
69
|
+
description: A simple project generator, handy to tryout a new class with a corresponding
|
70
|
+
(r)spec.
|
71
|
+
email:
|
72
|
+
- arnaud@meuret.name
|
73
|
+
executables:
|
74
|
+
- newkata
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- Guardfile
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/newkata
|
85
|
+
- features/creation.feature
|
86
|
+
- features/rspec.feature
|
87
|
+
- features/step_definitions/creation_steps.rb
|
88
|
+
- features/step_definitions/rspec_steps.rb
|
89
|
+
- features/support/env.rb
|
90
|
+
- lib/newkata.rb
|
91
|
+
- lib/newkata/version.rb
|
92
|
+
- newkata.gemspec
|
93
|
+
- templates/Gemfile
|
94
|
+
- templates/Guardfile
|
95
|
+
- templates/lib/skel.rb.tt
|
96
|
+
- templates/spec/skel_spec.rb.tt
|
97
|
+
homepage: ''
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project: newkata
|
117
|
+
rubygems_version: 1.8.5
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Generate a simple Ruby project hierarchy perfect for code katas.
|
121
|
+
test_files: []
|