Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getting ready for github integration
- Loading branch information
Showing
13 changed files
with
183 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,6 @@ | |||
require 'bundler' | require 'bundler' | ||
Bundler::GemHelper.install_tasks | Bundler::GemHelper.install_tasks | ||
|
|||
task :push do | |||
system "gem push pkg/kata-0.2.0.gem" | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env ruby | |||
# | |||
# This file was generated by Bundler. | |||
# | |||
# The application 'edit_json.rb' is installed as part of a gem, and | |||
# this file is here to facilitate running it. | |||
# | |||
|
|||
require 'pathname' | |||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | |||
Pathname.new(__FILE__).realpath) | |||
|
|||
require 'rubygems' | |||
require 'bundler/setup' | |||
|
|||
load Gem.bin_path('json', 'edit_json.rb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env ruby | |||
# | |||
# This file was generated by Bundler. | |||
# | |||
# The application 'gh' is installed as part of a gem, and | |||
# this file is here to facilitate running it. | |||
# | |||
|
|||
require 'pathname' | |||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | |||
Pathname.new(__FILE__).realpath) | |||
|
|||
require 'rubygems' | |||
require 'bundler/setup' | |||
|
|||
load Gem.bin_path('github', 'gh') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env ruby | |||
# | |||
# This file was generated by Bundler. | |||
# | |||
# The application 'github' is installed as part of a gem, and | |||
# this file is here to facilitate running it. | |||
# | |||
|
|||
require 'pathname' | |||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | |||
Pathname.new(__FILE__).realpath) | |||
|
|||
require 'rubygems' | |||
require 'bundler/setup' | |||
|
|||
load Gem.bin_path('github', 'github') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env ruby | |||
# | |||
# This file was generated by Bundler. | |||
# | |||
# The application 'prettify_json.rb' is installed as part of a gem, and | |||
# this file is here to facilitate running it. | |||
# | |||
|
|||
require 'pathname' | |||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", | |||
Pathname.new(__FILE__).realpath) | |||
|
|||
require 'rubygems' | |||
require 'bundler/setup' | |||
|
|||
load Gem.bin_path('json', 'prettify_json.rb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,66 +1,3 @@ | |||
module Kata | require 'kata/base' | ||
@@times = [] | |||
|
|
||
def kata txt, lib = nil | include Kata::Base | ||
puts txt | |||
yield if block_given? | |||
complete | |||
end | |||
|
|||
def requirement txt | |||
puts indent + txt | |||
|
|||
start = Time.now | |||
|
|||
yield if block_given? | |||
|
|||
rsp = ask "\ncontinue (Y|n): ", 'y' | |||
|
|||
puts | |||
|
|||
elapsed = Time.now - start | |||
@@times << {:title => txt, :time => elapsed} | |||
|
|||
complete false if rsp.downcase == 'n' | |||
end | |||
|
|||
def example txt | |||
puts indent + '- ' + txt | |||
end | |||
|
|||
private | |||
|
|||
def ask prompt, default | |||
print prompt | |||
$stdin.gets.chomp || default | |||
end | |||
|
|||
def complete status = true | |||
if @@times.size > 0 | |||
title = status ? 'Congratulations!' : 'You completed the following:' | |||
|
|||
formatter = lambda do |sec| | |||
use = sec.round | |||
[use/3600, use/60 % 60, use % 60].map {|v| v.to_s.rjust(2,'0')}.join(':') | |||
end | |||
|
|||
puts "\n\n#{title}" | |||
puts @@times.inject('') {|s,p| s << "- #{p[:title][0,70].ljust(70, ' ')} #{formatter.call(p[:time]).rjust(10,' ')}\n"} | |||
puts '-' * 70 + ' ' * 5 + '-' * 8 | |||
puts 'Total Time taking Kata'.ljust(70, ' ') + ' ' * 5 + formatter.call(@@times.inject(0) {|s,h| s += h[:time]}) | |||
end | |||
|
|||
exit 1 unless status | |||
end | |||
|
|||
def ancestry | |||
caller.grep(/#{Regexp.escape(__FILE__)}/).map {|v| v.match(/^[^`]*`([^']*)'/)[1]} | |||
end | |||
|
|||
def indent | |||
nesting = ancestry.size - 2 | |||
' ' * (3 * nesting) | |||
end | |||
end | |||
|
|||
include Kata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,78 @@ | |||
module Kata | |||
module Base | |||
@@times = [] | |||
|
|||
def kata txt, lib = nil | |||
@kata_name = txt | |||
puts "#{@kata_name} Kata" | |||
yield if block_given? | |||
complete | |||
end | |||
|
|||
def context txt | |||
puts indent + txt | |||
yield if block_given? | |||
end | |||
|
|||
def requirement txt | |||
puts indent + txt | |||
|
|||
start = Time.now | |||
|
|||
yield if block_given? | |||
|
|||
rsp = ask "\ncompleted (Y|n): ", 'y' | |||
|
|||
puts | |||
|
|||
elapsed = Time.now - start | |||
@@times << {:title => txt, :time => elapsed} | |||
|
|||
complete false if rsp.downcase == 'n' | |||
end | |||
|
|||
def example txt | |||
puts indent + '- ' + txt | |||
end | |||
|
|||
def detail txt | |||
puts indent + '- ' + txt | |||
end | |||
|
|||
private | |||
|
|||
def ask prompt, default | |||
print prompt | |||
$stdin.gets.chomp || default | |||
end | |||
|
|||
def complete status = true | |||
if @@times.size > 0 | |||
title = status ? 'Congratulations!' : 'You completed the following:' | |||
|
|||
formatter = lambda do |sec| | |||
use = sec.round | |||
[use/3600, use/60 % 60, use % 60].map {|v| v.to_s.rjust(2,'0')}.join(':') | |||
end | |||
|
|||
puts "\n\n#{title}" | |||
puts @@times.inject('') {|s,p| s << "- #{p[:title][0,70].ljust(70, ' ')} #{formatter.call(p[:time]).rjust(10,' ')}\n"} | |||
puts '-' * 70 + ' ' * 5 + '-' * 8 | |||
puts "Total Time taking #{@kata_name} kata: ".ljust(70, ' ') + ' ' * 5 + formatter.call(@@times.inject(0) {|s,h| s += h[:time]}) | |||
end | |||
|
|||
exit 1 unless status | |||
end | |||
|
|||
def ancestry | |||
caller.grep(/#{Regexp.escape(__FILE__)}/).map {|v| v.match(/^[^`]*`([^']*)'/)[1]} | |||
end | |||
|
|||
def indent | |||
nesting = ancestry.size - 2 | |||
' ' * (3 * nesting) | |||
end | |||
end | |||
end | |||
|
|||
include Kata::Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
module Kata | |||
module Setup | |||
def build_repo(kata_name) | |||
build_tree(kata_name) | |||
end | |||
|
|||
def build_tree(kata_name) | |||
repo = 'kata-' + Time.now.strftime('%Y-%m-%d-%H:%M') | |||
%W{#{repo}/lib #{repo}/spec/support/helpers #{repo}/spec/support/matchers}.each {|path| mkdir_p path} | |||
end | |||
|
|||
# FileUtils really depends on rmagick? grrr | |||
def mkdir_p(path) | |||
%x{mkdir -p #{path}} | |||
end | |||
end | |||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters