dummy_text 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,64 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dummy_text (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ abstract (1.0.0)
10
+ actionpack (3.0.10)
11
+ activemodel (= 3.0.10)
12
+ activesupport (= 3.0.10)
13
+ builder (~> 2.1.2)
14
+ erubis (~> 2.6.6)
15
+ i18n (~> 0.5.0)
16
+ rack (~> 1.2.1)
17
+ rack-mount (~> 0.6.14)
18
+ rack-test (~> 0.5.7)
19
+ tzinfo (~> 0.3.23)
20
+ activemodel (3.0.10)
21
+ activesupport (= 3.0.10)
22
+ builder (~> 2.1.2)
23
+ i18n (~> 0.5.0)
24
+ activesupport (3.0.10)
25
+ builder (2.1.2)
26
+ diff-lcs (1.1.2)
27
+ erubis (2.6.6)
28
+ abstract (>= 1.0.0)
29
+ i18n (0.5.0)
30
+ rack (1.2.3)
31
+ rack-mount (0.6.14)
32
+ rack (>= 1.0.0)
33
+ rack-test (0.5.7)
34
+ rack (>= 1.0)
35
+ railties (3.0.10)
36
+ actionpack (= 3.0.10)
37
+ activesupport (= 3.0.10)
38
+ rake (>= 0.8.7)
39
+ rdoc (~> 3.4)
40
+ thor (~> 0.14.4)
41
+ rake (0.9.2)
42
+ rdoc (3.9.3)
43
+ rspec (2.6.0)
44
+ rspec-core (~> 2.6.0)
45
+ rspec-expectations (~> 2.6.0)
46
+ rspec-mocks (~> 2.6.0)
47
+ rspec-core (2.6.4)
48
+ rspec-expectations (2.6.0)
49
+ diff-lcs (~> 1.1.2)
50
+ rspec-mocks (2.6.0)
51
+ rspec-rails (2.6.1)
52
+ actionpack (~> 3.0)
53
+ activesupport (~> 3.0)
54
+ railties (~> 3.0)
55
+ rspec (~> 2.6.0)
56
+ thor (0.14.6)
57
+ tzinfo (0.3.29)
58
+
59
+ PLATFORMS
60
+ x86-mingw32
61
+
62
+ DEPENDENCIES
63
+ dummy_text!
64
+ rspec-rails (>= 2.6.0)
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Matthias Frick
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,33 @@
1
+ === DummyText
2
+
3
+ DummyText is a little gem to generate lorem ipsum dummy text.
4
+ Further it is possible to generate your own text template.
5
+
6
+ === Install
7
+
8
+ gem install dummy_text
9
+
10
+ You can add it to your Gemfile:
11
+
12
+ gem "dummy_text"
13
+
14
+ === How it Works
15
+
16
+ DummyText offers a view helper:
17
+
18
+ <%= dummy_text "1c" %> # 1 character will be created
19
+ <%= dummy_text "2w" %> # 2 words will be created
20
+ <%= dummy_text "3s" %> # 3 sentences will be created
21
+ <%= dummy_text "4p" %> # 4 paragraphs will be created
22
+
23
+ === Create own Template
24
+
25
+ It is possible to generate your own text template. Just run the generator:
26
+
27
+ rails g dummy_text
28
+
29
+ This will copy a text_template.txt in "config/dummy_text/text_template".
30
+ Now you can edit the template the way you like!
31
+
32
+
33
+ Copyright (c) 2010 Matthias Frick, released under the MIT license
data/dummy_text.gemspec CHANGED
@@ -10,9 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.email = ["matthias@frick-web.at"]
11
11
  s.homepage = "https://github.com/mattherick/dummy_text"
12
12
  s.summary = %q{Create easy a lorem ipsum dummy text}
13
- s.description = %q{You can easy create dummy text with lorem ipsum content}
13
+ s.description = %q{You can easy create dummy text with lorem ipsum content, you can generate your own template}
14
14
 
15
15
  s.rubyforge_project = "dummy_text"
16
+
17
+ s.add_development_dependency("rspec-rails", [">= 2.6.0"])
16
18
 
17
19
  s.files = `git ls-files`.split("\n")
18
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,56 +1,88 @@
1
- module DummyText
2
- module Base
3
-
4
- class WrongFormat < StandardError; end
5
- class TooMuchError < StandardError; end
6
-
7
- def dummy_text(arg)
8
- if /(\d+)([c|w|s|p])/i.match(arg)
9
- count = $1.to_i
10
-
11
- case $2.downcase
12
- when "c" then character(count)
13
- when "w" then word(count)
14
- when "s" then sentence(count)
15
- when "p" then paragraph(count)
16
- end
17
- else
18
- raise WrongFormat, "Your dummy text has a wrong format! DummyText just understands 'Xc' for x characters, 'Xw' for x words, 'Xs' for x sentences, 'Xp' for x paragraphs, 'X' stands for the count."
19
- end
20
- end
21
-
22
- private
23
-
24
- # select "count characters"
25
- def character(count)
26
- raw Words.join(" ").chars.to_a[0...count].join
27
- end
28
-
29
- # select "count" words
30
- def word(count)
31
- raw Words[0...count].join(" ")
32
- end
33
-
34
- # select "count" sentences, wrap in p-tags
35
- def sentence(count)
36
- s = Sentences[0...count].join('. ')
37
- raw "<p>#{s}.</p>"
38
- end
39
-
40
- # select "count" paragraphs, wrap in p-tags
41
- def paragraph(count)
42
- count_paragraphs = Paragraphs.size
43
- if count > count_paragraphs
44
- raise TooMuchError, "Your template just offers #{count_paragraphs} paragraphs. Please extand it."
45
- end
46
-
47
- i = 0
48
- result = ""
49
- while i < count
50
- result += "<p>#{Paragraphs[i]}</p>"
51
- i += 1
52
- end
53
- raw result
54
- end
55
- end
1
+ require 'dummy_text/text'
2
+ require 'dummy_text/character'
3
+ require 'dummy_text/word'
4
+ require 'dummy_text/sentence'
5
+ require 'dummy_text/paragraph'
6
+
7
+ module DummyText
8
+ module Base
9
+
10
+ class WrongFormat < StandardError; end
11
+ class TooMuchError < StandardError; end
12
+
13
+ def dummy_text(arg)
14
+ template = Text.get_file
15
+ if /(\d+)([c|w|s|p])/i.match(arg)
16
+ count = $1.to_i
17
+
18
+ case $2.downcase
19
+ when "c" then character(count, template)
20
+ when "w" then word(count, template)
21
+ when "s" then sentence(count, template)
22
+ when "p" then paragraph(count, template)
23
+ end
24
+ else
25
+ raise WrongFormat, "Your dummy text has a wrong format! DummyText just understands 'Xc' for x characters, 'Xw' for x words, 'Xs' for x sentences, 'Xp' for x paragraphs, 'X' stands for the count."
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ # select "count characters"
32
+ def character(count, template)
33
+ out_of_order("c", count, template)
34
+ raw Character.new.render(count, template)
35
+ end
36
+
37
+ # select "count" words
38
+ def word(count, template)
39
+ out_of_order("w", count, template)
40
+ raw Word.new.render(count, template)
41
+ end
42
+
43
+ # select "count" sentences, wrap in p-tags
44
+ def sentence(count, template)
45
+ out_of_order("s", count, template)
46
+ raw "<p>#{Sentence.new.render(count, template)}</p>"
47
+ end
48
+
49
+ # select "count" paragraphs, wrap in p-tags
50
+ def paragraph(count, template)
51
+ out_of_order("p", count, template)
52
+ i = 0
53
+ result = ""
54
+ data = Paragraph.new.render(template)
55
+ while i < count
56
+ result += "<p>#{data[i]}</p>"
57
+ i += 1
58
+ end
59
+ raw result
60
+ end
61
+
62
+ def out_of_order(type, count, template)
63
+ case type
64
+ when "c"
65
+ characters = Character.number_of_characters(template)
66
+ if count > characters
67
+ raise TooMuchError, "The template just offers #{characters} characters. Please extand it."
68
+ end
69
+ when "w"
70
+ words = Word.number_of_words(template)
71
+ if count > words
72
+ raise TooMuchError, "The template just offers #{words} words. Please extand it."
73
+ end
74
+ when "s"
75
+ sentences = Sentence.number_of_sentences(template)
76
+ if count > sentences
77
+ raise TooMuchError, "The template just offers #{sentences} sentences. Please extand it."
78
+ end
79
+ when "p"
80
+ paragraphs = Paragraph.number_of_paragraphs(template)
81
+ if count > paragraphs
82
+ raise TooMuchError, "The template just offers #{paragraphs} paragraphs. Please extand it."
83
+ end
84
+ end
85
+ end
86
+
87
+ end
56
88
  end
@@ -0,0 +1,20 @@
1
+ require 'dummy_text/text'
2
+
3
+ module DummyText
4
+ class Character < Text
5
+
6
+ def initialize
7
+ end
8
+
9
+ def render(count, template)
10
+ data = get_file_as_array(template)
11
+ data.join(" ").chars.to_a[0...count].join
12
+ end
13
+
14
+ def self.number_of_characters(template)
15
+ data = self.get_file_as_string(template)
16
+ data.size
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ require 'dummy_text/text'
2
+
3
+ module DummyText
4
+ class Paragraph < Text
5
+
6
+ def initialize
7
+ end
8
+
9
+ def render(template)
10
+ data = get_file_as_array(template)
11
+ return data
12
+ end
13
+
14
+ def self.number_of_paragraphs(template)
15
+ data = self.get_file_as_string(template)
16
+ data.to_a.join.split("\n\n").size
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,11 @@
1
+ require 'dummy_text/base'
2
+
3
+ module DummyText
4
+
5
+ class Railtie < Rails::Railtie
6
+ initializer 'dummy_text.insert' do
7
+ ActionView::Base.send(:include, DummyText::Base)
8
+ end
9
+ end
10
+
11
+ end
@@ -0,0 +1,22 @@
1
+ require 'dummy_text/text'
2
+
3
+ module DummyText
4
+ class Sentence < Text
5
+
6
+ def initialize
7
+ end
8
+
9
+ def render(count, template)
10
+ data = get_file_as_array(template)
11
+ sentences = data.join.split('.')
12
+ s = sentences[0...count].join(".") + "."
13
+ return s
14
+ end
15
+
16
+ def self.number_of_sentences(template)
17
+ data = self.get_file_as_string(template)
18
+ data.split(".").size
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,27 @@
1
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
2
+ velit sagittis ultrices laoreet, neque nulla sagittis dolor, in tristique turpis
3
+ ipsum vitae diam. Integer leo lorem, ornare non tristique quis, pharetra at dolor.
4
+
5
+ Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
6
+ egestas. Maecenas ut lacinia est. Nullam imperdiet vestibulum dolor. Fusce posuere dui
7
+ eget erat suscipit in ultrices leo lobortis. Nunc id massa ante, id fermentum sem.
8
+
9
+ Phasellus posuere diam sed sapien eleifend ultricies. Praesent arcu dolor, sollicitudin
10
+ non mattis in, scelerisque tincidunt augue. Vestibulum ante ipsum primis in faucibus orci
11
+ luctus et ultrices posuere cubilia Curae; Quisque urna eros, tempor vel lacinia nec, ultricies at lorem.
12
+
13
+ Nullam ac rhoncus felis. Mauris sit amet odio quis ipsum suscipit tempus nec ac sapien.
14
+ Mauris eu est quam. Mauris ornare mauris in eros molestie a hendrerit nunc eleifend. Morbi
15
+ vehicula tortor sit amet nisl vehicula ac egestas odio tempor. Praesent diam tellus, placerat
16
+ ac lacinia at, interdum sed est. Sed aliquam viverra dolor, ac eleifend purus malesuada vitae.
17
+
18
+ Suspendisse augue enim, lacinia a porttitor quis, auctor venenatis elit. Pellentesque porttitor
19
+ dictum erat, sit amet dapibus quam ultricies ac. Mauris tempus tellus vitae lacus tempus vel interdum
20
+ leo imperdiet. Praesent volutpat, odio in volutpat condimentum, mauris lacus malesuada ante, vitae
21
+ congue felis metus eget libero.
22
+
23
+ In quis velit quis magna scelerisque facilisis. Praesent tempus justo vitae orci scelerisque ullamcorper
24
+ dignissim leo elementum. Pellentesque quis ipsum dolor, nec rhoncus leo. Donec semper lectus sit amet
25
+ velit aliquam ac sollicitudin nisi aliquam. Nulla consectetur tempus orci, non tincidunt lorem cursus a.
26
+ Fusce in nisi ac eros accumsan rhoncus. Mauris nec lacus urna, sit amet rutrum sapien. Suspendisse aliquam
27
+ congue erat, et rhoncus enim cursus vitae. Sed a nunc ante.
@@ -0,0 +1,32 @@
1
+ module DummyText
2
+ class Text
3
+
4
+ def initialize
5
+ end
6
+
7
+ def self.get_file
8
+ path = Rails.root.to_s + "/config/dummy_text/text_template.txt"
9
+ file = File.file?(path) ? Dir.glob(path) : Dir.glob(File.dirname(__FILE__) + "/template/text_template.txt")
10
+ file.first
11
+ end
12
+
13
+ def self.get_file_as_string(file)
14
+ data = ''
15
+ f = File.open(file, "r")
16
+ f.each_line do |line|
17
+ data += line
18
+ end
19
+ return data
20
+ end
21
+
22
+ def get_file_as_array(file)
23
+ data = ''
24
+ f = File.open(file, "r")
25
+ f.each_line do |line|
26
+ data += line
27
+ end
28
+ return data.to_a.join.split("\n\n")
29
+ end
30
+
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module DummyText
2
- VERSION = "0.0.1"
3
- end
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,20 @@
1
+ require 'dummy_text/text'
2
+
3
+ module DummyText
4
+ class Word < Text
5
+
6
+ def initialize
7
+ end
8
+
9
+ def render(count, template)
10
+ data = get_file_as_array(template)
11
+ data.join.split('. ').join.split[0...count].join(" ")
12
+ end
13
+
14
+ def self.number_of_words(template)
15
+ data = self.get_file_as_string(template)
16
+ data.scan(/(\w|-)+/).size
17
+ end
18
+
19
+ end
20
+ end
data/lib/dummy_text.rb CHANGED
@@ -1,13 +1,2 @@
1
+ require 'dummy_text/railtie' if defined?(Rails)
1
2
  require "rails" if defined?(Rails)
2
- require 'dummy_text/base'
3
- require 'dummy_text/template'
4
-
5
- module DummyText
6
-
7
- class Railtie < Rails::Railtie
8
- initializer 'dummy_text.insert' do
9
- ActionView::Base.send(:include, DummyText::Base)
10
- end
11
- end
12
-
13
- end
@@ -0,0 +1,12 @@
1
+ module Rails
2
+ module Generators
3
+ class DummyTextGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../dummy_text/template", __FILE__)
5
+
6
+ def generate_template
7
+ copy_file "text_template.txt", "config/dummy_text/text_template.txt"
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe DummyText::Character do
4
+
5
+ before(:each) do
6
+ @template = Dir.glob(File.dirname(__FILE__) + "/fixtures/short_template.txt").first
7
+ end
8
+
9
+ it "should render character" do
10
+ count = 2
11
+ DummyText::Character.new.render(count, @template).should == "lo"
12
+ end
13
+
14
+ it "should get number of characters" do
15
+ DummyText::Character.number_of_characters(@template).should == 12
16
+ end
17
+
18
+ end
@@ -0,0 +1,3 @@
1
+ lorem ipsum.
2
+
3
+ lorem2 ipsum2.
@@ -0,0 +1 @@
1
+ lorem ipsum.
@@ -0,0 +1,7 @@
1
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
2
+ velit sagittis ultrices laoreet, neque nulla sagittis dolor, in tristique turpis
3
+ ipsum vitae diam. Integer leo lorem, ornare non tristique quis, pharetra at dolor.
4
+
5
+ Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
6
+ egestas. Maecenas ut lacinia est. Nullam imperdiet vestibulum dolor. Fusce posuere dui
7
+ eget erat suscipit in ultrices leo lobortis. Nunc id massa ante, id fermentum sem.
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe DummyText::Paragraph do
4
+
5
+ before(:each) do
6
+ @template = Dir.glob(File.dirname(__FILE__) + "/fixtures/text_template.txt").first
7
+ end
8
+
9
+ it "should render paragraph" do
10
+ count = 1
11
+ DummyText::Paragraph.new.render(@template).should == ["Lorem ipsum dolor sit amet, consectetur adipiscing elit.
12
+ velit sagittis ultrices laoreet, neque nulla sagittis dolor, in tristique turpis
13
+ ipsum vitae diam. Integer leo lorem, ornare non tristique quis, pharetra at dolor.", " Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
14
+ egestas. Maecenas ut lacinia est. Nullam imperdiet vestibulum dolor. Fusce posuere dui
15
+ eget erat suscipit in ultrices leo lobortis. Nunc id massa ante, id fermentum sem."]
16
+ end
17
+
18
+ it "should get number of paragraphs" do
19
+ DummyText::Paragraph.number_of_paragraphs(@template).should == 2
20
+ end
21
+
22
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe DummyText::Sentence do
4
+
5
+ before(:each) do
6
+ @template = Dir.glob(File.dirname(__FILE__) + "/fixtures/middle_template.txt").first
7
+ end
8
+
9
+ it "should render sentence" do
10
+ count = 2
11
+ DummyText::Sentence.new.render(count, @template).should == "lorem ipsum.lorem2 ipsum2."
12
+ end
13
+
14
+ it "should get number of sentences" do
15
+ DummyText::Sentence.number_of_sentences(@template).should == 2
16
+ end
17
+
18
+ end
@@ -0,0 +1,12 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+
6
+ # gem dummy_text files
7
+ require "lib/dummy_text/base"
8
+ require "lib/dummy_text/text"
9
+ require "lib/dummy_text/character"
10
+ require "lib/dummy_text/word"
11
+ require "lib/dummy_text/sentence"
12
+ require "lib/dummy_text/paragraph"
data/spec/text_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ require 'rails'
3
+
4
+ describe DummyText::Text do
5
+
6
+ it "should get the file position of the template" do
7
+ DummyText::Text.get_file.should == "./lib/dummy_text/template/text_template.txt"
8
+ end
9
+
10
+ it "should get the file as a string" do
11
+ file = Dir.glob(File.dirname(__FILE__) + "/fixtures/short_template.txt").first
12
+ DummyText::Text.get_file_as_string(file).should == "lorem ipsum."
13
+ end
14
+
15
+ it "should get the file as an array" do
16
+ file = Dir.glob(File.dirname(__FILE__) + "/fixtures/middle_template.txt").first
17
+ text = DummyText::Text.new
18
+ text.get_file_as_array(file).should == ["lorem ipsum.", "lorem2 ipsum2." ]
19
+ end
20
+
21
+ end
data/spec/word_spec.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe DummyText::Word do
4
+
5
+ before(:each) do
6
+ @template = Dir.glob(File.dirname(__FILE__) + "/fixtures/short_template.txt").first
7
+ end
8
+
9
+ it "should render word" do
10
+ count = 2
11
+ DummyText::Word.new.render(count, @template).should == "lorem ipsum."
12
+ end
13
+
14
+ it "should get number of words" do
15
+ DummyText::Word.number_of_words(@template).should == 2
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dummy_text
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthias Frick
@@ -15,11 +15,26 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-22 00:00:00 +02:00
18
+ date: 2011-08-26 00:00:00 +02:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description: You can easy create dummy text with lorem ipsum content
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec-rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 2
32
+ - 6
33
+ - 0
34
+ version: 2.6.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: You can easy create dummy text with lorem ipsum content, you can generate your own template
23
38
  email:
24
39
  - matthias@frick-web.at
25
40
  executables: []
@@ -31,12 +46,31 @@ extra_rdoc_files: []
31
46
  files:
32
47
  - .gitignore
33
48
  - Gemfile
49
+ - Gemfile.lock
50
+ - MIT-LICENSE
51
+ - README.rdoc
34
52
  - Rakefile
35
53
  - dummy_text.gemspec
36
54
  - lib/dummy_text.rb
37
55
  - lib/dummy_text/base.rb
38
- - lib/dummy_text/template.rb
56
+ - lib/dummy_text/character.rb
57
+ - lib/dummy_text/paragraph.rb
58
+ - lib/dummy_text/railtie.rb
59
+ - lib/dummy_text/sentence.rb
60
+ - lib/dummy_text/template/text_template.txt
61
+ - lib/dummy_text/text.rb
39
62
  - lib/dummy_text/version.rb
63
+ - lib/dummy_text/word.rb
64
+ - lib/generators/dummy_text_generator.rb
65
+ - spec/character_spec.rb
66
+ - spec/fixtures/middle_template.txt
67
+ - spec/fixtures/short_template.txt
68
+ - spec/fixtures/text_template.txt
69
+ - spec/paragraphs_spec.rb
70
+ - spec/sentence_spec.rb
71
+ - spec/spec_helper.rb
72
+ - spec/text_spec.rb
73
+ - spec/word_spec.rb
40
74
  has_rdoc: true
41
75
  homepage: https://github.com/mattherick/dummy_text
42
76
  licenses: []
@@ -1,70 +0,0 @@
1
- module DummyText
2
- Paragraphs = [
3
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean condimentum, velit sagittis ultrices laoreet, neque nulla sagittis dolor, in tristique turpis ipsum vitae diam. Integer leo lorem, ornare non tristique quis, pharetra at dolor.",
4
-
5
- "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Maecenas ut lacinia est. Nullam imperdiet vestibulum dolor. Fusce posuere dui eget erat suscipit in ultrices leo lobortis. Nunc id massa ante, id fermentum sem.",
6
-
7
- "Phasellus posuere diam sed sapien eleifend ultricies. Praesent arcu dolor, sollicitudin non mattis in, scelerisque tincidunt augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque urna eros, tempor vel lacinia nec, ultricies at lorem.",
8
-
9
- "Nullam ac rhoncus felis. Mauris sit amet odio quis ipsum suscipit tempus nec ac sapien. Mauris eu est quam. Mauris ornare mauris in eros molestie a hendrerit nunc eleifend. Morbi vehicula tortor sit amet nisl vehicula ac egestas odio tempor. Praesent diam tellus, placerat ac lacinia at, interdum sed est. Sed aliquam viverra dolor, ac eleifend purus malesuada vitae.",
10
-
11
- "Suspendisse augue enim, lacinia a porttitor quis, auctor venenatis elit. Pellentesque porttitor dictum erat, sit amet dapibus quam ultricies ac. Mauris tempus tellus vitae lacus tempus vel interdum leo imperdiet. Praesent volutpat, odio in volutpat condimentum, mauris lacus malesuada ante, vitae congue felis metus eget libero.",
12
-
13
- "In quis velit quis magna scelerisque facilisis. Praesent tempus justo vitae orci scelerisque ullamcorper dignissim leo elementum. Pellentesque quis ipsum dolor, nec rhoncus leo. Donec semper lectus sit amet velit aliquam ac sollicitudin nisi aliquam. Nulla consectetur tempus orci, non tincidunt lorem cursus a. Fusce in nisi ac eros accumsan rhoncus. Mauris nec lacus urna, sit amet rutrum sapien. Suspendisse aliquam congue erat, et rhoncus enim cursus vitae. Sed a nunc ante.",
14
-
15
- "Pellentesque pulvinar erat in dui gravida eu tempor libero ultricies. Nunc placerat mauris eu lectus rutrum at ultrices mi facilisis. Pellentesque suscipit blandit erat vel eleifend. Fusce et laoreet mi. Sed eget laoreet ipsum. Aliquam erat volutpat.",
16
-
17
- "Integer mauris ante, semper at laoreet at, dictum tincidunt turpis. Nam faucibus odio sit amet sem varius sed mollis erat aliquet. Etiam eget nibh ut nulla consequat sagittis. Duis sit amet nisi ut est consequat vestibulum. Mauris nibh urna, vulputate et molestie non, facilisis in sapien.",
18
-
19
- "Donec sit amet vestibulum leo. Etiam pretium purus vitae ligula convallis malesuada. Curabitur tristique justo nec nulla vulputate eleifend. Nullam accumsan gravida ante, ut euismod sapien viverra vel. Morbi vitae eros ligula. Aenean tristique congue mauris ut placerat.",
20
-
21
- "Sed dui augue, aliquam in convallis at, vehicula in mauris. Maecenas vehicula ornare turpis et ullamcorper. In pharetra orci eget velit auctor sit amet convallis diam aliquet. Pellentesque ac orci elit. Aenean nec nulla eget erat aliquet rhoncus.",
22
-
23
- "Maecenas consectetur neque eget ligula cursus mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec eu mi ac elit porta dictum quis ut elit. Nulla sodales magna eu leo lacinia ut dictum ante volutpat. Donec gravida imperdiet orci at pharetra. Nullam luctus pretium risus eget commodo.",
24
-
25
- "Vivamus gravida purus vel nibh lobortis eu rhoncus dui imperdiet. Curabitur metus felis, facilisis a mattis vitae, accumsan eu nisi. Mauris vulputate, justo et pretium euismod, tellus felis venenatis velit, ac feugiat tellus metus a nisl. Morbi enim nunc, pharetra sit amet sagittis sed, faucibus vitae odio.",
26
-
27
- "Nullam fermentum, mauris eget auctor suscipit, leo turpis pulvinar ipsum, quis placerat mi nisi id dui. Nullam vehicula pulvinar mollis. Vestibulum ac dui eget nunc pellentesque imperdiet. Nulla facilisi. Pellentesque velit arcu, consectetur vitae aliquet at, tristique id nisi.",
28
-
29
- "Etiam quis mauris enim. Mauris erat metus, aliquet lacinia commodo semper, condimentum quis nunc. Aliquam euismod sapien dui, et adipiscing neque. Sed aliquet odio vitae purus viverra scelerisque. Maecenas quam dui, imperdiet a bibendum nec, dapibus et velit.",
30
-
31
- "Praesent turpis libero, feugiat eget scelerisque et, accumsan tincidunt lorem. Vivamus venenatis, ligula ac laoreet consequat, mi lacus euismod odio, placerat consectetur purus sapien et libero. Nulla mi turpis, dapibus ut eleifend nec, aliquam sed lorem. Praesent gravida, libero placerat scelerisque commodo, lorem nulla mattis sapien, non dapibus nibh justo vitae magna. Suspendisse sollicitudin, nibh eu adipiscing aliquam, enim ipsum volutpat ipsum, a porta tortor libero ut nisi.",
32
-
33
- "Nam vel quam id diam egestas rhoncus. Curabitur dolor mauris, egestas id lacinia viverra, vulputate eu quam. Cras leo purus, consectetur sed ornare nec, commodo id tellus. In sit amet urna purus.",
34
-
35
- "Sed quis dolor quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam tristique urna non felis ullamcorper ut fermentum arcu dignissim. Suspendisse sit amet libero eget dolor aliquam mattis.",
36
-
37
- "Sed congue ornare lectus eget gravida. Nulla ullamcorper venenatis tortor, at congue diam malesuada vitae. Suspendisse porttitor odio vitae velit consectetur faucibus venenatis diam rutrum. Donec eget urna at tellus pulvinar consectetur. Fusce volutpat est et lectus laoreet vestibulum.",
38
-
39
- "Ut ultricies semper facilisis. Suspendisse potenti. Proin id odio ut nulla facilisis porttitor. Nam varius sapien nec tortor pretium eu sagittis quam condimentum. Ut ac consequat tellus.",
40
-
41
- "Proin id eros eu sapien interdum imperdiet sed auctor risus. Aliquam quis lectus lectus, a venenatis dui. Suspendisse volutpat iaculis diam at molestie. Vestibulum eget lacus nibh, nec elementum lacus. Sed varius fringilla euismod.",
42
-
43
- "Mauris suscipit neque ut arcu viverra sodales pretium leo molestie. Aliquam accumsan massa quis mi lobortis adipiscing. Nulla quis elit magna, vel dictum turpis. Nam porta ultrices libero, in gravida ante rutrum eget. Nunc nec elit enim. Vivamus adipiscing justo in mi pellentesque sit amet accumsan nisi commodo. Nam ipsum nisi, gravida quis iaculis et, varius et nisl. Phasellus at nibh at dolor tincidunt sodales.",
44
-
45
- "Maecenas gravida, tortor a molestie congue, neque sem porttitor nisi, eget tempor ligula sem sit amet nisi. Suspendisse blandit sollicitudin leo vel interdum. Aenean et enim pharetra eros mattis consectetur eu vitae velit. Mauris porttitor, sapien at consectetur laoreet, justo nisi tincidunt justo, vel feugiat risus velit ut nulla.",
46
-
47
- "Vestibulum sagittis molestie convallis. Duis sollicitudin sodales sem, sit amet gravida velit sodales sed. Maecenas nec cursus turpis. Nunc at dolor quis orci lobortis varius vitae sit amet urna. Ut nec augue metus, a porta orci. Quisque a condimentum mauris. Mauris sit amet turpis quis orci consequat dictum sit amet sit amet nisl. Aliquam erat volutpat.",
48
-
49
- "Suspendisse potenti. Sed vitae leo ut nunc ornare ultricies. Vivamus porttitor, diam vitae ultrices commodo, lacus est pharetra diam, at molestie quam leo sed mauris. Morbi dignissim accumsan imperdiet. Suspendisse quis sem sed odio eleifend congue. Nam quis mi sit amet justo eleifend mollis. Mauris ac leo nec est pulvinar tincidunt a sed mi. Donec turpis ante, condimentum in vestibulum at, consequat non augue.",
50
-
51
- "Donec adipiscing iaculis tristique. Donec eleifend tempor sollicitudin. Mauris viverra lacus eu augue sollicitudin fermentum. Aenean bibendum convallis molestie. Nulla tincidunt tellus a est blandit id consectetur eros tincidunt.",
52
-
53
- "Sed at felis ut arcu ornare tristique. Vestibulum nec enim sed nisi egestas egestas. Nulla pulvinar semper mollis. Nulla condimentum lectus non neque dapibus sagittis. In non odio justo, id laoreet massa. Donec massa risus, accumsan sed placerat ac, pretium vel neque. Nam nec ante tortor, sed lacinia nunc. Nunc mollis sollicitudin arcu, a laoreet eros viverra a.",
54
-
55
- "Donec velit mi, pellentesque a aliquam sit amet, lobortis vel turpis. Vivamus nec lacus sit amet arcu volutpat suscipit. Morbi lobortis scelerisque convallis. Vestibulum dapibus, turpis id consectetur tristique, erat odio posuere augue, auctor consectetur diam ipsum ac tortor. Aenean non elit ut leo consequat rhoncus. Donec vulputate faucibus velit a congue.",
56
-
57
- "Integer ac velit id ante dictum consectetur vel ac nisi. Integer iaculis, ligula vel bibendum congue, mauris ante gravida libero, nec dignissim quam urna a urna. Integer sagittis ipsum in odio mattis lobortis. Nulla viverra tristique augue, id interdum magna rhoncus commodo.",
58
-
59
- "Sed eleifend, mauris eu tristique aliquam, nulla sapien pellentesque urna, in placerat odio dolor ut ipsum. Maecenas id mi a orci scelerisque hendrerit. Maecenas vehicula, ante at fermentum congue, neque felis placerat mauris, vitae imperdiet erat eros et neque. Etiam sed sem neque, id laoreet neque.",
60
-
61
- "Curabitur sit amet enim erat. Donec tellus nibh, placerat vitae euismod sed, mollis vel quam. Mauris vulputate, erat lacinia facilisis faucibus, magna neque placerat lectus, in pretium lorem orci ut libero. Ut sem lacus, eleifend condimentum feugiat ut, molestie ac urna.",
62
-
63
- "Pellentesque mattis varius justo vitae vestibulum. Ut tempor arcu tortor. Cras consectetur metus sit amet elit accumsan nec molestie nibh pretium. Nullam lobortis iaculis dapibus. Mauris tortor velit, porttitor eu auctor at, tempor dignissim orci."
64
- ]
65
-
66
- Sentences = Paragraphs.join.split('. ')
67
-
68
- Words = Sentences.join.split
69
-
70
- end