garble 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 05b43dca119f27fd439e02100636af22689baa97
4
+ data.tar.gz: 6ed340fb1da36f8d4b67c6996b04751575e5f71e
5
+ SHA512:
6
+ metadata.gz: 9f295ba43035ba8e621667ea912ea779c3b9ecde4035bae3ffd1b78b97633f56102314f3359c7e2f0f84c52f90f41c7da29ff9d23889133da163a041ed618bb2
7
+ data.tar.gz: 5dd4d04975b509ee3143e428886a7531edb978c4c597a29524718ed5f453b3cc6afb770eb6e3d2690e8966f782807d963a0701d02a9429e21db8ca7d8170f1d0
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in garble.gemspec
4
+ gemspec
@@ -0,0 +1,13 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
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.
@@ -0,0 +1,22 @@
1
+ # Garble
2
+
3
+ Garble replaces words with synonyms.
4
+
5
+ ## Installation
6
+
7
+ $ gem install garble
8
+
9
+ ## Usage
10
+
11
+ $ echo "I love this" | garble
12
+ > 1 sexual activity this
13
+
14
+ Garble uses [Big Huge Thesaurus](http://words.bighugelabs.com/) and you'll have to
15
+ [register an account](http://words.bighugelabs.com/api.php) to get your daily fix of words.
16
+ Don't worry, though, they're totally cool. Set the environment variable `GARBLE_KEY` to your
17
+ API key when you're done and knock yourself out.
18
+
19
+ ## I love you
20
+
21
+ Johannes Gorset made this. You should [tweet me](http://twitter.com/jgorset) if you can't get
22
+ it to work. In fact, you should tweet me anyway.
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "garble"
4
+
5
+ Garble.run $stdin, ARGV.first
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'garble/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "garble"
8
+ spec.version = Garble::VERSION
9
+ spec.authors = ["Johannes Gorset"]
10
+ spec.email = ["jgorset@gmail.com"]
11
+ spec.summary = "Garble replaces words with synonyms"
12
+ spec.description = "Garble replaces words with synonyms"
13
+ spec.homepage = "http://github.com/jgorset/garble"
14
+ spec.license = "WTFPL"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "dinosaurus", "~> 0.0.11"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ end
@@ -0,0 +1,54 @@
1
+ require "garble/version"
2
+
3
+ require "dinosaurus"
4
+
5
+ module Garble
6
+
7
+ class << self
8
+
9
+ def run(stdin, key)
10
+ key ||= ENV['GARBLE_KEY']
11
+
12
+ error 'No STDIN given' unless stdin
13
+ error 'No Big Huge Thesaurus key given' unless key
14
+
15
+ Dinosaurus.configure do |config|
16
+ config.api_key = key
17
+ end
18
+
19
+ bits = stdin.read.split " "
20
+
21
+ bits.each do |bit|
22
+ matches = bit.match /([a-zA-Z0-9-]*)([\r\n .,!?:;]?)/
23
+
24
+ original_word = matches[1]
25
+ punctuation = matches[2]
26
+
27
+ if original_word
28
+ word = Dinosaurus.synonyms_of(original_word).sample || original_word
29
+
30
+ if original_word =~ /^[A-Z]/
31
+ word.capitalize!
32
+ end
33
+
34
+ print word
35
+ end
36
+
37
+ if punctuation
38
+ print punctuation
39
+ end
40
+
41
+ print " "
42
+ end
43
+
44
+ puts
45
+ end
46
+
47
+ def error(message)
48
+ puts message
49
+ exit
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,3 @@
1
+ module Garble
2
+ VERSION = "0.0.2"
3
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: garble
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Johannes Gorset
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dinosaurus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.11
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.11
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Garble replaces words with synonyms
56
+ email:
57
+ - jgorset@gmail.com
58
+ executables:
59
+ - garble
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/garble
69
+ - garble.gemspec
70
+ - lib/garble.rb
71
+ - lib/garble/version.rb
72
+ homepage: http://github.com/jgorset/garble
73
+ licenses:
74
+ - WTFPL
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.2.2
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Garble replaces words with synonyms
96
+ test_files: []
97
+ has_rdoc: