derp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rvmrc +47 -0
- data/.watchr +24 -0
- data/Gemfile +4 -0
- data/LICENSE +14 -0
- data/README +17 -0
- data/Rakefile +8 -0
- data/TODO +1 -0
- data/derp.gemspec +21 -0
- data/lib/derp.rb +38 -0
- data/lib/derp/version.rb +3 -0
- data/test/derp_test.rb +31 -0
- metadata +78 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
7
|
+
environment_id="ruby-1.9.2-p136@derp"
|
8
|
+
|
9
|
+
#
|
10
|
+
# First we attempt to load the desired environment directly from the environment
|
11
|
+
# file, this is very fast and efficicent compared to running through the entire
|
12
|
+
# CLI and selector. If you want feedback on which environment was used then
|
13
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
14
|
+
#
|
15
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
16
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
|
17
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
18
|
+
else
|
19
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
20
|
+
rvm --create "$environment_id"
|
21
|
+
fi
|
22
|
+
|
23
|
+
#
|
24
|
+
# If you use an RVM gemset file to install a list of gems (*.gems), you can have
|
25
|
+
# it be automatically loaded, uncomment the following and adjust the filename if
|
26
|
+
# necessary.
|
27
|
+
#
|
28
|
+
# filename=".gems"
|
29
|
+
# if [[ -s "$filename" ]] ; then
|
30
|
+
# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
|
31
|
+
# fi
|
32
|
+
|
33
|
+
#
|
34
|
+
# If you use bundler and would like to run bundle each time you enter the
|
35
|
+
# directory you can uncomment the following code.
|
36
|
+
#
|
37
|
+
# # Ensure that Bundler is installed, install it if it is not.
|
38
|
+
# if ! command -v bundle ; then
|
39
|
+
# printf "The rubygem 'bundler' is not installed, installing it now.\n"
|
40
|
+
# gem install bundler
|
41
|
+
# fi
|
42
|
+
#
|
43
|
+
# # Bundle while redcing excess noise.
|
44
|
+
# printf "Bundling your gems this may take a few minutes on a fresh clone.\n"
|
45
|
+
# bundle | grep -v 'Using' | grep -v 'complete' | sed '/^$/d'
|
46
|
+
#
|
47
|
+
|
data/.watchr
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
def growl(message)
|
2
|
+
growlnotify = `which growlnotify`.chomp
|
3
|
+
title = "Watchr Test Results"
|
4
|
+
passed = message.include?('0 failures, 0 errors')
|
5
|
+
severity = passed ? "-1" : "1"
|
6
|
+
options = "-w -n Watchr"
|
7
|
+
options << " -m '#{message}' '#{title}' -p #{severity}"
|
8
|
+
system %(#{growlnotify} #{options} &)
|
9
|
+
end
|
10
|
+
|
11
|
+
def run_all_tests
|
12
|
+
system('clear')
|
13
|
+
result = `rake test`
|
14
|
+
growl result.split("\n")[-3] rescue nil
|
15
|
+
puts result
|
16
|
+
end
|
17
|
+
|
18
|
+
watch("test/derp_test\.rb") do
|
19
|
+
run_all_tests
|
20
|
+
end
|
21
|
+
|
22
|
+
watch("lib/derp\.rb") do
|
23
|
+
run_all_tests
|
24
|
+
end
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
2
|
+
Version 2, December 2004
|
3
|
+
|
4
|
+
Copyright (C) 2011 Steve Klabnik <steve@steveklabnik.com>
|
5
|
+
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
7
|
+
copies of this license document, and changing it is allowed as long
|
8
|
+
as the name is changed.
|
9
|
+
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
+
|
13
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
14
|
+
|
data/README
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
____ U _____ u ____ ____
|
4
|
+
| _"\ \| ___"|/U | _"\ uU| _"\ u
|
5
|
+
/| | | | | _|" \| |_) |/\| |_) |/
|
6
|
+
U| |_| |\| |___ | _ < | __/
|
7
|
+
|____/ u|_____| |_| \_\ |_|
|
8
|
+
|||_ << >> // \\_ ||>>_
|
9
|
+
(__)_) (__) (__) (__) (__)__)__)
|
10
|
+
|
11
|
+
Derp is a Ruby gem that derp-ifys your Strings.
|
12
|
+
|
13
|
+
<http://github.com/steveklabnik/derp>
|
14
|
+
|
15
|
+
Just 'gem install derp'. Then you can
|
16
|
+
"Hello World".to_derp to your heart's content.
|
17
|
+
|
data/Rakefile
ADDED
data/derp.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "derp/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "derp"
|
7
|
+
s.version = Derp::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Steve Klabnik"]
|
10
|
+
s.email = ["steve@steveklabnik.com"]
|
11
|
+
s.homepage = "http://github.com/steveklabnik/derp"
|
12
|
+
s.summary = %q{This gem gives you String#to_derp.}
|
13
|
+
s.description = %q{This gem gives you String#to_derp, which converts your string to morse code, and then encodes dots and dashes via herps and derps.}
|
14
|
+
|
15
|
+
s.add_development_dependency "watchr"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/lib/derp.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
class String
|
2
|
+
def to_derp
|
3
|
+
morse = {
|
4
|
+
'a' => 'herpderp',
|
5
|
+
'b' => 'derpherpherpherp',
|
6
|
+
'c' => 'derpherpderpherp',
|
7
|
+
'd' =>'derpherpherp',
|
8
|
+
'e' => 'herp',
|
9
|
+
'f' => 'herpherpderpherp',
|
10
|
+
'g' => 'derpderpherp',
|
11
|
+
'h' => 'herpherpherpherp',
|
12
|
+
'i' => 'herpherp',
|
13
|
+
'j' => 'herpderpderpderp',
|
14
|
+
'k' => 'derpherpderp',
|
15
|
+
'l' => 'herpderpherpherp',
|
16
|
+
'm' => 'derpderp',
|
17
|
+
'n' => 'derpherp',
|
18
|
+
'o' => 'derpderpderp',
|
19
|
+
'p' => 'herpderpderpherp',
|
20
|
+
'q' => 'derpderpherpderp',
|
21
|
+
'r' => 'herpderpherp',
|
22
|
+
's' => 'herpherpherp',
|
23
|
+
't' => 'derp',
|
24
|
+
'u' => 'herpherpderp',
|
25
|
+
'v' => 'herpherpherpderp',
|
26
|
+
'w' => 'herpderpderp',
|
27
|
+
'x' => 'derpherpherpderp',
|
28
|
+
'y' => 'derpherpderpderp',
|
29
|
+
'z' => 'derpderpherpherp',
|
30
|
+
' ' => '.'
|
31
|
+
}
|
32
|
+
out = ""
|
33
|
+
self.split(//).reverse.each do |c|
|
34
|
+
out += morse[c] + " " unless morse[c].nil?
|
35
|
+
end
|
36
|
+
out.rstrip
|
37
|
+
end
|
38
|
+
end
|
data/lib/derp/version.rb
ADDED
data/test/derp_test.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
puts "LET'S GET READY TO DEEEEEEEEEERRRRRRRRRRRRRRRRP!!!!!!!!!!1"
|
4
|
+
require 'derp'
|
5
|
+
|
6
|
+
class TestDerp < MiniTest::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@derp = "derp!"
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_to_derp_exists
|
12
|
+
assert_respond_to @derp, :to_derp
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_to_derp_returns_string
|
16
|
+
assert_instance_of String, @derp.to_derp
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_herps_and_derps
|
20
|
+
assert_equal "a".to_derp, "herpderp"
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_multiple_words
|
24
|
+
assert_equal "a a".to_derp, "herpderp . herpderp"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_long_words
|
28
|
+
assert_equal "aa".to_derp, "herpderp herpderp"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: derp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Steve Klabnik
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-24 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: watchr
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
27
|
+
description: This gem gives you String#to_derp, which converts your string to morse code, and then encodes dots and dashes via herps and derps.
|
28
|
+
email:
|
29
|
+
- steve@steveklabnik.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files: []
|
35
|
+
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- .rvmrc
|
39
|
+
- .watchr
|
40
|
+
- Gemfile
|
41
|
+
- LICENSE
|
42
|
+
- README
|
43
|
+
- Rakefile
|
44
|
+
- TODO
|
45
|
+
- derp.gemspec
|
46
|
+
- lib/derp.rb
|
47
|
+
- lib/derp/version.rb
|
48
|
+
- test/derp_test.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/steveklabnik/derp
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.5.0
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: This gem gives you String#to_derp.
|
77
|
+
test_files:
|
78
|
+
- test/derp_test.rb
|