metaipsum 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in metaipsum.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 TODO: Write your name
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,30 @@
1
+ # metaipsum
2
+ [![Build Status](https://secure.travis-ci.org/imkmf/metaipsum.png?branch=master)](http://travis-ci.org/imkmf/metaipsum)
3
+
4
+ **metaipsum** is a tool for creating *Lorem ipsum* generators. Get it? It's kind of meta, right?
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'metaipsum'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install metaipsum
19
+
20
+ ## Usage
21
+
22
+ Will be added on first functioning release.
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new('spec')
8
+ task :default => :spec
data/bin/metaipsum ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'metaipsum'
4
+
5
+ Metaipsum.generator
@@ -0,0 +1,3 @@
1
+ module Metaipsum
2
+ VERSION = "0.0.1"
3
+ end
data/lib/metaipsum.rb ADDED
@@ -0,0 +1,67 @@
1
+ require "metaipsum/version"
2
+
3
+ module Metaipsum
4
+
5
+ def self.version
6
+
7
+ "Metaipsum version #{Metaipsum::VERSION}"
8
+
9
+ end
10
+
11
+ def self.count
12
+
13
+ count = Random.rand(20..30)
14
+
15
+ end
16
+
17
+ def self.load
18
+ # Test for smaller files
19
+ base = ARGV[0]
20
+
21
+ gen = File.open("#{base}").read
22
+
23
+ end
24
+
25
+ def self.generator
26
+
27
+ base = ARGV[0]
28
+
29
+ gen = File.open("#{base}").read
30
+
31
+ if gen.split.size > 10
32
+
33
+ array = gen.split(/ /)
34
+
35
+ count = Metaipsum.count
36
+
37
+ ipsum = "Metaipsum ruby etc "
38
+
39
+ count.times do
40
+ ipsum << array.sample + " "
41
+ end
42
+
43
+ print <<-eos
44
+ You passed in:
45
+ #{ gen }
46
+
47
+ Here is your ipsum text:
48
+ #{ ipsum }
49
+
50
+ eos
51
+
52
+ else
53
+
54
+ return nil
55
+
56
+ end
57
+
58
+ rescue Errno::ENOENT => e
59
+
60
+ print <<-eos
61
+ You just broke everything. Just kidding - maybe you forgot to specify a file?"
62
+ USAGE: metaipsum <filename>
63
+ eos
64
+
65
+ end
66
+
67
+ end
data/metaipsum.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/metaipsum/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Kristian Freeman"]
6
+ gem.email = ["kristian@redsashimi.com"]
7
+ gem.description = "Lorem ipsum generator, generator"
8
+ gem.summary = "Now you can be hip and pseudo-Latin too!"
9
+ gem.homepage = "http://github.com/imkmf/metaipsum"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.default_executable = %q{metaipsum}
13
+ gem.executables = ["metaipsum"]
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.add_development_dependency "rspec", ">= 2.0.0"
16
+ gem.add_development_dependency "rake"
17
+ gem.name = "metaipsum"
18
+ gem.require_paths = ["lib"]
19
+ gem.version = Metaipsum::VERSION
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Metaipsum do
4
+
5
+ placeText = 'This is a test of the energy response system. All systems down! Crap!'
6
+
7
+ it 'should return correct version string' do
8
+ Metaipsum.version.should == "Metaipsum version #{Metaipsum::VERSION}"
9
+ end
10
+
11
+ it 'should load a file' do
12
+ ARGV[0] = 'spec/test.txt'
13
+ Metaipsum.load.should == placeText
14
+ end
15
+
16
+ it 'should warn about small sources' do
17
+ ARGV[0] = 'spec/short_test.txt' # Under 10 words
18
+ Metaipsum.generator.should == nil
19
+ end
20
+
21
+ it 'should pick a random number between 20 and 30 for count' do
22
+ (20..30).should cover(Metaipsum.count)
23
+ end
24
+
25
+ end
@@ -0,0 +1 @@
1
+ short!
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'metaipsum'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.formatter = 'documentation'
7
+ end
data/spec/test.txt ADDED
@@ -0,0 +1 @@
1
+ This is a test of the energy response system. All systems down! Crap!
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: metaipsum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kristian Freeman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Lorem ipsum generator, generator
47
+ email:
48
+ - kristian@redsashimi.com
49
+ executables:
50
+ - metaipsum
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - .travis.yml
56
+ - Gemfile
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - bin/metaipsum
61
+ - lib/metaipsum.rb
62
+ - lib/metaipsum/version.rb
63
+ - metaipsum.gemspec
64
+ - spec/metaipsum_spec.rb
65
+ - spec/short_test.txt
66
+ - spec/spec_helper.rb
67
+ - spec/test.txt
68
+ homepage: http://github.com/imkmf/metaipsum
69
+ licenses: []
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.23
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Now you can be hip and pseudo-Latin too!
92
+ test_files:
93
+ - spec/metaipsum_spec.rb
94
+ - spec/short_test.txt
95
+ - spec/spec_helper.rb
96
+ - spec/test.txt