dogeipsum 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZTk0OWYzNDJiNjJmN2VjYTZmMzNjZTE5ODFlZTA5ODVhODAwNGZhMA==
5
+ data.tar.gz: !binary |-
6
+ YTUwNzEwMjUzZjJmYjE3YjZlYjUyYWQ0NjY3NjNkYjZlNjRiNzQ1OA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NTAyNzNlMmQzN2MzZmFjODg1NjMyMWFjMmI4MTUxYzhjZjFlZDIwZDJhNjcy
10
+ YjRlNmM3YTg1NDNkMzMwZjFhYjA0YzA1YTYxZmFjNTExZDhmMDZmM2FmZGU4
11
+ OWYwMzBlODZmZWY2NmMzMmRlZTYxOWFmYWIwY2RkM2JkYjAwZGY=
12
+ data.tar.gz: !binary |-
13
+ OWRjNzc1MmIwMGNjNDE4MmQ0ZmNhNDAyMjI0Y2E3MzFjYmFiMTY3NTFlODM2
14
+ MDRkMDAxOWNmMzEwNjY4MzQ4YTU1NTE5ZTRmMWZmNzczNzk1YzZkYTA1NzA5
15
+ YzJmNWVlMmQxMzk3MzNiNzUyZGNhOGM1Mjg0M2ZmZTFmM2Q5M2Q=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dogeipsum.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Lin Qiu
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # DogeIpsum::Wow
2
+
3
+ ![](http://cdn.memegenerator.net/instances/500x/44540209.jpg)
4
+
5
+ Wow, many ipsum! Such Generate!
6
+
7
+ ## How Installate!
8
+
9
+ such line to Gemfile:
10
+
11
+ gem 'dogeipsum'
12
+
13
+ how execute:
14
+
15
+ $ bundle
16
+
17
+ many independence:
18
+
19
+ $ gem install dogeipsum
20
+
21
+ ## Usage
22
+
23
+ Great Use!
24
+
25
+ ```ruby
26
+ opts = { :paragraphs => 2, :lines => 2 }
27
+ DogeIpsum::Wow.generate(opts)
28
+ ```
29
+
30
+ Such choices!
31
+
32
+ ```ruby
33
+ DogeIpsum::Wow.many_lines(2)
34
+ DogeIpsum::Wow.many_paragraphs(2)
35
+ ```
36
+
37
+ ## Many wishes
38
+
39
+ 1. add option to include latin and hipster
40
+ 2. include more doge speak
41
+ 3. dominate the world
42
+
43
+ ## Such Help!
44
+
45
+ 1. Fork it
46
+ 2. Create your feature branch (`git checkout -b wow-such-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add such feature'`)
48
+ 4. Push to the branch (`git push origin wow-such-feature`)
49
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/dogeipsum.gemspec ADDED
@@ -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 'dogeipsum/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dogeipsum"
8
+ spec.version = DogeIpsum::VERSION
9
+ spec.authors = ["Lin Qiu"]
10
+ spec.email = ["theonlylinqiu@gmail.com"]
11
+ spec.description = %q{ wow such generate! }
12
+ spec.summary = %q{ many ipsum! such generate! }
13
+ spec.homepage = "https://github.com/linqiu/dogeipsum"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "pry"
25
+ end
data/lib/dogeipsum.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "dogeipsum/version"
2
+ require "dogeipsum/word_generator"
3
+ require "dogeipsum/wow"
@@ -0,0 +1,3 @@
1
+ module DogeIpsum
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,37 @@
1
+ module DogeIpsum
2
+ module WordGenerator
3
+ def doge_modifiers
4
+ %w{ wow such many so very yum incredible cagey quite blast gee hotdoge whoo wonderful }
5
+ end
6
+
7
+ def doge_nouns
8
+ %w{ lines speed generate developer hip treasure mayor doge awake technology sport eyes video-games vibes}
9
+ end
10
+
11
+ def hipster_words
12
+ %w{ pour-over banh mi meh Kogi sweater organic cardigan selfies gluten-free
13
+ Lo-fi polaroid brunch mlkshk Echo Park Intelligentsia sweater McSweeney's Semiotics bitters tofu
14
+ single-origin coffee chambray squid Brooklyn Godard stumptown Portland blog kale chips plaid Echo
15
+ Park banh mi artisan whatever cray Authentic beard raw denim Godard meggings Banksy retro vinyl American
16
+ Apparel Austin Pitchfork American Apparel viral readymade mustache asymmetrical 90's Try-hard forage quinoa
17
+ High Life art party Fixie literally meh fap polaroid hoodie Helvetica tousled
18
+ farm-to-table Wes Anderson you probably haven't heard of them twee literally pickled Messenger bag tousled try-hard
19
+ hoodie hella Butcher meggings Brooklyn ethnic synth mustache Echo Park forage tote bag Pitchfork Master
20
+ cleanse fap try-hard paleo meh hashtag synth Tote bag paleo tofu bespoke biodiesel sustainable
21
+ small batch Brooklyn fixie Schlitz scenester roof party viral }
22
+ end
23
+
24
+ def latin_words
25
+ %w{ adipiscing Nam cursus Morbi ut mi Nullam enim leo id condimentum laoreet mattis massa Sed eleifend nonummy diam ante elementum
26
+ et bibendum posuere sit amet nibh Duis tincidunt lectus dui viverra vestibulum Suspendisse vulputate aliquam dui Nulla elementum
27
+ dui ut augue Aliquam vehicula mi mauris Maecenas placerat nisl consequat rhoncus sem nunc gravida justo eleifend arcu velit
28
+ lacus Morbi magna magna tincidunt mattis non imperdiet vitae tellus Sed odio est auctor ac sollicitudin consequat vitae orci Fusce id felis
29
+ Vivamus sollicitudin metus eget eros Pellentesque morbi tristique senectus et netus et malesuada fames ac posuere felis nec
30
+ Pellentesque faucibus Ut accumsan ultricies justo id velit placerat molestie Donec dictum lectus non odio Cras ante vitae
31
+ enim iaculis aliquam Mauris nunc quam venenatis nec euismod sit amet egestas placerat est Pellentesque habitant morbi tristique senectus
32
+ et netus et malesuada fames ac turpis egestas Cras id Integer urna Ut ante enim dapibus malesuada fringilla eu condimentum
33
+ tellus Aenean porttitor eros vel dolor Donec pede venenatis nibh Duis quam Nam eget lacus Aliquam erat volutpat Quisque
34
+ dignissim congue leo Mauris vel lacus vitae vestibulum }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,64 @@
1
+ module DogeIpsum
2
+ class Wow
3
+ include DogeIpsum::WordGenerator
4
+
5
+ OPTIONS = [:lines, :paragraphs, :words]
6
+
7
+ def self.generate(opts = {})
8
+ new opts
9
+ end
10
+
11
+ def self.method_missing(name, *args)
12
+ if name.to_s.index('many_') == 0
13
+ generate(name.to_s.split('many_').last.to_sym => args.first)
14
+ else
15
+ super
16
+ end
17
+ end
18
+
19
+ def to_s
20
+ @lorem
21
+ end
22
+
23
+ private
24
+
25
+ def initialize(opts)
26
+ @lorem = ""
27
+
28
+ if opts.empty?
29
+ @lorem = get_paragraph
30
+ else
31
+ opts.keys.sort do |a, b|
32
+ -(a <=> b)
33
+ end
34
+ .map do |key|
35
+ if OPTIONS.include?(key)
36
+ add_to_lorem = opts[key].times.inject("") {|sum, time| [sum, get(key)].reject(&:empty?).join(' ')}
37
+ @lorem = [@lorem, add_to_lorem].join(' ')
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ def get_paragraph
44
+ 4.times.inject("") do |sum, time|
45
+ [sum, get_line.capitalize].reject(&:empty?).join(' ')
46
+ end
47
+ end
48
+
49
+ def get_line
50
+ 4.times.inject("") do |sum, time|
51
+ sum = [sum, get_word].reject(&:empty?).join(', ')
52
+ end
53
+ .concat "!"
54
+ end
55
+
56
+ def get_word
57
+ [doge_modifiers[rand(doge_modifiers.count)], doge_nouns[rand(doge_nouns.count)]].join(' ')
58
+ end
59
+
60
+ def get(key)
61
+ self.send("get_"+key.to_s.chop)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe DogeIpsum do
4
+
5
+ describe "#wow_generate" do
6
+ let(:wow_paragraph) { DogeIpsum::Wow.generate }
7
+ let(:opts) {{ :paragraphs => 2, :lines => 2 }}
8
+ let(:paragraphs) { DogeIpsum::Wow.generate(opts) }
9
+
10
+ describe "no option" do
11
+ it "such generate, wow one paragraph" do
12
+ binding.pry
13
+ wow_paragraph.to_s.scan(/[!]/).count.should == 4
14
+ end
15
+ end
16
+
17
+ describe "many options" do
18
+ it "such generate, wow two paragraphs and two lines" do
19
+ paragraphs.to_s.scan(/[!]/).count.should == 10
20
+ end
21
+ end
22
+ end
23
+
24
+ describe "#such choices" do
25
+ context "such good method" do
26
+ let(:choices) { DogeIpsum::Wow.many_lines(2) }
27
+
28
+ it "generate lines" do
29
+ choices.to_s.scan(/[!]/).count.should == 2
30
+ end
31
+ end
32
+
33
+ context "such bad method" do
34
+ it "such generate errors" do
35
+ expect { DogeIpsum::Wow.such_many_fake_doges_out_there(2) }.to raise_error(NoMethodError)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'dogeipsum'
8
+ require 'pry'
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dogeipsum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Lin Qiu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: ! ' wow such generate! '
70
+ email:
71
+ - theonlylinqiu@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - dogeipsum.gemspec
83
+ - lib/dogeipsum.rb
84
+ - lib/dogeipsum/version.rb
85
+ - lib/dogeipsum/word_generator.rb
86
+ - lib/dogeipsum/wow.rb
87
+ - spec/dogeipsum/dogeipsum.rb
88
+ - spec/spec_helper.rb
89
+ homepage: https://github.com/linqiu/dogeipsum
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.1.5
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: many ipsum! such generate!
113
+ test_files:
114
+ - spec/dogeipsum/dogeipsum.rb
115
+ - spec/spec_helper.rb