awesomesauce 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "bundler", "~> 1.0.0"
10
+ gem "jeweler", "~> 1.6.4"
11
+ gem "rcov", ">= 0"
12
+ end
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.4)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.2)
10
+ rcov (0.9.10)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.0.0)
17
+ jeweler (~> 1.6.4)
18
+ rcov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Zach Pendleton
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ # awesomesauce
2
+
3
+ Welcome to a drug named awesomesauce: a Rack middleware for replacing
4
+ the word "awesome" with synonyms for the word "awesome."
5
+
6
+ Why? Because when your life is awesome, you want to spend more time being
7
+ awesome and less time thinking of new, creative ways to tell your friends
8
+ just how awesome your life is.
9
+
10
+ ## Installation
11
+
12
+ gem install awesomesauce
13
+
14
+ ## Usage
15
+
16
+ ### Rails 3
17
+
18
+ # Gemfile
19
+ gem "awesomesauce"
20
+
21
+ # application.rb
22
+ config.middleware.use "Awesomesauce::Filter"
23
+
24
+ ### Sinatra
25
+
26
+ require "sinatra"
27
+ require "awesomesauce"
28
+
29
+ use Awesomesauce::Filter
30
+
31
+ get '/' do
32
+ 'Hello awesome world'
33
+ end
34
+
35
+ ## Configuration
36
+
37
+ Awesomesauce takes an optional array of synonyms that will be appended to
38
+ the default set of awesome substitute words. Use as follows:
39
+
40
+ use Awesomesauce::Filter, ["bumpin", "off the chain", "ridonkulous"]
41
+
42
+ ## Contributing to awesomesauce
43
+
44
+ Don't. If you get too close to awesomesauce, its awesomeness will literally
45
+ melt your face like a Spinal Tap concert.
46
+
47
+ ## Copyright
48
+
49
+ Copyright (c) 2011 Zach Pendleton. See LICENSE.txt for
50
+ further details.
51
+
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "awesomesauce"
18
+ gem.homepage = "http://github.com/zachpendleton/awesomesauce"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Because variety is the awesomesauce of life.}
21
+ gem.description = %Q{Rack middleware for replacing the word awesome with synonyms.}
22
+ gem.email = "zachpendleton@gmail.com"
23
+ gem.authors = ["Zach Pendleton"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "awesomesauce #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,62 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{awesomesauce}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Zach Pendleton}]
12
+ s.date = %q{2011-08-26}
13
+ s.description = %q{Rack middleware for replacing the word awesome with synonyms.}
14
+ s.email = %q{zachpendleton@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.mdown"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.mdown",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "awesomesauce.gemspec",
28
+ "lib/awesomesauce.rb",
29
+ "lib/awesomesauce/filter.rb",
30
+ "lib/awesomesauce/synonyms.rb",
31
+ "test/helper.rb",
32
+ "test/test_awesomesauce.rb",
33
+ "vendor/cache/git-1.2.5.gem",
34
+ "vendor/cache/jeweler-1.6.4.gem",
35
+ "vendor/cache/rake-0.9.2.gem",
36
+ "vendor/cache/rcov-0.9.10.gem"
37
+ ]
38
+ s.homepage = %q{http://github.com/zachpendleton/awesomesauce}
39
+ s.licenses = [%q{MIT}]
40
+ s.require_paths = [%q{lib}]
41
+ s.rubygems_version = %q{1.8.9}
42
+ s.summary = %q{Because variety is the awesomesauce of life.}
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 3
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
49
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
50
+ s.add_development_dependency(%q<rcov>, [">= 0"])
51
+ else
52
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
53
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
54
+ s.add_dependency(%q<rcov>, [">= 0"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
59
+ s.add_dependency(%q<rcov>, [">= 0"])
60
+ end
61
+ end
62
+
@@ -0,0 +1,4 @@
1
+ $:.unshift(File.expand_path(File.dirname(__FILE__)))
2
+
3
+ require "awesomesauce/synonyms"
4
+ require "awesomesauce/filter"
@@ -0,0 +1,28 @@
1
+ module Awesomesauce
2
+ class Filter
3
+ def initialize(app, synonyms = [])
4
+ @app = app
5
+ @synonyms = Awesomesauce::Synonyms | synonyms
6
+ end
7
+
8
+ def call(env)
9
+ status, headers, response = @app.call(env)
10
+ response.each do |part|
11
+ while part.match(/(A|a)wesome/)
12
+ part.sub! /(A|a)wesome[a-z]*/ do |match|
13
+ puts match.class
14
+ match[0] == "A" ? get_synonym.capitalize : get_synonym
15
+ end
16
+ end
17
+ end
18
+
19
+ headers["Content-Length"] = response.join.length.to_s
20
+ [status, headers, response]
21
+ end
22
+
23
+ protected
24
+ def get_synonym
25
+ @synonyms[rand(@synonyms.length)]
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,34 @@
1
+ module Awesomesauce
2
+ Synonyms = [
3
+ "alarming",
4
+ "amazing",
5
+ "astonishing",
6
+ "awe-inspiring",
7
+ "beautiful",
8
+ "breathtaking",
9
+ "really cool",
10
+ "daunting",
11
+ "exalted",
12
+ "fantastic",
13
+ "fearful",
14
+ "formidable",
15
+ "frantic",
16
+ "grand",
17
+ "imposing",
18
+ "impressive",
19
+ "incredible",
20
+ "intimidating",
21
+ "magnificent",
22
+ "majestic",
23
+ "marvelous",
24
+ "mind-blowing",
25
+ "overwhelming",
26
+ "primo",
27
+ "sensational",
28
+ "shocking",
29
+ "striking",
30
+ "stunning",
31
+ "wonderful",
32
+ "wondrous",
33
+ ]
34
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ require 'awesomesauce'
15
+
16
+ class Test::Unit::TestCase
17
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestAwesomesauce < Test::Unit::TestCase
4
+ def test_something_for_real
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: awesomesauce
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Zach Pendleton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &70257373559960 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70257373559960
25
+ - !ruby/object:Gem::Dependency
26
+ name: jeweler
27
+ requirement: &70257373558120 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.4
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70257373558120
36
+ - !ruby/object:Gem::Dependency
37
+ name: rcov
38
+ requirement: &70257373556040 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70257373556040
47
+ description: Rack middleware for replacing the word awesome with synonyms.
48
+ email: zachpendleton@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files:
52
+ - LICENSE.txt
53
+ - README.mdown
54
+ files:
55
+ - .document
56
+ - Gemfile
57
+ - Gemfile.lock
58
+ - LICENSE.txt
59
+ - README.mdown
60
+ - Rakefile
61
+ - VERSION
62
+ - awesomesauce.gemspec
63
+ - lib/awesomesauce.rb
64
+ - lib/awesomesauce/filter.rb
65
+ - lib/awesomesauce/synonyms.rb
66
+ - test/helper.rb
67
+ - test/test_awesomesauce.rb
68
+ - vendor/cache/git-1.2.5.gem
69
+ - vendor/cache/jeweler-1.6.4.gem
70
+ - vendor/cache/rake-0.9.2.gem
71
+ - vendor/cache/rcov-0.9.10.gem
72
+ homepage: http://github.com/zachpendleton/awesomesauce
73
+ licenses:
74
+ - MIT
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ segments:
86
+ - 0
87
+ hash: -999543868382060180
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 1.8.9
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Because variety is the awesomesauce of life.
100
+ test_files: []