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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae60887db13bf9f0c83b58acc3656228547ebf72
4
- data.tar.gz: fa78dae0919fb477e6cff32a202072bed6670991
3
+ metadata.gz: 4ea5b9c6ef30ce4f8af2afc308bb20245a5a7a95
4
+ data.tar.gz: 62490e7ab02f54f111c01382e8b09b05781cd988
5
5
  SHA512:
6
- metadata.gz: 27d0e55f28ab48d85ed940ca9e331ac08817872613b80159b293a7828d5b845839bfc4db3b1d59b4df61a6615bf92d998cdf874dc02a243685a586c6161e06d9
7
- data.tar.gz: 826c0388c7691dcc68079e62b72963cd1211e48e003163810abc6f13170f08e90d54402015ce44f38a77ccfe05e34eaf3259d34d0d7db43cd166640450611420
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.8.8)
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.0)
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.0)
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://secure.travis-ci.org/ameuret/newkata.png)](http://travis-ci.org/ameuret/newkata)
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
  ------------
@@ -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
 
@@ -1,3 +1,5 @@
1
+ # Since we're using the glorious aruba gem this has become unable to
2
+ # pass the kataname to aruba steps, oh well...
1
3
  Given /^I wish to create a kata for (.+)$/ do |kataName|
2
4
  @kataName = kataName
3
5
  end
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
@@ -1,3 +1,3 @@
1
1
  module Newkata
2
- VERSION = "0.8.8"
2
+ VERSION = "0.9.0"
3
3
  end
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.name"]
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
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'guard'
4
4
  gem 'rb-inotify'
@@ -0,0 +1,11 @@
1
+ # Statements produced by newkata
2
+ group :dev do
3
+ gem 'rake'
4
+ gem 'bundler', '~> 1.5'
5
+ gem 'guard'
6
+ gem 'rb-inotify'
7
+ gem 'rspec'
8
+ gem 'guard-rspec'
9
+ gem 'libnotify'
10
+ end
11
+
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.8.8
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: 2013-03-05 00:00:00.000000000 Z
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.name
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.0.0
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.