Created
June 7, 2010 18:11
-
-
Save jszmajda/428977 to your computer and use it in GitHub Desktop.
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
gem 'ruby-terminfo' | |
require 'terminfo' | |
def syst(cmd) | |
sym = '-' | |
dist = ((TermInfo.screen_size[1].to_f/2.to_f) - ((cmd.length.to_f + 2.to_f) / 2.to_f)).floor.to_i | |
mid = cmd | |
#color = "7;93" | |
color = "93" | |
newlines = 4 | |
o = [] | |
newlines.times {o<<"\n"} | |
o << "\e[#{color}m" | |
dist.times { o << sym } | |
o << " #{mid} " | |
dist.times { o << sym } | |
o << "\e[0m" | |
puts o.join | |
system(cmd) | |
end | |
# RSpec | |
# helpers | |
watch ("spec/helpers/(.*)") { |md| syst("script/spec spec/helpers/#{md[1]}") } | |
watch ("app/helpers/(.*)\.rb") { |md| syst("script/spec spec/helpers/#{md[1]}_spec.rb") } | |
# models | |
watch ("spec/models/(.*)") { |md| syst("script/spec spec/models/#{md[1]}") } | |
watch ("app/models/(.*)\.rb") { |md| syst("script/spec spec/models/#{md[1]}_spec.rb") } | |
watch ("lib/manifest/.*.rb") { |md| syst("script/spec spec/models/manifest_spec.rb") } | |
# controllers | |
watch ("spec/controllers/(.*)\.rb") { |md| syst("script/spec spec/controllers/#{md[1]}.rb") } | |
watch ("app/controllers/(.*)\.rb") { |md| syst("script/spec spec/controllers/#{md[1]}_spec.rb") } | |
# views | |
watch ("spec/views/(.*)\.rb") { |md| syst("script/spec spec/views/#{md[1]}.rb") } | |
# lib | |
watch ("lib/(.*)\.rb") { |md| syst("script/spec spec/lib/#{md[1]}_spec.rb") } | |
watch ("spec/lib/(.*)\.rb") { |md| syst("script/spec spec/lib/#{md[1]}.rb") } | |
# Cucumber | |
watch ("features/(.*)\.feature") { |md| syst("cucumber features/#{md[1]}.feature") } | |
watch ("features/step_definitions/(.*)_steps\.rb") do |md| | |
if File.exists? "features/manage_#{md[1]}s.feature" | |
syst("cucumber features/manage_#{md[1]}s.feature") | |
else | |
syst("cucumber features/#{md[1]}.feature") | |
end | |
end | |
# Routes | |
watch("config/routes.rb") { |md| syst("rake routes") } | |
# Seeds | |
watch("db/seeds.rb") { |md| syst("rake db:seed --trace") } | |
watch("bin/optoro-image-style.rb") {|md| syst("ruby ./bin/optoro-image-style.rb public/images/logo.png; eog /tmp/output.logo.png")} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment