ruby-dude 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dd1ba217e0b8c2d9cdc42672f14212372fbb4a8e
4
+ data.tar.gz: f48a7945f701694ba748b8cec906426cf1262b86
5
+ SHA512:
6
+ metadata.gz: d521f5b9170e5741a89f85cec2e757bea3f54efe8e5d1187a324a20d04f9bb68c3d102b776747a6ac4191ec490d6370c77859db48c062d4d3d83697be9efa578
7
+ data.tar.gz: 3c98700472f85e48b9db9a74d64109ee8ad5d52c4e708b46f5407c49a3bcb469be24d0793baa565c16164387ac8996a06c9e40e2f524c6d3d9401d5113f7f94a
@@ -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/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tobias Schmid
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.
@@ -0,0 +1,84 @@
1
+ # Ruby Dude
2
+ ### A Lebowski Ipsum generator for Ruby
3
+
4
+ A simple Lebowski Ipsum generator for Ruby using the wonderful [Lebowski Ipsum](http://lebowskiipsum.com/).
5
+
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'ruby-dude'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ruby-dude
20
+
21
+
22
+ ## Usage
23
+
24
+ Within your code:
25
+
26
+ RubyDude::LebowskiIpsum.generate
27
+
28
+ Lebowski-fy the hell out of it by providing various optional parameters:
29
+
30
+ RubyDude::LebowskiIpsum.generate({
31
+ :paragraphs => '4' # How many paragraphs, man?
32
+ :cussin => 'false' # Throw in some cussin'? Not recommended for client work!
33
+ :mixed => 'false' # White Russian! Mix Lebowski quotes with old fashioned Lorem Ipsum.
34
+ :lebowskiipsum => 'true' # I'm the dude! Start the first paragraph with 'Lebowski Ipsum'.
35
+ :html => 'false' # Pigs in Blanket! Wrap your filler text in zee HTML tacs, OK?
36
+ :characters => '1,2' # Shut the fuck up, Donny! Want to refine the dialogue?
37
+ })
38
+
39
+ On the command line:
40
+
41
+ ruby-dude [options]
42
+
43
+ -h, --help C'mon dude give me some usage information
44
+ -p, --paragraphs [number] Number of paragraphs to generate
45
+ -c, --no-cussin Keep it squeaky clean for client work
46
+ -m, --mixed Mix Lebowski quotes with old fashioned Lorem Ipsum
47
+ -l, --lebowskiipsum Start the first paragraph with 'Lebowski Ipsum'
48
+ -t, --html Wrap your filler text in zee HTML tacs, OK?
49
+ -b, --buddies [buddies] Shut the fuck up, Donny!
50
+
51
+
52
+ ## Contributing
53
+
54
+ 1. Fork it
55
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
56
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
57
+ 4. Push to the branch (`git push origin my-new-feature`)
58
+ 5. Create new Pull Request
59
+
60
+
61
+ ## License
62
+
63
+ Copyright (c) 2013 Tobias Schmid
64
+
65
+ MIT License
66
+
67
+ Permission is hereby granted, free of charge, to any person obtaining
68
+ a copy of this software and associated documentation files (the
69
+ "Software"), to deal in the Software without restriction, including
70
+ without limitation the rights to use, copy, modify, merge, publish,
71
+ distribute, sublicense, and/or sell copies of the Software, and to
72
+ permit persons to whom the Software is furnished to do so, subject to
73
+ the following conditions:
74
+
75
+ The above copyright notice and this permission notice shall be
76
+ included in all copies or substantial portions of the Software.
77
+
78
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
79
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
80
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
81
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
82
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
83
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
84
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'lib/ruby-dude'
7
+ t.test_files = FileList['test/*_test.rb']
8
+ t.verbose = true
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ruby_dude'
4
+ require 'optparse'
5
+
6
+ options = {}
7
+ optparse = OptionParser.new do |opts|
8
+ opts.banner = "Usage: ruby-dude [options]"
9
+
10
+ opts.on('-p', '--paragraphs N', String, 'Number of paragraphs to generate') do |paragraphs|
11
+ options[:paragraphs] = paragraphs.to_s || '5'
12
+ end
13
+
14
+ opts.on('-c', '--no-cussin', String, 'Keep it squeaky clean for client work') do |cussin|
15
+ options[:cussin] = 'false'
16
+ end
17
+
18
+ opts.on('-m', '--mixed', String, 'Mix Lebowski quotes with old fashioned Lorem Ipsum') do |mixed|
19
+ options[:mixed] = 'true'
20
+ end
21
+
22
+ opts.on('-l', '--lebowskiipsum', String, "Start the first paragraph with 'Lebowski Ipsum'") do |lebowskiipsum|
23
+ options[:lebowskiipsum] = 'true'
24
+ end
25
+
26
+ opts.on('-t', '--html', String, 'Wrap your filler text in zee HTML tacs, OK?') do |html|
27
+ options[:html] = 'true'
28
+ end
29
+
30
+ opts.on('-b', '--character-buddies BUDDIES', String, 'Shut the fuck up, Donny!') do |characters|
31
+ options[:characters] = characters || '1'
32
+ end
33
+
34
+ opts.on('-h', '--help', "C'mon dude ...") do
35
+ puts opts
36
+ exit
37
+ end
38
+ end
39
+
40
+ optparse.parse!
41
+ dude = RubyDude::LebowskiIpsum.generate options
42
+ puts dude
@@ -0,0 +1,4 @@
1
+ module RubyDude
2
+ VERSION = '0.1.0'
3
+ end
4
+
@@ -0,0 +1,59 @@
1
+ require 'ruby-dude/version'
2
+ require 'net/http'
3
+ require 'open-uri'
4
+ require 'nokogiri'
5
+ require 'cgi'
6
+
7
+ module RubyDude
8
+ class LebowskiIpsum
9
+ # A simple Lebowski Ipsum generator for Ruby.
10
+ # Generates the lebowski ipsum paragraphs.
11
+ #
12
+ # options - The Hash options used to Lebowski-fy the hell out of it! (default: {}):
13
+ # :paragraphs - How many paragraphs, man? (optional).
14
+ # :cussin - Throw in some cussin'? (optional).
15
+ # :mixed - White Russian! Mix Lebowski quotes with old fashioned Lorem Ipsum (optional).
16
+ # :lebowskiipsum - I'm the dude! Start the first paragraph with 'Lebowski Ipsum' (optional).
17
+ # :html - Pigs in Blanket! Wrap your filler text in zee HTML tacs, OK? (optional).
18
+ # :characters - Shut the fuck up, Donny! Want to refine the dialogue? (optional).
19
+ #
20
+ # Example:
21
+ # RubyDude::LebowskiIpsum.generate
22
+ # # => Lebowski ipsum you know, the usual...
23
+ #
24
+ # Returns a lebowskified string.
25
+ def self.generate(options = {})
26
+ defaults = {
27
+ paragraphs: '5',
28
+ cussin: 'true',
29
+ mixed: 'false',
30
+ lebowskiipsum: 'false',
31
+ html: 'false',
32
+ characters: '1'
33
+ }
34
+
35
+ options = defaults.merge(options)
36
+
37
+ # http://www.lebowskiipsum.com/dude/generate/paragraphs/5/cussin/true/mixed/true/startleb/true/html/true/characters/1,2,3,4,5,8,9
38
+ uri = 'http://www.lebowskiipsum.com/dude/generate' +
39
+ '/paragraphs/' + options[:paragraphs] +
40
+ '/cussin/' + options[:cussin] +
41
+ '/mixed/' + options[:mixed] +
42
+ '/startleb/' + options[:lebowskiipsum] +
43
+ '/html/' + options[:html] +
44
+ '/characters/' + options[:characters]
45
+
46
+ req = URI.parse uri
47
+ res = Net::HTTP.get_response req
48
+
49
+ if res.code == '200'
50
+ page = Nokogiri::HTML(res.body)
51
+ text = page.css('textarea#lebowskiIpsum').text
52
+
53
+ CGI.unescapeHTML(text).force_encoding('UTF-8') if text
54
+ else
55
+ 'Well, uh ... looks like you got the wrong guy.'
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruby-dude/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "ruby-dude"
8
+ gem.version = RubyDude::VERSION
9
+ gem.authors = ["Tobias Schmid"]
10
+ gem.email = ["toashd@gmail.com"]
11
+ gem.description = %q{A Lebowski Ipsum generator for ruby}
12
+ gem.summary = %q{Generate some filler text that ties the room together}
13
+ gem.homepage = %q{http://github.com/toashd/ruby-dude}
14
+ gem.licenses = %w{MIT}
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency 'rake'
22
+ gem.add_dependency 'nokogiri'
23
+ end
24
+
@@ -0,0 +1,7 @@
1
+ require_relative '../test/test_helper'
2
+
3
+ describe RubyDude do
4
+ it "must be defined" do
5
+ RubyDude::VERSION.wont_be_nil
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/pride'
3
+ require File.expand_path('../../lib/ruby_dude.rb', __FILE__)
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-dude
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tobias Schmid
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A Lebowski Ipsum generator for ruby
42
+ email:
43
+ - toashd@gmail.com
44
+ executables:
45
+ - ruby-dude
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bin/ruby-dude
55
+ - lib/ruby-dude/version.rb
56
+ - lib/ruby_dude.rb
57
+ - ruby-dude.gemspec
58
+ - test/ruby_dude_test.rb
59
+ - test/test_helper.rb
60
+ homepage: http://github.com/toashd/ruby-dude
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.2.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Generate some filler text that ties the room together
84
+ test_files:
85
+ - test/ruby_dude_test.rb
86
+ - test/test_helper.rb