newkata 0.8.8 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +2 -1
- data/features/creation.feature +10 -1
- data/features/step_definitions/creation_steps.rb +2 -0
- data/lib/newkata.rb +41 -5
- data/lib/newkata/version.rb +1 -1
- data/newkata.gemspec +2 -2
- data/templates/Gemfile +1 -1
- data/templates/Gemfile_append +11 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ea5b9c6ef30ce4f8af2afc308bb20245a5a7a95
|
4
|
+
data.tar.gz: 62490e7ab02f54f111c01382e8b09b05781cd988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dee0c189f8f12d0569dca3c75b4fed1ac21da70a3b925bf12ad9a3ea255c9a761bcd2d692c836d16be4483007b6a516e40dac6da5764b0e807e5f295ccb285de
|
7
|
+
data.tar.gz: c905eaa06c94dc5ba7f3226638f397cca3a136fc77f47eb7fd4b973df28addb4977395f3acdd8fc5272f8cf06118de1c7dab9f9fee449087741078ae032b6274
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
newkata (0.
|
4
|
+
newkata (0.9.0)
|
5
5
|
guard
|
6
6
|
guard-rspec
|
7
7
|
libnotify
|
@@ -42,7 +42,7 @@ GEM
|
|
42
42
|
guard (>= 1.1)
|
43
43
|
rspec (~> 2.11)
|
44
44
|
json (1.7.7)
|
45
|
-
libnotify (0.8.
|
45
|
+
libnotify (0.8.2)
|
46
46
|
ffi (>= 1.0.11)
|
47
47
|
listen (0.7.3)
|
48
48
|
lumberjack (1.0.2)
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
method_source (~> 0.8)
|
54
54
|
slop (~> 3.4)
|
55
55
|
rake (10.0.3)
|
56
|
-
rb-inotify (0.9.
|
56
|
+
rb-inotify (0.9.3)
|
57
57
|
ffi (>= 0.5.0)
|
58
58
|
rspec (2.13.0)
|
59
59
|
rspec-core (~> 2.13.0)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
New Kata
|
2
2
|
========
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://travis-ci.org/ameuret/newkata.png?branch=master)](https://travis-ci.org/ameuret/newkata)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/ameuret/newkata.png)](https://codeclimate.com/github/ameuret/newkata)
|
5
5
|
|
6
6
|
A simple project generator, handy to tryout a new class with a corresponding (r)spec.
|
@@ -12,6 +12,7 @@ Features
|
|
12
12
|
- Trivial to customize thanks to Thor
|
13
13
|
- So simple it can serve as a playground for beginners to Thor, Cucumber and Aruba
|
14
14
|
- Gets you coding faster than you can say pinan nidan
|
15
|
+
- **NEW:** Optionnally creates a gem structure when launched with `--gem` (thanks to `bundle gem`)
|
15
16
|
|
16
17
|
Installation
|
17
18
|
------------
|
data/features/creation.feature
CHANGED
@@ -16,6 +16,15 @@ Feature: Project creation
|
|
16
16
|
When I run `newkata stringcalculator`
|
17
17
|
Then the output should contain "The name argument must be usable as a Ruby class name"
|
18
18
|
|
19
|
-
|
19
|
+
|
20
|
+
Scenario: Creating a gem kata
|
21
|
+
When I run `newkata StringCalculator --gem`
|
22
|
+
Then the following files should exist:
|
23
|
+
| stringcalculator/Rakefile |
|
24
|
+
| stringcalculator/stringcalculator.gemspec |
|
25
|
+
And the file "stringcalculator/stringcalculator.gemspec" should contain "stringcalculator"
|
26
|
+
And the file "stringcalculator/Gemfile" should contain "# Statements produced by 'bundle gem'"
|
27
|
+
And the file "stringcalculator/Gemfile" should contain "# Statements produced by newkata"
|
28
|
+
|
20
29
|
# LocalWords: StringCalculator stringcalculator newkata
|
21
30
|
|
data/lib/newkata.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require "thor/group"
|
2
|
+
require "bundler"
|
2
3
|
|
3
4
|
module NewKata
|
4
5
|
|
5
6
|
class App < Thor::Group
|
6
7
|
include Thor::Actions
|
7
8
|
|
9
|
+
class_option :gem, :type => :boolean
|
8
10
|
argument :name, type: :string, desc: "The name of the class on which this kata is focused"
|
9
11
|
desc "Creates a project directory fully equipped to support BDD with RSpec"
|
10
12
|
def self.banner
|
@@ -24,17 +26,51 @@ module NewKata
|
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
def create_class_file
|
28
|
-
template('../templates/lib/skel.rb.tt', "#{name.downcase}/lib/#{name.downcase}.rb")
|
29
|
-
end
|
30
|
-
|
31
29
|
def create_spec_file
|
32
30
|
template('../templates/spec/skel_spec.rb.tt', "#{name.downcase}/spec/#{name.downcase}_spec.rb")
|
33
31
|
end
|
34
32
|
|
33
|
+
def add_gem_support
|
34
|
+
return unless options[:gem]
|
35
|
+
Bundler.with_clean_env do
|
36
|
+
system "bundle gem #{name.downcase}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_class_file
|
41
|
+
return if options[:gem]
|
42
|
+
template('../templates/lib/skel.rb.tt', "#{name.downcase}/lib/#{name.downcase}.rb")
|
43
|
+
end
|
44
|
+
|
35
45
|
def copy_config_files
|
36
|
-
copy_file "../templates/Gemfile", "#{name.downcase}/Gemfile"
|
37
46
|
copy_file "../templates/Guardfile", "#{name.downcase}/Guardfile"
|
47
|
+
if !options[:gem]
|
48
|
+
copy_file "../templates/Gemfile", "#{name.downcase}/Gemfile"
|
49
|
+
else
|
50
|
+
prepend_to_file("#{name.downcase}/Gemfile","# Statements produced by 'bundle gem'")
|
51
|
+
append_to_file "#{name.downcase}/Gemfile" do
|
52
|
+
File.read(find_in_source_paths("../templates/Gemfile_append"))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def patch_gemspec
|
58
|
+
return unless options[:gem]
|
59
|
+
gsub_file("#{name.downcase}/#{name.downcase}.gemspec",
|
60
|
+
/spec.add_development_dependency/,
|
61
|
+
'#spec.add_development_dependency')
|
62
|
+
inject_into_file("#{name.downcase}/#{name.downcase}.gemspec",
|
63
|
+
" # Dev dependency are best managed in the Gemfile\n",
|
64
|
+
before: " #spec.add_development_dependency")
|
65
|
+
end
|
66
|
+
|
67
|
+
def epilogue
|
68
|
+
say "Ready, focused, code !", Thor::Shell::Color::GREEN
|
69
|
+
say " cd #{name.downcase}", Thor::Shell::Color::GREEN
|
70
|
+
say " bundle", Thor::Shell::Color::GREEN
|
71
|
+
say " guard # (if you like it)", Thor::Shell::Color::GREEN
|
72
|
+
return unless options[:gem]
|
73
|
+
say " (don't worry about the yellow, Bundler is just warning you about the missing gem descriptions)", Thor::Shell::Color::GREEN
|
38
74
|
end
|
39
75
|
|
40
76
|
end
|
data/lib/newkata/version.rb
CHANGED
data/newkata.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Newkata::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Arnaud Meuret"]
|
10
|
-
s.email = ["arnaud@meuret.
|
10
|
+
s.email = ["arnaud@meuret.net"]
|
11
11
|
s.homepage = "https://github.com/ameuret/newkata"
|
12
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.}
|
13
|
+
s.description = %q{A simple project generator, handy to tryout a new class with a corresponding (r)spec. **NOW** producing a gem structure}
|
14
14
|
|
15
15
|
s.rubyforge_project = "newkata"
|
16
16
|
|
data/templates/Gemfile
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newkata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Meuret
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -95,9 +95,9 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: A simple project generator, handy to tryout a new class with a corresponding
|
98
|
-
(r)spec.
|
98
|
+
(r)spec. **NOW** producing a gem structure
|
99
99
|
email:
|
100
|
-
- arnaud@meuret.
|
100
|
+
- arnaud@meuret.net
|
101
101
|
executables:
|
102
102
|
- newkata
|
103
103
|
extensions: []
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/newkata/version.rb
|
121
121
|
- newkata.gemspec
|
122
122
|
- templates/Gemfile
|
123
|
+
- templates/Gemfile_append
|
123
124
|
- templates/Guardfile
|
124
125
|
- templates/lib/skel.rb.tt
|
125
126
|
- templates/spec/skel_spec.rb.tt
|
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
143
|
version: '0'
|
143
144
|
requirements: []
|
144
145
|
rubyforge_project: newkata
|
145
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.1.11
|
146
147
|
signing_key:
|
147
148
|
specification_version: 4
|
148
149
|
summary: Generate a simple Ruby project hierarchy perfect for code katas.
|