Skip to content

Instantly share code, notes, and snippets.

@bltavares
Forked from spicycode/README.md
Created July 8, 2011 00:20
Show Gist options
  • Select an option

  • Save bltavares/1070850 to your computer and use it in GitHub Desktop.

Select an option

Save bltavares/1070850 to your computer and use it in GitHub Desktop.

Revisions

  1. bltavares revised this gist Jul 8, 2011. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions yelly_the_yellingist_formatter.rb
    Original file line number Diff line number Diff line change
    @@ -27,16 +27,19 @@ def dabble_in_that_which_should_not_be_dabbled(say_what_now, example)
    end

    def shout!(say_what_now, example)
    system("say", say_what_now) if you_got_the_pipes?
    system("echo \"#{say_what_now.gsub /!/, ""}\" | esddsp festival --tts") if you_got_linux_pipes?
    if you_got_the_pipes?
    system("say", say_what_now)
    elsif you_got_linux_pipes?
    system("echo \"#{say_what_now.gsub /!/, ""}\" | esddsp festival --tts")
    end
    end

    def you_got_the_pipes?
    @pipes_present ||= system('which say > /dev/null')
    @pipes_present ||= system('which say > /dev/null 2>&1')
    end

    def you_got_linux_pipes?
    @pipes_present ||= system('which festival > /dev/null') && system("which esddsp > /dev/null")
    @linux_pipes_present ||= system('which festival > /dev/null 2>&1') && system("which esddsp > /dev/null 2>&1")
    end

    end
  2. bltavares revised this gist Jul 8, 2011. 2 changed files with 10 additions and 4 deletions.
    6 changes: 4 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@ YELLY!!!!! THE YELLINGIST FORMATTER EVER!!!!!

    Yelly likes to yell. To make the magic happen for simple cases just invoke him ala:

    bundle exec rspec --require=yelly_the_yellingist_formatter.rb --format=YellyTheYellingistFormatter spec/models/your_file_here_spec.rb
    bundle exec rspec --require=./yelly_the_yellingist_formatter.rb --format=YellyTheYellingistFormatter spec/models/your_file_here_spec.rb

    In closing, >:O
    In closing, >:O

    On Linux, require esddsp (from esd) and festival
    8 changes: 6 additions & 2 deletions yelly_the_yellingist_formatter.rb
    Original file line number Diff line number Diff line change
    @@ -27,12 +27,16 @@ def dabble_in_that_which_should_not_be_dabbled(say_what_now, example)
    end

    def shout!(say_what_now, example)
    return unless you_got_the_pipes?
    system("say", say_what_now)
    system("say", say_what_now) if you_got_the_pipes?
    system("echo \"#{say_what_now.gsub /!/, ""}\" | esddsp festival --tts") if you_got_linux_pipes?
    end

    def you_got_the_pipes?
    @pipes_present ||= system('which say > /dev/null')
    end

    def you_got_linux_pipes?
    @pipes_present ||= system('which festival > /dev/null') && system("which esddsp > /dev/null")
    end

    end
  3. @spicycode spicycode created this gist Jun 21, 2011.
    8 changes: 8 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    YELLY!!!!! THE YELLINGIST FORMATTER EVER!!!!!
    =============================================

    Yelly likes to yell. To make the magic happen for simple cases just invoke him ala:

    bundle exec rspec --require=yelly_the_yellingist_formatter.rb --format=YellyTheYellingistFormatter spec/models/your_file_here_spec.rb

    In closing, >:O
    38 changes: 38 additions & 0 deletions yelly_the_yellingist_formatter.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    require 'rspec/core/formatters/documentation_formatter'

    class YellyTheYellingistFormatter < RSpec::Core::Formatters::DocumentationFormatter

    def example_passed(example)
    dabble_in_that_which_should_not_be_dabbled('yes!', example)
    super(example)
    shout!('yes!', example)
    end

    def example_failed(example)
    dabble_in_that_which_should_not_be_dabbled('no!', example)
    super(example)
    shout!('no!', example)
    end

    def example_pending(example)
    dabble_in_that_which_should_not_be_dabbled('meh', example)
    super(example)
    shout!('meh', example)
    end

    private

    def dabble_in_that_which_should_not_be_dabbled(say_what_now, example)
    example.metadata[:description] = "#{say_what_now.upcase} - #{example.metadata[:description]}"
    end

    def shout!(say_what_now, example)
    return unless you_got_the_pipes?
    system("say", say_what_now)
    end

    def you_got_the_pipes?
    @pipes_present ||= system('which say > /dev/null')
    end

    end