fillertext 0.2.0 → 0.3.4
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.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/.rubocop.yml +179 -0
- data/CHANGELOG.md +70 -0
- data/CITATION.cff +13 -0
- data/Gemfile +16 -13
- data/LICENSE.txt +18 -17
- data/README.md +101 -0
- data/Rakefile +7 -46
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/fillertext/fillertext.rb +27 -62
- data/lib/fillertext/integer.rb +15 -0
- data/lib/fillertext/styles/hipster.rb +8 -5
- data/lib/fillertext/styles/lorem.rb +8 -7
- data/lib/fillertext/styles/mike_lange.rb +42 -0
- data/lib/fillertext/styles/yinzer.rb +16 -10
- data/lib/fillertext/version.rb +5 -0
- data/lib/fillertext.rb +7 -5
- metadata +27 -54
- data/.document +0 -5
- data/.rvmrc +0 -1
- data/.travis.yml +0 -6
- data/Gemfile.lock +0 -79
- data/README.mkd +0 -81
- data/VERSION +0 -1
- data/fillertext.gemspec +0 -67
- data/lib/fillertext/fixnum.rb +0 -14
- data/spec/fillertext_spec.rb +0 -106
- data/test/fillertext_test.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7a91b5be2408816b02278c14f589cc3f19c3e3392b5d0450d0cce389d1c1e9
|
4
|
+
data.tar.gz: a710779bec825496e0bd1a73deef0a8afe92dca62776609d5656544087d36d91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2890a5dcf4d30ffa3182ecb71ae9065d5abe9a1688ee5fa35d5465dcb8e42cd8d714465cdb4a3f95acf2ae0ceff77a3fe38d912c4399fca312f869e782f77a9d
|
7
|
+
data.tar.gz: 077c9d02a4ca66a9f28f3fb7698aa407cdadf7b2a9f3c87871573e22792a8e5069a8a8705131688b0e07786ff81657c2354743f2ea0b0306a64f88830f443e43
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
NewCops: enable
|
4
|
+
|
5
|
+
Style/StringLiterals:
|
6
|
+
Enabled: true
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
|
9
|
+
Style/StringLiteralsInInterpolation:
|
10
|
+
Enabled: true
|
11
|
+
EnforcedStyle: double_quotes
|
12
|
+
|
13
|
+
Layout/LineLength:
|
14
|
+
Max: 120
|
15
|
+
Exclude:
|
16
|
+
- 'lib/fillertext/styles/*.rb'
|
17
|
+
|
18
|
+
Gemspec/DateAssignment:
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
Gemspec/RequireMFA:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Layout/LineEndStringConcatenationIndentation:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Layout/SpaceBeforeBrackets:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
Lint/AmbiguousAssignment:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
Lint/AmbiguousOperatorPrecedence:
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Lint/AmbiguousRange:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
Lint/DeprecatedConstants:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Lint/DuplicateBranch:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Lint/EmptyBlock:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Lint/EmptyClass:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Lint/EmptyInPattern:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Lint/LambdaWithoutLiteralBlock:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Lint/NoReturnInBeginEndBlocks:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Lint/NumberedParameterAssignment:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Lint/OrAssignmentToConstant:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Lint/RedundantDirGlobSort:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Lint/RequireRelativeSelfPath:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Lint/SymbolConversion:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Lint/ToEnumArguments:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Lint/TripleQuotes:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Lint/UnexpectedBlockArity:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Lint/UnmodifiedReduceAccumulator:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Lint/UselessRuby2Keywords:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Naming/BlockForwarding:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Security/IoMethods:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Style/ArgumentsForwarding:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Style/CollectionCompact:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/DocumentDynamicEvalDefinition:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Style/EndlessMethod:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Style/FileRead:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
Style/FileWrite:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Style/HashConversion:
|
121
|
+
Enabled: true
|
122
|
+
|
123
|
+
Style/HashExcept:
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
Style/IfWithBooleanLiteralBranches:
|
127
|
+
Enabled: true
|
128
|
+
|
129
|
+
Style/InPatternThen:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
Style/MapToHash:
|
133
|
+
Enabled: true
|
134
|
+
|
135
|
+
Style/MultilineInPatternThen:
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
Style/NegatedIfElseCondition:
|
139
|
+
Enabled: true
|
140
|
+
|
141
|
+
Style/NilLambda:
|
142
|
+
Enabled: true
|
143
|
+
|
144
|
+
Style/NumberedParameters:
|
145
|
+
Enabled: true
|
146
|
+
|
147
|
+
Style/NumberedParametersLimit:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
Style/OpenStructUse:
|
151
|
+
Enabled: true
|
152
|
+
|
153
|
+
Style/QuotedSymbols:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
Style/RedundantArgument:
|
157
|
+
Enabled: true
|
158
|
+
|
159
|
+
Style/RedundantSelfAssignmentBranch:
|
160
|
+
Enabled: true
|
161
|
+
|
162
|
+
Style/SelectByRegexp:
|
163
|
+
Enabled: true
|
164
|
+
|
165
|
+
Style/StringChars:
|
166
|
+
Enabled: true
|
167
|
+
|
168
|
+
Style/SwapValues:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
Metrics/MethodLength:
|
172
|
+
Enabled: true
|
173
|
+
Exclude:
|
174
|
+
- 'lib/fillertext/styles/*.rb'
|
175
|
+
|
176
|
+
Metrics/BlockLength:
|
177
|
+
Enabled: true
|
178
|
+
Exclude:
|
179
|
+
- 'spec/*_spec.rb'
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
### [0.3.4](https://github.com/colindean/fillertext/compare/v0.3.3...v0.3.4) (2022-02-07)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* Fixes URL to Ashvith's profile ([256f4d3](https://github.com/colindean/fillertext/commit/256f4d353f19a9cec08d9a6ac76e95d8129933c2))
|
14
|
+
|
15
|
+
### [0.3.3](https://github.com/colindean/fillertext/compare/v0.3.2...v0.3.3) (2022-02-07)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* Get all git tags during release process ([fc54124](https://github.com/colindean/fillertext/commit/fc54124f77e218a5ae4f383f4f101e5d1404bcdc))
|
21
|
+
* Satisfies Rubocop checks ([531ad51](https://github.com/colindean/fillertext/commit/531ad5191f40a23b28006db41cd66eda499c35c8))
|
22
|
+
|
23
|
+
### [0.3.2](https://github.com/colindean/fillertext/compare/v0.3.1...v0.3.2) (2022-02-07)
|
24
|
+
|
25
|
+
|
26
|
+
### Bug Fixes
|
27
|
+
|
28
|
+
* Set git user/email in release workflow ([806b49a](https://github.com/colindean/fillertext/commit/806b49a46256688c7101cc621d188236deb9fc33))
|
29
|
+
|
30
|
+
### [0.3.1](https://github.com/colindean/fillertext/compare/v0.3.0...v0.3.1) (2022-02-07)
|
31
|
+
|
32
|
+
|
33
|
+
### Bug Fixes
|
34
|
+
|
35
|
+
* Source gemspec version from version.rb ([fc791c5](https://github.com/colindean/fillertext/commit/fc791c5009ff4dc4ceb2f640687aff1bcfcb7007))
|
36
|
+
|
37
|
+
## [0.3.0](https://github.com/colindean/fillertext/compare/v0.2.1...v0.3.0) (2022-02-07)
|
38
|
+
|
39
|
+
|
40
|
+
### Features
|
41
|
+
|
42
|
+
* Adds release instructions and tests an automated release ([2dd6c80](https://github.com/colindean/fillertext/commit/2dd6c80d83eac2b7c05e431a505fbb4a4b5da175))
|
43
|
+
|
44
|
+
|
45
|
+
## [0.2.1](https://www.github.com/colindean/fillertext/compare/v0.2.0...v0.2.1) (2021-10-27)
|
46
|
+
|
47
|
+
### Added
|
48
|
+
|
49
|
+
* `MikeLange` style, comprised of phrases from the [famous Pittsburgh Penguins hockey announcer](https://en.wikipedia.org/wiki/Mike_Lange) in honor of his retirement
|
50
|
+
* Development: Adds `rake irb` to drop to a console for interaction (@m3xq)
|
51
|
+
* Development: CI is now testing on the latest JRuby and TruffleRuby as well as Ruby 3.0
|
52
|
+
|
53
|
+
### Changed
|
54
|
+
|
55
|
+
* Updated CI links and badges in README
|
56
|
+
* Development: Now using GitHub Actions for CI instead of Travis
|
57
|
+
* Development: Prepare for Minitest 6 by updating test syntax and pinning Minitest 5+.
|
58
|
+
|
59
|
+
### Fixed
|
60
|
+
|
61
|
+
* Gemfile & Gemfile.lock to reduce vulnerabilities ([4f2c55b](https://www.github.com/colindean/fillertext/commit/4f2c55b29868d8e9ea174e53508d17167a36c3d7))
|
62
|
+
|
63
|
+
### Deprecated
|
64
|
+
|
65
|
+
* Ruby 2.5 support. Future releases will cease testing against Ruby 2.5 as it is end-of-life as of March 2021.
|
66
|
+
* Ruby 2.6 support. The first release after March 2022 will cease testing against Ruby 2.6 as it is end-of-life as of March 2022.
|
67
|
+
|
68
|
+
### Removed
|
69
|
+
|
70
|
+
* `Gemfile.lock` dropped from versioning to follow gem development [best practices](https://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/).
|
data/CITATION.cff
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
cff-version: 1.2.0
|
2
|
+
message: >
|
3
|
+
If you use this software in research or other work
|
4
|
+
wherein you are citing references and tools,
|
5
|
+
please consider citing fillertext as indicated below.
|
6
|
+
authors:
|
7
|
+
- family-names: "Dean"
|
8
|
+
given-names: "Colin"
|
9
|
+
orcid: "https://orcid.org/0000-0002-3374-6891"
|
10
|
+
title: "fillertext"
|
11
|
+
version: 0.2.2
|
12
|
+
date-released: 2022-01-26
|
13
|
+
url: "https://github.com/colindean/fillertext"
|
data/Gemfile
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in fillertext.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "rspec", "~> 3.0"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 1.21"
|
13
|
+
|
14
|
+
gem "rubocop-rake", "~> 0.5.1"
|
15
|
+
|
16
|
+
gem "rubocop-rspec", "~> 1.3", ">= 1.3.1"
|
data/LICENSE.txt
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
|
1
|
+
FillerText is licensed under the MIT license.
|
2
2
|
|
3
|
-
|
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:
|
3
|
+
Copyright (C) 2011-2022 by Colin Dean
|
10
4
|
|
11
|
-
|
12
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
FillerText
|
2
|
+
==========
|
3
|
+
|
4
|
+
by @colindean
|
5
|
+
|
6
|
+
[](https://github.com/colindean/fillertext/actions/workflows/testing.yml)
|
7
|
+
[](https://github.com/colindean/fillertext/actions/workflows/release.yml)
|
8
|
+
[](https://badge.fury.io/rb/fillertext)
|
9
|
+
|
10
|
+
Introduction
|
11
|
+
------------
|
12
|
+
|
13
|
+
FillerText is a gem useful for generating, well, filler text. It can do the standard "lorem ipsum" text or a variety of other clever substitute texts.
|
14
|
+
|
15
|
+
Installing FillerText
|
16
|
+
---------------------
|
17
|
+
|
18
|
+
Install using:
|
19
|
+
|
20
|
+
```sh
|
21
|
+
gem install fillertext
|
22
|
+
```
|
23
|
+
|
24
|
+
or add the gem to your project's `Gemfile`:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'fillertext'
|
28
|
+
```
|
29
|
+
|
30
|
+
Using FillerText
|
31
|
+
----------------
|
32
|
+
|
33
|
+
Here's how you use FillerText.
|
34
|
+
|
35
|
+
There are two main ways. One is cleaner because it keeps FillerText within its
|
36
|
+
own namespace. The other method will add `Fixnum#filler` to keep some tasty
|
37
|
+
syntactical sugar.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
FillerText::FillerText.sentences 5
|
41
|
+
FillerText::FillerText.words 2
|
42
|
+
FillerText::FillerText.characters 5
|
43
|
+
FillerText::FillerText.bytes 4
|
44
|
+
FillerText::FillerText.paragraphs 1
|
45
|
+
```
|
46
|
+
|
47
|
+
or the *much* easier and intended method:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
2.filler.sentences
|
51
|
+
1.filler.paragraphs
|
52
|
+
```
|
53
|
+
|
54
|
+
You can also change the style from the default "lorem ipsum" to something else.
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
# the old favorite
|
58
|
+
FillerText::FillerText.style = FillerText::Style::LoremIpsum
|
59
|
+
# a mash of words
|
60
|
+
FillerText::FillerText.style = FillerText::Style::HipsterIpsum
|
61
|
+
# handmade just like grandma's pierogies
|
62
|
+
FillerText::FillerText.style = FillerText::Style::YinzerIpsum
|
63
|
+
# homage to the great Pittsburgh Penguins announcer
|
64
|
+
FillerTest::FillerText.style = FillerText::Style::MikeLange
|
65
|
+
```
|
66
|
+
|
67
|
+
Contributing to FillerText
|
68
|
+
--------------------------
|
69
|
+
|
70
|
+
Patches welcome. Please file using Github issues.
|
71
|
+
|
72
|
+
I sincerely thank [Ashvith Shetty](https://github.com/Ashvith) for modernizing the build system
|
73
|
+
for this software in 2022. Things are a lot easier to handle now than they were
|
74
|
+
in 2011!
|
75
|
+
|
76
|
+
|
77
|
+
### Releases
|
78
|
+
|
79
|
+
As of 0.2.3, FillerText uses
|
80
|
+
[release-please](https://github.com/googleapis/release-please) along with
|
81
|
+
[release-please-action](https://github.com/google-github-actions/release-please-action)
|
82
|
+
for release automation in GitHub Actions.
|
83
|
+
|
84
|
+
Following [Conventional Commits v1.0
|
85
|
+
standard](https://www.conventionalcommits.org/en/v1.0.0/),
|
86
|
+
prefix a commit with `fix:` to increment the patch version in a future release,
|
87
|
+
prefix with `feat:` to increment the minor version, and
|
88
|
+
prefix with `feat!:` or `fix!:` or `refactor!:` to mark a breaking change and
|
89
|
+
a major version increment.
|
90
|
+
|
91
|
+
For more information, read the [release-please-action
|
92
|
+
documentation](https://github.com/google-github-actions/release-please-action#how-release-please-works)
|
93
|
+
on releasing.
|
94
|
+
|
95
|
+
License
|
96
|
+
-------
|
97
|
+
|
98
|
+
FillerText is licensed under the MIT license.
|
99
|
+
Copyright (C) 2011-2022 by Colin Dean.
|
100
|
+
See [LICENSE.txt](LICENSE.txt) for more.
|
101
|
+
|
data/Rakefile
CHANGED
@@ -1,51 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
require 'rake/testtask'
|
12
|
-
require 'jeweler'
|
13
|
-
require 'simplecov'
|
14
|
-
require 'rdoc/task'
|
1
|
+
# frozen_string_literal: true
|
15
2
|
|
16
|
-
|
17
|
-
|
18
|
-
gem.name = "fillertext"
|
19
|
-
gem.homepage = "http://github.com/colindean/fillertext"
|
20
|
-
gem.license = "MIT"
|
21
|
-
gem.summary = %Q{Generates filler/placeholder text in a Rubyistic way}
|
22
|
-
gem.description = %Q{Generates filler text through a direct interface or by monkeypatching Fixnum}
|
23
|
-
gem.email = "git+gems@cad.cx"
|
24
|
-
gem.authors = ["Colin Dean"]
|
25
|
-
# dependencies defined in Gemfile
|
26
|
-
end
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
27
5
|
|
28
|
-
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
29
7
|
|
30
|
-
|
31
|
-
t.libs.push 'lib'
|
32
|
-
t.test_files = FileList['spec/*_spec.rb']
|
33
|
-
t.verbose = true
|
34
|
-
end
|
8
|
+
require "rubocop/rake_task"
|
35
9
|
|
36
|
-
|
37
|
-
task :coverage do
|
38
|
-
`rake spec COVERAGE=true`
|
39
|
-
`open coverage/index.html`
|
40
|
-
end
|
10
|
+
RuboCop::RakeTask.new
|
41
11
|
|
42
|
-
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "fillertext #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
50
|
-
|
51
|
-
task :default => :spec
|
12
|
+
task default: %i[spec rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "fillertext"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -1,71 +1,36 @@
|
|
1
|
-
|
2
|
-
#this has to be here because of file require order issues
|
3
|
-
#todo: fix this
|
4
|
-
module Style; class LoremIpsum; end; end
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def self.bytes(n=nil)
|
13
|
-
FillerText.bytes n
|
3
|
+
Dir[File.join(__dir__, "styles/*.rb")].sort.each { |file| require_relative file }
|
4
|
+
|
5
|
+
# Helper module to choose styles
|
6
|
+
module FillerText
|
7
|
+
class << self
|
8
|
+
attr_accessor :style, :num
|
14
9
|
end
|
15
|
-
|
16
|
-
|
10
|
+
|
11
|
+
@style = FillerText::Style::LoremIpsum
|
12
|
+
|
13
|
+
def self.bytes(num = nil)
|
14
|
+
num ||= self.num
|
15
|
+
style.text[0, num]
|
17
16
|
end
|
18
|
-
|
19
|
-
|
17
|
+
|
18
|
+
def self.characters(num = nil)
|
19
|
+
bytes(num)
|
20
20
|
end
|
21
|
-
|
22
|
-
class FillerText
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
22
|
+
def self.words(num = nil)
|
23
|
+
num ||= self.num
|
24
|
+
style.text.split[0, num].join(" ").gsub(/[^\w\s]/, "")
|
25
|
+
end
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
def self.sentences(num = nil)
|
28
|
+
num ||= self.num
|
29
|
+
style.text.split(".").slice(0, num).join(". ")
|
30
|
+
end
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
@@num = n
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.n
|
41
|
-
@@num
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.bytes(n=nil)
|
45
|
-
n ||= self.n
|
46
|
-
self.style.text[0,n]
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.characters(n=nil)
|
50
|
-
#same thing for now
|
51
|
-
self.bytes(n)
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.words(n=nil)
|
55
|
-
n ||= self.n
|
56
|
-
#the idea here is to find the nth space and return everything before it
|
57
|
-
self.style.text.split[0,n].join(" ").gsub(/[^\w\s]/,'')
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.sentences(n=nil)
|
61
|
-
n ||= self.n
|
62
|
-
self.style.text.split('.').slice(0,n).join(". ")
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.paragraphs(n=nil)
|
66
|
-
n ||= self.n
|
67
|
-
self.style.text.split("\n").slice(0,n).join("\n")
|
68
|
-
end
|
69
|
-
|
32
|
+
def self.paragraphs(num = nil)
|
33
|
+
num ||= self.num
|
34
|
+
style.text.split("\n").slice(0, num).join("\n")
|
70
35
|
end
|
71
36
|
end
|